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

/*
* Copyright (c) 2018 elementary, Inc. (https://elementary.io)
*               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 <gtk/gtk.h>
#include <glib.h>
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
#include <gio/gio.h>
#include <pango/pango.h>
#include <granite.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.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_TREE_TYPE_ENTRY_WRAPPER (sidebar_tree_entry_wrapper_get_type ())
#define SIDEBAR_TREE_ENTRY_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TREE_TYPE_ENTRY_WRAPPER, SidebarTreeEntryWrapper))
#define SIDEBAR_TREE_ENTRY_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDEBAR_TREE_TYPE_ENTRY_WRAPPER, SidebarTreeEntryWrapperClass))
#define SIDEBAR_TREE_IS_ENTRY_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TREE_TYPE_ENTRY_WRAPPER))
#define SIDEBAR_TREE_IS_ENTRY_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDEBAR_TREE_TYPE_ENTRY_WRAPPER))
#define SIDEBAR_TREE_ENTRY_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDEBAR_TREE_TYPE_ENTRY_WRAPPER, SidebarTreeEntryWrapperClass))

typedef struct _SidebarTreeEntryWrapper SidebarTreeEntryWrapper;
typedef struct _SidebarTreeEntryWrapperClass SidebarTreeEntryWrapperClass;
enum  {
	SIDEBAR_TREE_0_PROPERTY,
	SIDEBAR_TREE_NUM_PROPERTIES
};
static GParamSpec* sidebar_tree_properties[SIDEBAR_TREE_NUM_PROPERTIES];
typedef enum  {
	SIDEBAR_TREE_COLUMNS_NAME,
	SIDEBAR_TREE_COLUMNS_TOOLTIP,
	SIDEBAR_TREE_COLUMNS_WRAPPER,
	SIDEBAR_TREE_COLUMNS_ICON,
	SIDEBAR_TREE_COLUMNS_CLOSED_PIXBUF,
	SIDEBAR_TREE_COLUMNS_OPEN_PIXBUF,
	SIDEBAR_TREE_COLUMNS_PIXBUF_VISIBLE,
	SIDEBAR_TREE_COLUMNS_N_COLUMNS
} SidebarTreeColumns;

#define SIDEBAR_TREE_TYPE_COLUMNS (sidebar_tree_columns_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_GtkTreeRowReference_free0(var) ((var == NULL) ? NULL : (var = (_vala_GtkTreeRowReference_free (var), NULL)))
#define __vala_GtkTreePath_free0(var) ((var == NULL) ? NULL : (var = (_vala_GtkTreePath_free (var), NULL)))
typedef struct _SidebarTreeEntryWrapperPrivate SidebarTreeEntryWrapperPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#define SIDEBAR_TREE_TYPE_ROOT_WRAPPER (sidebar_tree_root_wrapper_get_type ())
#define SIDEBAR_TREE_ROOT_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TREE_TYPE_ROOT_WRAPPER, SidebarTreeRootWrapper))
#define SIDEBAR_TREE_ROOT_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDEBAR_TREE_TYPE_ROOT_WRAPPER, SidebarTreeRootWrapperClass))
#define SIDEBAR_TREE_IS_ROOT_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TREE_TYPE_ROOT_WRAPPER))
#define SIDEBAR_TREE_IS_ROOT_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDEBAR_TREE_TYPE_ROOT_WRAPPER))
#define SIDEBAR_TREE_ROOT_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDEBAR_TREE_TYPE_ROOT_WRAPPER, SidebarTreeRootWrapperClass))

typedef struct _SidebarTreeRootWrapper SidebarTreeRootWrapper;
typedef struct _SidebarTreeRootWrapperClass SidebarTreeRootWrapperClass;
typedef struct _SidebarTreeRootWrapperPrivate SidebarTreeRootWrapperPrivate;
#define __vala_GtkTreeIter_free0(var) ((var == NULL) ? NULL : (var = (_vala_GtkTreeIter_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _command_manager_unref0(var) ((var == NULL) ? NULL : (var = (command_manager_unref (var), NULL)))
enum  {
	SIDEBAR_TREE_ENTRY_WRAPPER_0_PROPERTY,
	SIDEBAR_TREE_ENTRY_WRAPPER_NUM_PROPERTIES
};
static GParamSpec* sidebar_tree_entry_wrapper_properties[SIDEBAR_TREE_ENTRY_WRAPPER_NUM_PROPERTIES];
enum  {
	SIDEBAR_TREE_ROOT_WRAPPER_0_PROPERTY,
	SIDEBAR_TREE_ROOT_WRAPPER_NUM_PROPERTIES
};
static GParamSpec* sidebar_tree_root_wrapper_properties[SIDEBAR_TREE_ROOT_WRAPPER_NUM_PROPERTIES];
enum  {
	SIDEBAR_TREE_ENTRY_SELECTED_SIGNAL,
	SIDEBAR_TREE_SELECTED_ENTRY_REMOVED_SIGNAL,
	SIDEBAR_TREE_BRANCH_ADDED_SIGNAL,
	SIDEBAR_TREE_BRANCH_REMOVED_SIGNAL,
	SIDEBAR_TREE_BRANCH_SHOWN_SIGNAL,
	SIDEBAR_TREE_PAGE_CREATED_SIGNAL,
	SIDEBAR_TREE_DESTROYING_PAGE_SIGNAL,
	SIDEBAR_TREE_NUM_SIGNALS
};
static guint sidebar_tree_signals[SIDEBAR_TREE_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 _SidebarTreePrivate {
	GtkTreeStore* store;
	GtkIconTheme* icon_theme;
	GtkCellRendererText* text_renderer;
	SidebarTreeExternalDropHandler drop_handler;
	gpointer drop_handler_target;
	GtkEntry* text_entry;
	GeeHashMap* icon_cache;
	GeeHashMap* entry_map;
	GeeHashMap* branches;
	gint editing_disabled;
	gboolean mask_entry_selected_signal;
	SidebarTreeEntryWrapper* selected_wrapper;
	GtkMenu* default_context_menu;
	gboolean is_internal_drag_in_progress;
	SidebarEntry* internal_drag_source_entry;
	GtkTreeRowReference* old_path_ref;
};

struct _SidebarTreeEntryWrapper {
	GObject parent_instance;
	SidebarTreeEntryWrapperPrivate * priv;
	SidebarEntry* entry;
	GtkTreeRowReference* row;
};

struct _SidebarTreeEntryWrapperClass {
	GObjectClass parent_class;
};

struct _SidebarTreeRootWrapper {
	SidebarTreeEntryWrapper parent_instance;
	SidebarTreeRootWrapperPrivate * priv;
	gint root_position;
};

struct _SidebarTreeRootWrapperClass {
	SidebarTreeEntryWrapperClass parent_class;
};

static gint SidebarTree_private_offset;
static gpointer sidebar_tree_parent_class = NULL;
static gpointer sidebar_tree_entry_wrapper_parent_class = NULL;
static gpointer sidebar_tree_root_wrapper_parent_class = NULL;

static GType sidebar_tree_entry_wrapper_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void sidebar_tree_on_editing_canceled (SidebarTree* self);
static void _sidebar_tree_on_editing_canceled_gtk_cell_renderer_editing_canceled (GtkCellRenderer* _sender,
                                                                           gpointer self);
static void sidebar_tree_on_editing_started (SidebarTree* self,
                                      GtkCellEditable* editable,
                                      const gchar* path);
static void _sidebar_tree_on_editing_started_gtk_cell_renderer_editing_started (GtkCellRenderer* _sender,
                                                                         GtkCellEditable* editable,
                                                                         const gchar* path,
                                                                         gpointer self);
static void sidebar_tree_on_theme_change (SidebarTree* self);
static void _sidebar_tree_on_theme_change_gtk_icon_theme_changed (GtkIconTheme* _sender,
                                                           gpointer self);
static GType sidebar_tree_columns_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void _vala_GtkTreeRowReference_free (GtkTreeRowReference* self);
static gboolean sidebar_tree_on_selection (SidebarTree* self,
                                    GtkTreeSelection* selection,
                                    GtkTreeModel* model,
                                    GtkTreePath* path,
                                    gboolean path_currently_selected);
static gboolean _sidebar_tree_on_selection_gtk_tree_selection_func (GtkTreeSelection* selection,
                                                             GtkTreeModel* model,
                                                             GtkTreePath* path,
                                                             gboolean path_currently_selected,
                                                             gpointer self);
static void _vala_array_add100 (GtkTargetEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkTargetEntry* value);
static gboolean sidebar_tree_on_context_menu_keypress (SidebarTree* self);
static gboolean _sidebar_tree_on_context_menu_keypress_gtk_widget_popup_menu (GtkWidget* _sender,
                                                                       gpointer self);
static void sidebar_tree_on_drag_begin (SidebarTree* self,
                                 GdkDragContext* ctx);
static void _sidebar_tree_on_drag_begin_gtk_widget_drag_begin (GtkWidget* _sender,
                                                        GdkDragContext* context,
                                                        gpointer self);
static void sidebar_tree_on_drag_end (SidebarTree* self,
                               GdkDragContext* ctx);
static void _sidebar_tree_on_drag_end_gtk_widget_drag_end (GtkWidget* _sender,
                                                    GdkDragContext* context,
                                                    gpointer self);
static gboolean sidebar_tree_on_drag_motion (SidebarTree* self,
                                      GdkDragContext* context,
                                      gint x,
                                      gint y,
                                      guint time_);
static gboolean _sidebar_tree_on_drag_motion_gtk_widget_drag_motion (GtkWidget* _sender,
                                                              GdkDragContext* context,
                                                              gint x,
                                                              gint y,
                                                              guint time_,
                                                              gpointer self);
static void _vala_GtkTreePath_free (GtkTreePath* self);
static SidebarTreeEntryWrapper* sidebar_tree_get_wrapper_at_path (SidebarTree* self,
                                                           GtkTreePath* path);
static gboolean sidebar_tree_has_wrapper (SidebarTree* self,
                                   SidebarEntry* entry);
static SidebarTreeEntryWrapper* sidebar_tree_get_wrapper (SidebarTree* self,
                                                   SidebarEntry* entry);
static SidebarTreeEntryWrapper* sidebar_tree_get_wrapper_at_iter (SidebarTree* self,
                                                           GtkTreeIter* iter);
static GtkTreePath* sidebar_tree_entry_wrapper_get_path (SidebarTreeEntryWrapper* self);
static GtkTreePath* sidebar_tree_get_selected_path (SidebarTree* self);
static GtkTreePath* _vala_GtkTreePath_copy (GtkTreePath* self);
static void __vala_GtkTreePath_free0_ (gpointer var);
static inline void _g_list_free___vala_GtkTreePath_free0_ (GList* self);
static void sidebar_tree_real_cursor_changed (GtkTreeView* base);
static void sidebar_tree_associate_branch (SidebarTree* self,
                                    SidebarBranch* branch);
static void sidebar_tree_on_branch_entry_added (SidebarTree* self,
                                         SidebarBranch* branch,
                                         SidebarEntry* entry);
static void _sidebar_tree_on_branch_entry_added_sidebar_branch_entry_added (SidebarBranch* _sender,
                                                                     SidebarEntry* entry,
                                                                     gpointer self);
static void sidebar_tree_on_branch_entry_removed (SidebarTree* self,
                                           SidebarBranch* branch,
                                           SidebarEntry* entry);
static void _sidebar_tree_on_branch_entry_removed_sidebar_branch_entry_removed (SidebarBranch* _sender,
                                                                         SidebarEntry* entry,
                                                                         gpointer self);
static void sidebar_tree_on_branch_entry_moved (SidebarTree* self,
                                         SidebarBranch* branch,
                                         SidebarEntry* entry);
static void _sidebar_tree_on_branch_entry_moved_sidebar_branch_entry_moved (SidebarBranch* _sender,
                                                                     SidebarEntry* entry,
                                                                     gpointer self);
static void sidebar_tree_on_branch_entry_reparented (SidebarTree* self,
                                              SidebarBranch* branch,
                                              SidebarEntry* entry,
                                              SidebarEntry* old_parent);
static void _sidebar_tree_on_branch_entry_reparented_sidebar_branch_entry_reparented (SidebarBranch* _sender,
                                                                               SidebarEntry* entry,
                                                                               SidebarEntry* old_parent,
                                                                               gpointer self);
static void sidebar_tree_on_branch_children_reordered (SidebarTree* self,
                                                SidebarBranch* branch,
                                                SidebarEntry* entry);
static void _sidebar_tree_on_branch_children_reordered_sidebar_branch_children_reordered (SidebarBranch* _sender,
                                                                                   SidebarEntry* entry,
                                                                                   gpointer self);
static void sidebar_tree_on_show_branch (SidebarTree* self,
                                  SidebarBranch* branch,
                                  gboolean shown);
static void _sidebar_tree_on_show_branch_sidebar_branch_show_branch (SidebarBranch* _sender,
                                                              gboolean show,
                                                              gpointer self);
static GType sidebar_tree_root_wrapper_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void _vala_GtkTreeIter_free (GtkTreeIter* self);
static GtkTreeIter* _vala_GtkTreeIter_copy (GtkTreeIter* self);
static void sidebar_tree_associate_wrapper (SidebarTree* self,
                                     GtkTreeIter* assoc_iter,
                                     SidebarTreeEntryWrapper* wrapper);
static SidebarTreeRootWrapper* sidebar_tree_root_wrapper_new (GtkTreeModel* model,
                                                       SidebarEntry* entry,
                                                       GtkTreePath* path,
                                                       gint root_position);
static SidebarTreeRootWrapper* sidebar_tree_root_wrapper_construct (GType object_type,
                                                             GtkTreeModel* model,
                                                             SidebarEntry* entry,
                                                             GtkTreePath* path,
                                                             gint root_position);
static void sidebar_tree_associate_children (SidebarTree* self,
                                      SidebarBranch* branch,
                                      SidebarEntry* parent,
                                      GtkTreeIter* parent_iter);
static void sidebar_tree_associate_entry (SidebarTree* self,
                                   GtkTreeIter* assoc_iter,
                                   SidebarEntry* entry);
static SidebarTreeEntryWrapper* sidebar_tree_entry_wrapper_new (GtkTreeModel* model,
                                                         SidebarEntry* entry,
                                                         GtkTreePath* path);
static SidebarTreeEntryWrapper* sidebar_tree_entry_wrapper_construct (GType object_type,
                                                               GtkTreeModel* model,
                                                               SidebarEntry* entry,
                                                               GtkTreePath* path);
static void sidebar_tree_load_entry_icons (SidebarTree* self,
                                    GtkTreeIter* iter);
static void sidebar_tree_on_sidebar_tooltip_changed (SidebarTree* self,
                                              SidebarEntry* entry,
                                              const gchar* tooltip);
static void _sidebar_tree_on_sidebar_tooltip_changed_sidebar_entry_sidebar_tooltip_changed (SidebarEntry* _sender,
                                                                                     const gchar* tooltip,
                                                                                     gpointer self);
static void sidebar_tree_on_sidebar_icon_changed (SidebarTree* self,
                                           SidebarEntry* entry,
                                           GIcon* icon);
static void _sidebar_tree_on_sidebar_icon_changed_sidebar_entry_sidebar_icon_changed (SidebarEntry* _sender,
                                                                               GIcon* icon,
                                                                               gpointer self);
static void sidebar_tree_on_sidebar_page_created (SidebarTree* self,
                                           SidebarPageRepresentative* entry,
                                           Page* page);
static void _sidebar_tree_on_sidebar_page_created_sidebar_page_representative_page_created (SidebarPageRepresentative* _sender,
                                                                                     Page* page,
                                                                                     gpointer self);
static void sidebar_tree_on_sidebar_destroying_page (SidebarTree* self,
                                              SidebarPageRepresentative* entry,
                                              Page* page);
static void _sidebar_tree_on_sidebar_destroying_page_sidebar_page_representative_destroying_page (SidebarPageRepresentative* _sender,
                                                                                           Page* page,
                                                                                           gpointer self);
static void sidebar_tree_on_sidebar_name_changed (SidebarTree* self,
                                           SidebarRenameableEntry* entry,
                                           const gchar* name);
static void _sidebar_tree_on_sidebar_name_changed_sidebar_renameable_entry_sidebar_name_changed (SidebarRenameableEntry* _sender,
                                                                                          const gchar* name,
                                                                                          gpointer self);
static void sidebar_tree_on_sidebar_open_closed_icons_changed (SidebarTree* self,
                                                        SidebarExpandableEntry* entry,
                                                        GIcon* open,
                                                        GIcon* closed);
static void _sidebar_tree_on_sidebar_open_closed_icons_changed_sidebar_expandable_entry_sidebar_open_closed_icons_changed (SidebarExpandableEntry* _sender,
                                                                                                                    GIcon* open,
                                                                                                                    GIcon* closed,
                                                                                                                    gpointer self);
static gboolean sidebar_tree_is_category_header (SidebarTreeEntryWrapper* wrapper);
VALA_EXTERN void sidebar_entry_grafted (SidebarEntry* self,
                            SidebarTree* tree);
static SidebarTreeEntryWrapper* sidebar_tree_reparent_wrapper (SidebarTree* self,
                                                        GtkTreeIter* new_iter,
                                                        SidebarTreeEntryWrapper* current_wrapper);
static void sidebar_tree_disassociate_branch (SidebarTree* self,
                                       SidebarBranch* branch);
static void sidebar_tree_disassociate_wrapper_and_signal (SidebarTree* self,
                                                   SidebarTreeEntryWrapper* wrapper,
                                                   gboolean only_children);
static void sidebar_tree_disassociate_wrapper (SidebarTree* self,
                                        SidebarTreeEntryWrapper* wrapper,
                                        gboolean only_children);
static void sidebar_tree_entry_wrapper_get_iter (SidebarTreeEntryWrapper* self,
                                          GtkTreeIter* result);
VALA_EXTERN void sidebar_entry_pruned (SidebarEntry* self,
                           SidebarTree* tree);
static GtkTreePath* sidebar_tree_get_current_path (SidebarTree* self);
static GdkPixbuf* sidebar_tree_fetch_icon_pixbuf (SidebarTree* self,
                                           GIcon* gicon);
static void sidebar_tree_load_branch_icons (SidebarTree* self,
                                     GtkTreeIter* iter);
static GtkTreePath* sidebar_tree_get_path_from_event (SidebarTree* self,
                                               GdkEventButton* event);
static gboolean sidebar_tree_popup_context_menu (SidebarTree* self,
                                          GtkTreePath* path,
                                          GdkEventButton* event);
static gboolean sidebar_tree_popup_default_context_menu (SidebarTree* self,
                                                  GdkEventButton* event);
static void ___lambda18_ (SidebarTree* self);
static void sidebar_tree_on_new_search (SidebarTree* self);
static void ____lambda18__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda98_ (SidebarTree* self);
static void sidebar_tree_on_new_tag (SidebarTree* self);
static void ____lambda98__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static gboolean sidebar_tree_real_button_press_event (GtkWidget* base,
                                               GdkEventButton* event);
static gboolean sidebar_tree_can_rename_path (SidebarTree* self,
                                       GtkTreePath* path);
static gboolean sidebar_tree_real_key_press_event (GtkWidget* base,
                                            GdkEventKey* event);
static gboolean sidebar_tree_rename_in_place (SidebarTree* self);
static gboolean sidebar_tree_destroy_path (SidebarTree* self,
                                    GtkTreePath* path);
static void sidebar_tree_real_drag_data_get (GtkWidget* base,
                                      GdkDragContext* context,
                                      GtkSelectionData* selection_data,
                                      guint info,
                                      guint time);
static void sidebar_tree_real_drag_data_received (GtkWidget* base,
                                           GdkDragContext* context,
                                           gint x,
                                           gint y,
                                           GtkSelectionData* selection_data,
                                           guint info,
                                           guint time);
static gboolean sidebar_tree_real_drag_motion (GtkWidget* base,
                                        GdkDragContext* context,
                                        gint x,
                                        gint y,
                                        guint time);
static void sidebar_tree_on_editing_done (SidebarTree* self);
static void _sidebar_tree_on_editing_done_gtk_cell_editable_editing_done (GtkCellEditable* _sender,
                                                                   gpointer self);
static gboolean sidebar_tree_on_editing_focus_out (SidebarTree* self,
                                            GdkEventFocus* event);
static gboolean _sidebar_tree_on_editing_focus_out_gtk_widget_focus_out_event (GtkWidget* _sender,
                                                                        GdkEventFocus* event,
                                                                        gpointer self);
static void g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
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 void sidebar_tree_entry_wrapper_finalize (GObject * obj);
static GType sidebar_tree_entry_wrapper_get_type_once (void);
static void sidebar_tree_root_wrapper_finalize (GObject * obj);
static GType sidebar_tree_root_wrapper_get_type_once (void);
static void sidebar_tree_finalize (GObject * obj);
static GType sidebar_tree_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
sidebar_tree_get_instance_private (SidebarTree* self)
{
	return G_STRUCT_MEMBER_P (self, SidebarTree_private_offset);
}

static void
_sidebar_tree_on_editing_canceled_gtk_cell_renderer_editing_canceled (GtkCellRenderer* _sender,
                                                                      gpointer self)
{
	sidebar_tree_on_editing_canceled ((SidebarTree*) self);
}

static void
_sidebar_tree_on_editing_started_gtk_cell_renderer_editing_started (GtkCellRenderer* _sender,
                                                                    GtkCellEditable* editable,
                                                                    const gchar* path,
                                                                    gpointer self)
{
	sidebar_tree_on_editing_started ((SidebarTree*) self, editable, path);
}

static void
_sidebar_tree_on_theme_change_gtk_icon_theme_changed (GtkIconTheme* _sender,
                                                      gpointer self)
{
	sidebar_tree_on_theme_change ((SidebarTree*) self);
}

static GType
sidebar_tree_columns_get_type_once (void)
{
	static const GEnumValue values[] = {{SIDEBAR_TREE_COLUMNS_NAME, "SIDEBAR_TREE_COLUMNS_NAME", "name"}, {SIDEBAR_TREE_COLUMNS_TOOLTIP, "SIDEBAR_TREE_COLUMNS_TOOLTIP", "tooltip"}, {SIDEBAR_TREE_COLUMNS_WRAPPER, "SIDEBAR_TREE_COLUMNS_WRAPPER", "wrapper"}, {SIDEBAR_TREE_COLUMNS_ICON, "SIDEBAR_TREE_COLUMNS_ICON", "icon"}, {SIDEBAR_TREE_COLUMNS_CLOSED_PIXBUF, "SIDEBAR_TREE_COLUMNS_CLOSED_PIXBUF", "closed-pixbuf"}, {SIDEBAR_TREE_COLUMNS_OPEN_PIXBUF, "SIDEBAR_TREE_COLUMNS_OPEN_PIXBUF", "open-pixbuf"}, {SIDEBAR_TREE_COLUMNS_PIXBUF_VISIBLE, "SIDEBAR_TREE_COLUMNS_PIXBUF_VISIBLE", "pixbuf-visible"}, {SIDEBAR_TREE_COLUMNS_N_COLUMNS, "SIDEBAR_TREE_COLUMNS_N_COLUMNS", "n-columns"}, {0, NULL, NULL}};
	GType sidebar_tree_columns_type_id;
	sidebar_tree_columns_type_id = g_enum_register_static ("SidebarTreeColumns", values);
	return sidebar_tree_columns_type_id;
}

static GType
sidebar_tree_columns_get_type (void)
{
	static volatile gsize sidebar_tree_columns_type_id__once = 0;
	if (g_once_init_enter (&sidebar_tree_columns_type_id__once)) {
		GType sidebar_tree_columns_type_id;
		sidebar_tree_columns_type_id = sidebar_tree_columns_get_type_once ();
		g_once_init_leave (&sidebar_tree_columns_type_id__once, sidebar_tree_columns_type_id);
	}
	return sidebar_tree_columns_type_id__once;
}

static void
_vala_GtkTreeRowReference_free (GtkTreeRowReference* self)
{
	g_boxed_free (gtk_tree_row_reference_get_type (), self);
}

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

static gboolean
_sidebar_tree_on_selection_gtk_tree_selection_func (GtkTreeSelection* selection,
                                                    GtkTreeModel* model,
                                                    GtkTreePath* path,
                                                    gboolean path_currently_selected,
                                                    gpointer self)
{
	gboolean result;
	result = sidebar_tree_on_selection ((SidebarTree*) self, selection, model, path, path_currently_selected);
	return result;
}

static void
_vala_array_add100 (GtkTargetEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkTargetEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkTargetEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static gboolean
_sidebar_tree_on_context_menu_keypress_gtk_widget_popup_menu (GtkWidget* _sender,
                                                              gpointer self)
{
	gboolean result;
	result = sidebar_tree_on_context_menu_keypress ((SidebarTree*) self);
	return result;
}

static void
_sidebar_tree_on_drag_begin_gtk_widget_drag_begin (GtkWidget* _sender,
                                                   GdkDragContext* context,
                                                   gpointer self)
{
	sidebar_tree_on_drag_begin ((SidebarTree*) self, context);
}

static void
_sidebar_tree_on_drag_end_gtk_widget_drag_end (GtkWidget* _sender,
                                               GdkDragContext* context,
                                               gpointer self)
{
	sidebar_tree_on_drag_end ((SidebarTree*) self, context);
}

static gboolean
_sidebar_tree_on_drag_motion_gtk_widget_drag_motion (GtkWidget* _sender,
                                                     GdkDragContext* context,
                                                     gint x,
                                                     gint y,
                                                     guint time_,
                                                     gpointer self)
{
	gboolean result;
	result = sidebar_tree_on_drag_motion ((SidebarTree*) self, context, x, y, time_);
	return result;
}

SidebarTree*
sidebar_tree_construct (GType object_type,
                        GtkTargetEntry* target_entries,
                        gint target_entries_length1,
                        GdkDragAction actions,
                        SidebarTreeExternalDropHandler drop_handler,
                        gpointer drop_handler_target)
{
	SidebarTree * self = NULL;
	GtkTreeStore* _tmp0_;
	GtkTreeViewColumn* text_column = NULL;
	GtkTreeViewColumn* _tmp1_;
	GtkCellRendererPixbuf* icon_renderer = NULL;
	GtkCellRendererPixbuf* _tmp2_;
	GtkCellRendererText* _tmp3_;
	GtkCellRendererText* _tmp4_;
	GtkCellRendererText* _tmp5_;
	GtkCellRendererText* _tmp6_;
	GtkCellRendererText* _tmp7_;
	GtkCellRendererText* _tmp8_;
	GtkCellRendererText* invisitext = NULL;
	GtkCellRendererText* _tmp9_;
	GtkTreeViewColumn* page_holder = NULL;
	GtkTreeViewColumn* _tmp10_;
	GtkTreeSelection* selection = NULL;
	GtkTreeSelection* _tmp11_;
	GtkTreeSelection* _tmp12_;
	GtkTargetEntry* source_entries = NULL;
	GtkTargetEntry* _tmp13_;
	gint source_entries_length1;
	gint _source_entries_size_;
	GtkTargetEntry _tmp14_;
	GtkTargetEntry* _tmp15_;
	gint _tmp15__length1;
	GtkIconTheme* _tmp16_;
	GtkIconTheme* _tmp17_;
	GtkIconTheme* _tmp18_;
	GtkStyleContext* _tmp19_;
	self = (SidebarTree*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->store;
	gtk_tree_view_set_model ((GtkTreeView*) self, (GtkTreeModel*) _tmp0_);
	_tmp1_ = gtk_tree_view_column_new ();
	g_object_ref_sink (_tmp1_);
	text_column = _tmp1_;
	gtk_tree_view_column_set_sizing (text_column, GTK_TREE_VIEW_COLUMN_FIXED);
	_tmp2_ = (GtkCellRendererPixbuf*) gtk_cell_renderer_pixbuf_new ();
	g_object_ref_sink (_tmp2_);
	icon_renderer = _tmp2_;
	gtk_cell_layout_pack_start ((GtkCellLayout*) text_column, (GtkCellRenderer*) icon_renderer, FALSE);
	gtk_cell_layout_add_attribute ((GtkCellLayout*) text_column, (GtkCellRenderer*) icon_renderer, "gicon", (gint) SIDEBAR_TREE_COLUMNS_ICON);
	gtk_cell_layout_add_attribute ((GtkCellLayout*) text_column, (GtkCellRenderer*) icon_renderer, "pixbuf_expander_closed", (gint) SIDEBAR_TREE_COLUMNS_CLOSED_PIXBUF);
	gtk_cell_layout_add_attribute ((GtkCellLayout*) text_column, (GtkCellRenderer*) icon_renderer, "pixbuf_expander_open", (gint) SIDEBAR_TREE_COLUMNS_OPEN_PIXBUF);
	gtk_cell_layout_add_attribute ((GtkCellLayout*) text_column, (GtkCellRenderer*) icon_renderer, "visible", (gint) SIDEBAR_TREE_COLUMNS_PIXBUF_VISIBLE);
	_tmp3_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->text_renderer);
	self->priv->text_renderer = _tmp3_;
	_tmp4_ = self->priv->text_renderer;
	g_signal_connect_object ((GtkCellRenderer*) _tmp4_, "editing-canceled", (GCallback) _sidebar_tree_on_editing_canceled_gtk_cell_renderer_editing_canceled, self, 0);
	_tmp5_ = self->priv->text_renderer;
	g_signal_connect_object ((GtkCellRenderer*) _tmp5_, "editing-started", (GCallback) _sidebar_tree_on_editing_started_gtk_cell_renderer_editing_started, self, 0);
	_tmp6_ = self->priv->text_renderer;
	g_object_set (_tmp6_, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
	_tmp7_ = self->priv->text_renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) text_column, (GtkCellRenderer*) _tmp7_, TRUE);
	_tmp8_ = self->priv->text_renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) text_column, (GtkCellRenderer*) _tmp8_, "markup", (gint) SIDEBAR_TREE_COLUMNS_NAME);
	gtk_tree_view_append_column ((GtkTreeView*) self, text_column);
	_tmp9_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp9_);
	invisitext = _tmp9_;
	_tmp10_ = gtk_tree_view_column_new ();
	g_object_ref_sink (_tmp10_);
	page_holder = _tmp10_;
	gtk_cell_layout_pack_start ((GtkCellLayout*) page_holder, (GtkCellRenderer*) invisitext, TRUE);
	gtk_tree_view_column_set_visible (page_holder, FALSE);
	gtk_tree_view_append_column ((GtkTreeView*) self, page_holder);
	gtk_tree_view_set_headers_visible ((GtkTreeView*) self, FALSE);
	gtk_tree_view_set_enable_search ((GtkTreeView*) self, FALSE);
	gtk_tree_view_set_show_expanders ((GtkTreeView*) self, TRUE);
	gtk_tree_view_set_reorderable ((GtkTreeView*) self, FALSE);
	gtk_tree_view_set_enable_tree_lines ((GtkTreeView*) self, FALSE);
	gtk_tree_view_set_grid_lines ((GtkTreeView*) self, GTK_TREE_VIEW_GRID_LINES_NONE);
	gtk_tree_view_set_tooltip_column ((GtkTreeView*) self, (gint) SIDEBAR_TREE_COLUMNS_TOOLTIP);
	_tmp11_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	_tmp12_ = _g_object_ref0 (_tmp11_);
	selection = _tmp12_;
	gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
	gtk_tree_selection_set_select_function (selection, _sidebar_tree_on_selection_gtk_tree_selection_func, g_object_ref (self), g_object_unref);
	gtk_tree_view_enable_model_drag_dest ((GtkTreeView*) self, target_entries, (gint) target_entries_length1, actions);
	_tmp13_ = g_new0 (GtkTargetEntry, 0);
	source_entries = _tmp13_;
	source_entries_length1 = 0;
	_source_entries_size_ = source_entries_length1;
	_tmp14_ = target_entries[LIBRARY_WINDOW_TARGET_TYPE_TAG_PATH];
	_vala_array_add100 (&source_entries, &source_entries_length1, &_source_entries_size_, &_tmp14_);
	_tmp15_ = source_entries;
	_tmp15__length1 = source_entries_length1;
	gtk_tree_view_enable_model_drag_source ((GtkTreeView*) self, GDK_BUTTON1_MASK, _tmp15_, (gint) _tmp15__length1, GDK_ACTION_COPY);
	self->priv->drop_handler = drop_handler;
	self->priv->drop_handler_target = drop_handler_target;
	g_signal_connect_object ((GtkWidget*) self, "popup-menu", (GCallback) _sidebar_tree_on_context_menu_keypress_gtk_widget_popup_menu, self, 0);
	_tmp16_ = gtk_icon_theme_get_default ();
	_tmp17_ = _g_object_ref0 (_tmp16_);
	_g_object_unref0 (self->priv->icon_theme);
	self->priv->icon_theme = _tmp17_;
	_tmp18_ = self->priv->icon_theme;
	g_signal_connect_object (_tmp18_, "changed", (GCallback) _sidebar_tree_on_theme_change_gtk_icon_theme_changed, self, 0);
	_tmp19_ = gtk_widget_get_style_context ((GtkWidget*) self);
	gtk_style_context_add_class (_tmp19_, GRANITE_STYLE_CLASS_SOURCE_LIST);
	g_signal_connect_object ((GtkWidget*) self, "drag-begin", (GCallback) _sidebar_tree_on_drag_begin_gtk_widget_drag_begin, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "drag-end", (GCallback) _sidebar_tree_on_drag_end_gtk_widget_drag_end, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "drag-motion", (GCallback) _sidebar_tree_on_drag_motion_gtk_widget_drag_motion, self, 0);
	source_entries = (g_free (source_entries), NULL);
	_g_object_unref0 (selection);
	_g_object_unref0 (page_holder);
	_g_object_unref0 (invisitext);
	_g_object_unref0 (icon_renderer);
	_g_object_unref0 (text_column);
	return self;
}

SidebarTree*
sidebar_tree_new (GtkTargetEntry* target_entries,
                  gint target_entries_length1,
                  GdkDragAction actions,
                  SidebarTreeExternalDropHandler drop_handler,
                  gpointer drop_handler_target)
{
	return sidebar_tree_construct (SIDEBAR_TYPE_TREE, target_entries, target_entries_length1, actions, drop_handler, drop_handler_target);
}

static void
sidebar_tree_on_drag_begin (SidebarTree* self,
                            GdkDragContext* ctx)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (ctx != NULL);
	self->priv->is_internal_drag_in_progress = TRUE;
}

static void
sidebar_tree_on_drag_end (SidebarTree* self,
                          GdkDragContext* ctx)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (ctx != NULL);
	self->priv->is_internal_drag_in_progress = FALSE;
	_g_object_unref0 (self->priv->internal_drag_source_entry);
	self->priv->internal_drag_source_entry = NULL;
}

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

static gboolean
sidebar_tree_on_drag_motion (SidebarTree* self,
                             GdkDragContext* context,
                             gint x,
                             gint y,
                             guint time_)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (context != NULL, FALSE);
	if (self->priv->is_internal_drag_in_progress) {
		SidebarEntry* _tmp1_;
		_tmp1_ = self->priv->internal_drag_source_entry;
		_tmp0_ = _tmp1_ == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkTreePath* path = NULL;
		GtkTreeViewDropPosition position = 0;
		GtkTreePath* _tmp2_ = NULL;
		GtkTreeViewDropPosition _tmp3_ = 0;
		GtkTreePath* _tmp4_;
		gtk_tree_view_get_dest_row_at_pos ((GtkTreeView*) self, x, y, &_tmp2_, &_tmp3_);
		__vala_GtkTreePath_free0 (path);
		path = _tmp2_;
		position = _tmp3_;
		_tmp4_ = path;
		if (_tmp4_ != NULL) {
			SidebarTreeEntryWrapper* wrapper = NULL;
			GtkTreePath* _tmp5_;
			SidebarTreeEntryWrapper* _tmp6_;
			SidebarTreeEntryWrapper* _tmp7_;
			_tmp5_ = path;
			_tmp6_ = sidebar_tree_get_wrapper_at_path (self, _tmp5_);
			wrapper = _tmp6_;
			_tmp7_ = wrapper;
			if (_tmp7_ != NULL) {
				SidebarTreeEntryWrapper* _tmp8_;
				SidebarEntry* _tmp9_;
				SidebarEntry* _tmp10_;
				_tmp8_ = wrapper;
				_tmp9_ = _tmp8_->entry;
				_tmp10_ = _g_object_ref0 (_tmp9_);
				_g_object_unref0 (self->priv->internal_drag_source_entry);
				self->priv->internal_drag_source_entry = _tmp10_;
			}
			_g_object_unref0 (wrapper);
		}
		__vala_GtkTreePath_free0 (path);
	}
	result = FALSE;
	return result;
}

static gboolean
sidebar_tree_has_wrapper (SidebarTree* self,
                          SidebarEntry* entry)
{
	GeeHashMap* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	_tmp0_ = self->priv->entry_map;
	result = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, entry);
	return result;
}

static SidebarTreeEntryWrapper*
sidebar_tree_get_wrapper (SidebarTree* self,
                          SidebarEntry* entry)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	SidebarTreeEntryWrapper* _tmp2_;
	SidebarTreeEntryWrapper* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = self->priv->entry_map;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, entry);
	wrapper = (SidebarTreeEntryWrapper*) _tmp1_;
	_tmp2_ = wrapper;
	if (_tmp2_ == NULL) {
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = sidebar_entry_to_string (entry);
		_tmp4_ = _tmp3_;
		g_warning ("Tree.vala:211: Entry %s not found in sidebar", _tmp4_);
		_g_free0 (_tmp4_);
	}
	result = wrapper;
	return result;
}

static SidebarTreeEntryWrapper*
sidebar_tree_get_wrapper_at_iter (SidebarTree* self,
                                  GtkTreeIter* iter)
{
	GValue val = {0};
	GtkTreeStore* _tmp0_;
	GtkTreeIter _tmp1_;
	GValue _tmp2_ = {0};
	SidebarTreeEntryWrapper* wrapper = NULL;
	GValue _tmp3_;
	SidebarTreeEntryWrapper* _tmp4_;
	SidebarTreeEntryWrapper* _tmp5_;
	SidebarTreeEntryWrapper* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (iter != NULL, NULL);
	_tmp0_ = self->priv->store;
	_tmp1_ = *iter;
	gtk_tree_model_get_value ((GtkTreeModel*) _tmp0_, &_tmp1_, (gint) SIDEBAR_TREE_COLUMNS_WRAPPER, &_tmp2_);
	G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
	val = _tmp2_;
	_tmp3_ = val;
	_tmp4_ = _g_object_ref0 (g_value_get_object (&_tmp3_));
	wrapper = _tmp4_;
	_tmp5_ = wrapper;
	if (_tmp5_ == NULL) {
		GtkTreeStore* _tmp6_;
		GtkTreeIter _tmp7_;
		GtkTreePath* _tmp8_;
		GtkTreePath* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp6_ = self->priv->store;
		_tmp7_ = *iter;
		_tmp8_ = gtk_tree_model_get_path ((GtkTreeModel*) _tmp6_, &_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = gtk_tree_path_to_string (_tmp9_);
		_tmp11_ = _tmp10_;
		g_message ("Tree.vala:222: No entry found in sidebar at %s", _tmp11_);
		_g_free0 (_tmp11_);
		__vala_GtkTreePath_free0 (_tmp9_);
	}
	result = wrapper;
	G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
	return result;
}

static SidebarTreeEntryWrapper*
sidebar_tree_get_wrapper_at_path (SidebarTree* self,
                                  GtkTreePath* path)
{
	GtkTreeIter iter = {0};
	GtkTreeStore* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_;
	GtkTreeIter _tmp5_;
	SidebarTreeEntryWrapper* _tmp6_;
	SidebarTreeEntryWrapper* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = self->priv->store;
	_tmp2_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp0_, &_tmp1_, path);
	iter = _tmp1_;
	if (!_tmp2_) {
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = gtk_tree_path_to_string (path);
		_tmp4_ = _tmp3_;
		g_message ("Tree.vala:230: No entry found in sidebar at %s", _tmp4_);
		_g_free0 (_tmp4_);
		result = NULL;
		return result;
	}
	_tmp5_ = iter;
	_tmp6_ = sidebar_tree_get_wrapper_at_iter (self, &_tmp5_);
	result = _tmp6_;
	return result;
}

gboolean
sidebar_tree_place_cursor (SidebarTree* self,
                           SidebarEntry* entry,
                           gboolean mask_signal)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	GtkTreeSelection* _tmp2_;
	SidebarTreeEntryWrapper* _tmp3_;
	GtkTreePath* _tmp4_;
	GtkTreePath* _tmp5_;
	SidebarTreeEntryWrapper* _tmp6_;
	GtkTreePath* _tmp7_;
	GtkTreePath* _tmp8_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	if (!sidebar_tree_expand_to_entry (self, entry)) {
		result = FALSE;
		return result;
	}
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_tmp1_ = wrapper;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp2_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	_tmp3_ = wrapper;
	_tmp4_ = sidebar_tree_entry_wrapper_get_path (_tmp3_);
	_tmp5_ = _tmp4_;
	gtk_tree_selection_select_path (_tmp2_, _tmp5_);
	__vala_GtkTreePath_free0 (_tmp5_);
	self->priv->mask_entry_selected_signal = mask_signal;
	_tmp6_ = wrapper;
	_tmp7_ = sidebar_tree_entry_wrapper_get_path (_tmp6_);
	_tmp8_ = _tmp7_;
	gtk_tree_view_set_cursor ((GtkTreeView*) self, _tmp8_, NULL, FALSE);
	__vala_GtkTreePath_free0 (_tmp8_);
	self->priv->mask_entry_selected_signal = FALSE;
	result = sidebar_tree_scroll_to_entry (self, entry);
	_g_object_unref0 (wrapper);
	return result;
}

gboolean
sidebar_tree_is_selected (SidebarTree* self,
                          SidebarEntry* entry)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	gboolean _tmp1_ = FALSE;
	SidebarTreeEntryWrapper* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_tmp2_ = wrapper;
	if (_tmp2_ != NULL) {
		GtkTreeSelection* _tmp3_;
		SidebarTreeEntryWrapper* _tmp4_;
		GtkTreePath* _tmp5_;
		GtkTreePath* _tmp6_;
		_tmp3_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
		_tmp4_ = wrapper;
		_tmp5_ = sidebar_tree_entry_wrapper_get_path (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp1_ = gtk_tree_selection_path_is_selected (_tmp3_, _tmp6_);
		__vala_GtkTreePath_free0 (_tmp6_);
	} else {
		_tmp1_ = FALSE;
	}
	result = _tmp1_;
	_g_object_unref0 (wrapper);
	return result;
}

gboolean
sidebar_tree_is_any_selected (SidebarTree* self)
{
	GtkTreeSelection* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	result = gtk_tree_selection_count_selected_rows (_tmp0_) != 0;
	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_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_);
}

static GtkTreePath*
sidebar_tree_get_selected_path (SidebarTree* self)
{
	GtkTreeModel* model = NULL;
	GList* rows = NULL;
	GtkTreeSelection* _tmp0_;
	GtkTreeModel* _tmp1_ = NULL;
	GList* _tmp2_;
	GtkTreeModel* _tmp3_;
	gboolean _tmp4_ = FALSE;
	GList* _tmp5_;
	GtkTreePath* _tmp7_ = NULL;
	GList* _tmp8_;
	GtkTreePath* _tmp11_;
	GtkTreePath* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	_tmp2_ = gtk_tree_selection_get_selected_rows (_tmp0_, &_tmp1_);
	_g_object_unref0 (model);
	_tmp3_ = _g_object_ref0 (_tmp1_);
	model = _tmp3_;
	rows = _tmp2_;
	_tmp5_ = rows;
	if (g_list_length (_tmp5_) == ((guint) 0)) {
		_tmp4_ = TRUE;
	} else {
		GList* _tmp6_;
		_tmp6_ = rows;
		_tmp4_ = g_list_length (_tmp6_) == ((guint) 1);
	}
	_vala_assert (_tmp4_, "rows.length () == 0 || rows.length () == 1");
	_tmp8_ = rows;
	if (g_list_length (_tmp8_) != ((guint) 0)) {
		GList* _tmp9_;
		gconstpointer _tmp10_;
		_tmp9_ = rows;
		_tmp10_ = g_list_nth_data (_tmp9_, (guint) 0);
		_tmp7_ = (GtkTreePath*) _tmp10_;
	} else {
		_tmp7_ = NULL;
	}
	_tmp11_ = __vala_GtkTreePath_copy0 (_tmp7_);
	result = _tmp11_;
	(rows == NULL) ? NULL : (rows = (_g_list_free___vala_GtkTreePath_free0_ (rows), NULL));
	_g_object_unref0 (model);
	return result;
}

static void
sidebar_tree_real_cursor_changed (GtkTreeView* base)
{
	SidebarTree * self;
	GtkTreePath* path = NULL;
	GtkTreePath* _tmp0_;
	GtkTreePath* _tmp1_;
	SidebarTreeEntryWrapper* wrapper = NULL;
	GtkTreePath* _tmp2_;
	SidebarTreeEntryWrapper* _tmp3_;
	SidebarTreeEntryWrapper* _tmp4_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp10_ = FALSE;
	SidebarTreeEntryWrapper* _tmp11_;
	self = (SidebarTree*) base;
	_tmp0_ = sidebar_tree_get_selected_path (self);
	path = _tmp0_;
	_tmp1_ = path;
	if (_tmp1_ == NULL) {
		if (GTK_TREE_VIEW_CLASS (sidebar_tree_parent_class)->cursor_changed != NULL) {
			GTK_TREE_VIEW_CLASS (sidebar_tree_parent_class)->cursor_changed (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView));
		}
		__vala_GtkTreePath_free0 (path);
		return;
	}
	_tmp2_ = path;
	_tmp3_ = sidebar_tree_get_wrapper_at_path (self, _tmp2_);
	wrapper = _tmp3_;
	_tmp4_ = wrapper;
	self->priv->selected_wrapper = _tmp4_;
	if (self->priv->editing_disabled == 0) {
		SidebarTreeEntryWrapper* _tmp6_;
		_tmp6_ = wrapper;
		_tmp5_ = _tmp6_ != NULL;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		GtkCellRendererText* _tmp7_;
		SidebarTreeEntryWrapper* _tmp8_;
		SidebarEntry* _tmp9_;
		_tmp7_ = self->priv->text_renderer;
		_tmp8_ = wrapper;
		_tmp9_ = _tmp8_->entry;
		g_object_set (_tmp7_, "editable", SIDEBAR_IS_RENAMEABLE_ENTRY (_tmp9_), NULL);
	}
	_tmp11_ = wrapper;
	if (_tmp11_ != NULL) {
		_tmp10_ = !self->priv->mask_entry_selected_signal;
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		SidebarSelectableEntry* selectable = NULL;
		SidebarTreeEntryWrapper* _tmp12_;
		SidebarEntry* _tmp13_;
		SidebarSelectableEntry* _tmp14_;
		SidebarSelectableEntry* _tmp15_;
		_tmp12_ = wrapper;
		_tmp13_ = _tmp12_->entry;
		_tmp14_ = _g_object_ref0 (SIDEBAR_IS_SELECTABLE_ENTRY (_tmp13_) ? ((SidebarSelectableEntry*) _tmp13_) : NULL);
		selectable = _tmp14_;
		_tmp15_ = selectable;
		if (_tmp15_ != NULL) {
			SidebarSelectableEntry* _tmp16_;
			_tmp16_ = selectable;
			g_signal_emit (self, sidebar_tree_signals[SIDEBAR_TREE_ENTRY_SELECTED_SIGNAL], 0, _tmp16_);
		}
		_g_object_unref0 (selectable);
	}
	if (GTK_TREE_VIEW_CLASS (sidebar_tree_parent_class)->cursor_changed != NULL) {
		GTK_TREE_VIEW_CLASS (sidebar_tree_parent_class)->cursor_changed (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView));
	}
	_g_object_unref0 (wrapper);
	__vala_GtkTreePath_free0 (path);
}

void
sidebar_tree_disable_editing (SidebarTree* self)
{
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->editing_disabled;
	self->priv->editing_disabled = _tmp0_ + 1;
	if (_tmp0_ == 0) {
		GtkCellRendererText* _tmp1_;
		_tmp1_ = self->priv->text_renderer;
		g_object_set (_tmp1_, "editable", FALSE, NULL);
	}
}

void
sidebar_tree_enable_editing (SidebarTree* self)
{
	GtkTreePath* path = NULL;
	GtkTreePath* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GtkTreePath* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = sidebar_tree_get_selected_path (self);
	path = _tmp0_;
	_tmp3_ = path;
	if (_tmp3_ != NULL) {
		_tmp2_ = self->priv->editing_disabled > 0;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		gint _tmp4_;
		self->priv->editing_disabled = self->priv->editing_disabled - 1;
		_tmp4_ = self->priv->editing_disabled;
		_tmp1_ = _tmp4_ == 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		SidebarTreeEntryWrapper* wrapper = NULL;
		GtkTreePath* _tmp5_;
		SidebarTreeEntryWrapper* _tmp6_;
		gboolean _tmp7_ = FALSE;
		SidebarTreeEntryWrapper* _tmp8_;
		GtkCellRendererText* _tmp11_;
		_tmp5_ = path;
		_tmp6_ = sidebar_tree_get_wrapper_at_path (self, _tmp5_);
		wrapper = _tmp6_;
		_tmp8_ = wrapper;
		if (_tmp8_ != NULL) {
			SidebarTreeEntryWrapper* _tmp9_;
			SidebarEntry* _tmp10_;
			_tmp9_ = wrapper;
			_tmp10_ = _tmp9_->entry;
			_tmp7_ = SIDEBAR_IS_RENAMEABLE_ENTRY (_tmp10_);
		} else {
			_tmp7_ = FALSE;
		}
		_tmp11_ = self->priv->text_renderer;
		g_object_set (_tmp11_, "editable", _tmp7_, NULL);
		_g_object_unref0 (wrapper);
	}
	__vala_GtkTreePath_free0 (path);
}

void
sidebar_tree_toggle_branch_expansion (SidebarTree* self,
                                      GtkTreePath* path,
                                      gboolean expand_all)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	if (gtk_tree_view_row_expanded ((GtkTreeView*) self, path)) {
		gtk_tree_view_collapse_row ((GtkTreeView*) self, path);
	} else {
		gtk_tree_view_expand_row ((GtkTreeView*) self, path, expand_all);
	}
}

gboolean
sidebar_tree_expand_to_entry (SidebarTree* self,
                              SidebarEntry* entry)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	SidebarTreeEntryWrapper* _tmp2_;
	GtkTreePath* _tmp3_;
	GtkTreePath* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_tmp1_ = wrapper;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp2_ = wrapper;
	_tmp3_ = sidebar_tree_entry_wrapper_get_path (_tmp2_);
	_tmp4_ = _tmp3_;
	gtk_tree_view_expand_to_path ((GtkTreeView*) self, _tmp4_);
	__vala_GtkTreePath_free0 (_tmp4_);
	result = TRUE;
	_g_object_unref0 (wrapper);
	return result;
}

void
sidebar_tree_expand_to_first_child (SidebarTree* self,
                                    SidebarEntry* entry)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	GtkTreePath* path = NULL;
	SidebarTreeEntryWrapper* _tmp2_;
	GtkTreePath* _tmp3_;
	GtkTreeIter iter = {0};
	GtkTreePath* _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_tmp1_ = wrapper;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (wrapper);
		return;
	}
	_tmp2_ = wrapper;
	_tmp3_ = sidebar_tree_entry_wrapper_get_path (_tmp2_);
	path = _tmp3_;
	while (TRUE) {
		GtkTreeStore* _tmp4_;
		GtkTreePath* _tmp5_;
		GtkTreeIter _tmp6_ = {0};
		gboolean _tmp7_;
		GtkTreeStore* _tmp8_;
		GtkTreeIter _tmp9_;
		GtkTreePath* _tmp10_;
		_tmp4_ = self->priv->store;
		_tmp5_ = path;
		_tmp7_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp4_, &_tmp6_, _tmp5_);
		iter = _tmp6_;
		if (!_tmp7_) {
			break;
		}
		_tmp8_ = self->priv->store;
		_tmp9_ = iter;
		if (!gtk_tree_model_iter_has_child ((GtkTreeModel*) _tmp8_, &_tmp9_)) {
			break;
		}
		_tmp10_ = path;
		gtk_tree_path_down (_tmp10_);
	}
	_tmp11_ = path;
	gtk_tree_view_expand_to_path ((GtkTreeView*) self, _tmp11_);
	__vala_GtkTreePath_free0 (path);
	_g_object_unref0 (wrapper);
}

static void
_sidebar_tree_on_branch_entry_added_sidebar_branch_entry_added (SidebarBranch* _sender,
                                                                SidebarEntry* entry,
                                                                gpointer self)
{
	sidebar_tree_on_branch_entry_added ((SidebarTree*) self, _sender, entry);
}

static void
_sidebar_tree_on_branch_entry_removed_sidebar_branch_entry_removed (SidebarBranch* _sender,
                                                                    SidebarEntry* entry,
                                                                    gpointer self)
{
	sidebar_tree_on_branch_entry_removed ((SidebarTree*) self, _sender, entry);
}

static void
_sidebar_tree_on_branch_entry_moved_sidebar_branch_entry_moved (SidebarBranch* _sender,
                                                                SidebarEntry* entry,
                                                                gpointer self)
{
	sidebar_tree_on_branch_entry_moved ((SidebarTree*) self, _sender, entry);
}

static void
_sidebar_tree_on_branch_entry_reparented_sidebar_branch_entry_reparented (SidebarBranch* _sender,
                                                                          SidebarEntry* entry,
                                                                          SidebarEntry* old_parent,
                                                                          gpointer self)
{
	sidebar_tree_on_branch_entry_reparented ((SidebarTree*) self, _sender, entry, old_parent);
}

static void
_sidebar_tree_on_branch_children_reordered_sidebar_branch_children_reordered (SidebarBranch* _sender,
                                                                              SidebarEntry* entry,
                                                                              gpointer self)
{
	sidebar_tree_on_branch_children_reordered ((SidebarTree*) self, _sender, entry);
}

static void
_sidebar_tree_on_show_branch_sidebar_branch_show_branch (SidebarBranch* _sender,
                                                         gboolean show,
                                                         gpointer self)
{
	sidebar_tree_on_show_branch ((SidebarTree*) self, _sender, show);
}

void
sidebar_tree_graft (SidebarTree* self,
                    SidebarBranch* branch,
                    gint position)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	_vala_return_if_fail (position >= 0, "position >= 0");
	_tmp0_ = self->priv->branches;
	_vala_assert (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, branch), "!branches.has_key (branch)");
	_tmp1_ = self->priv->branches;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp1_, branch, (gpointer) ((gintptr) position));
	if (sidebar_branch_get_show_branch (branch)) {
		sidebar_tree_associate_branch (self, branch);
		if (sidebar_branch_is_startup_expand_to_first_child (branch)) {
			SidebarEntry* _tmp2_;
			SidebarEntry* _tmp3_;
			_tmp2_ = sidebar_branch_get_root (branch);
			_tmp3_ = _tmp2_;
			sidebar_tree_expand_to_first_child (self, _tmp3_);
			_g_object_unref0 (_tmp3_);
		}
		if (sidebar_branch_is_startup_open_grouping (branch)) {
			SidebarEntry* _tmp4_;
			SidebarEntry* _tmp5_;
			_tmp4_ = sidebar_branch_get_root (branch);
			_tmp5_ = _tmp4_;
			sidebar_tree_expand_to_entry (self, _tmp5_);
			_g_object_unref0 (_tmp5_);
		}
	}
	g_signal_connect_object (branch, "entry-added", (GCallback) _sidebar_tree_on_branch_entry_added_sidebar_branch_entry_added, self, 0);
	g_signal_connect_object (branch, "entry-removed", (GCallback) _sidebar_tree_on_branch_entry_removed_sidebar_branch_entry_removed, self, 0);
	g_signal_connect_object (branch, "entry-moved", (GCallback) _sidebar_tree_on_branch_entry_moved_sidebar_branch_entry_moved, self, 0);
	g_signal_connect_object (branch, "entry-reparented", (GCallback) _sidebar_tree_on_branch_entry_reparented_sidebar_branch_entry_reparented, self, 0);
	g_signal_connect_object (branch, "children-reordered", (GCallback) _sidebar_tree_on_branch_children_reordered_sidebar_branch_children_reordered, self, 0);
	g_signal_connect_object (branch, "show-branch", (GCallback) _sidebar_tree_on_show_branch_sidebar_branch_show_branch, self, 0);
	g_signal_emit (self, sidebar_tree_signals[SIDEBAR_TREE_BRANCH_ADDED_SIGNAL], 0, branch);
}

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

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;
}

static void
sidebar_tree_associate_branch (SidebarTree* self,
                               SidebarBranch* branch)
{
	GeeHashMap* _tmp0_;
	gint position = 0;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	GtkTreeIter* insertion_iter = NULL;
	GtkTreeIter iter = {0};
	gboolean found = FALSE;
	GtkTreeStore* _tmp3_;
	GtkTreeIter _tmp4_ = {0};
	gboolean _tmp5_;
	GtkTreeIter* _tmp18_;
	GtkTreeIter* _tmp23_;
	GtkTreeStore* _tmp24_;
	SidebarEntry* _tmp25_;
	SidebarEntry* _tmp26_;
	GtkTreeStore* _tmp27_;
	GtkTreeIter* _tmp28_;
	GtkTreeIter _tmp29_;
	GtkTreePath* _tmp30_;
	GtkTreePath* _tmp31_;
	SidebarTreeRootWrapper* _tmp32_;
	SidebarTreeRootWrapper* _tmp33_;
	GtkTreeIter _tmp34_;
	SidebarEntry* _tmp35_;
	SidebarEntry* _tmp36_;
	GtkTreeIter* _tmp37_;
	GtkTreeIter _tmp38_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	_tmp0_ = self->priv->branches;
	_vala_assert (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, branch), "branches.has_key (branch)");
	_tmp1_ = self->priv->branches;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, branch);
	position = (gint) ((gintptr) _tmp2_);
	insertion_iter = NULL;
	_tmp3_ = self->priv->store;
	_tmp5_ = gtk_tree_model_get_iter_first ((GtkTreeModel*) _tmp3_, &_tmp4_);
	iter = _tmp4_;
	found = _tmp5_;
	while (TRUE) {
		SidebarTreeRootWrapper* root_wrapper = NULL;
		GtkTreeIter _tmp6_;
		SidebarTreeEntryWrapper* _tmp7_;
		SidebarTreeRootWrapper* _tmp8_;
		SidebarTreeRootWrapper* _tmp9_;
		SidebarTreeRootWrapper* _tmp10_;
		GtkTreeStore* _tmp16_;
		gboolean _tmp17_;
		if (!found) {
			break;
		}
		_tmp6_ = iter;
		_tmp7_ = sidebar_tree_get_wrapper_at_iter (self, &_tmp6_);
		_tmp8_ = SIDEBAR_TREE_IS_ROOT_WRAPPER (_tmp7_) ? ((SidebarTreeRootWrapper*) _tmp7_) : NULL;
		if (_tmp8_ == NULL) {
			_g_object_unref0 (_tmp7_);
		}
		root_wrapper = _tmp8_;
		_tmp9_ = root_wrapper;
		_vala_assert (_tmp9_ != NULL, "root_wrapper != null");
		_tmp10_ = root_wrapper;
		if (position < _tmp10_->root_position) {
			GtkTreeStore* _tmp11_;
			GtkTreeIter _tmp12_;
			GtkTreeIter _tmp13_ = {0};
			GtkTreeIter _tmp14_;
			GtkTreeIter* _tmp15_;
			_tmp11_ = self->priv->store;
			_tmp12_ = iter;
			gtk_tree_store_insert_before (_tmp11_, &_tmp13_, NULL, &_tmp12_);
			__vala_GtkTreeIter_free0 (insertion_iter);
			_tmp14_ = _tmp13_;
			_tmp15_ = __vala_GtkTreeIter_copy0 (&_tmp14_);
			insertion_iter = _tmp15_;
			_g_object_unref0 (root_wrapper);
			break;
		}
		_tmp16_ = self->priv->store;
		_tmp17_ = gtk_tree_model_iter_next ((GtkTreeModel*) _tmp16_, &iter);
		found = _tmp17_;
		_g_object_unref0 (root_wrapper);
	}
	_tmp18_ = insertion_iter;
	if (_tmp18_ == NULL) {
		GtkTreeStore* _tmp19_;
		GtkTreeIter _tmp20_ = {0};
		GtkTreeIter _tmp21_;
		GtkTreeIter* _tmp22_;
		_tmp19_ = self->priv->store;
		gtk_tree_store_append (_tmp19_, &_tmp20_, NULL);
		__vala_GtkTreeIter_free0 (insertion_iter);
		_tmp21_ = _tmp20_;
		_tmp22_ = __vala_GtkTreeIter_copy0 (&_tmp21_);
		insertion_iter = _tmp22_;
	}
	_tmp23_ = insertion_iter;
	_tmp24_ = self->priv->store;
	_tmp25_ = sidebar_branch_get_root (branch);
	_tmp26_ = _tmp25_;
	_tmp27_ = self->priv->store;
	_tmp28_ = insertion_iter;
	_tmp29_ = *_tmp28_;
	_tmp30_ = gtk_tree_model_get_path ((GtkTreeModel*) _tmp27_, &_tmp29_);
	_tmp31_ = _tmp30_;
	_tmp32_ = sidebar_tree_root_wrapper_new ((GtkTreeModel*) _tmp24_, _tmp26_, _tmp31_, position);
	_tmp33_ = _tmp32_;
	_tmp34_ = *_tmp23_;
	sidebar_tree_associate_wrapper (self, &_tmp34_, (SidebarTreeEntryWrapper*) _tmp33_);
	_g_object_unref0 (_tmp33_);
	__vala_GtkTreePath_free0 (_tmp31_);
	_g_object_unref0 (_tmp26_);
	_tmp35_ = sidebar_branch_get_root (branch);
	_tmp36_ = _tmp35_;
	_tmp37_ = insertion_iter;
	_tmp38_ = *_tmp37_;
	sidebar_tree_associate_children (self, branch, _tmp36_, &_tmp38_);
	_g_object_unref0 (_tmp36_);
	__vala_GtkTreeIter_free0 (insertion_iter);
}

static void
sidebar_tree_associate_children (SidebarTree* self,
                                 SidebarBranch* branch,
                                 SidebarEntry* parent,
                                 GtkTreeIter* parent_iter)
{
	GeeList* children = NULL;
	GeeList* _tmp0_;
	GeeList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	g_return_if_fail (parent != NULL);
	g_return_if_fail (parent_iter != NULL);
	_tmp0_ = sidebar_branch_get_children (branch, parent);
	children = _tmp0_;
	_tmp1_ = children;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (children);
		return;
	}
	{
		GeeList* _child_list = NULL;
		GeeList* _tmp2_;
		gint _child_size = 0;
		GeeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _child_index = 0;
		_tmp2_ = children;
		_child_list = _tmp2_;
		_tmp3_ = _child_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_child_size = _tmp5_;
		_child_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			SidebarEntry* child = NULL;
			GeeList* _tmp8_;
			gpointer _tmp9_;
			GtkTreeIter append_iter = {0};
			GtkTreeStore* _tmp10_;
			GtkTreeIter _tmp11_;
			GtkTreeIter _tmp12_ = {0};
			GtkTreeIter _tmp13_;
			SidebarEntry* _tmp14_;
			SidebarEntry* _tmp15_;
			GtkTreeIter _tmp16_;
			_child_index = _child_index + 1;
			_tmp6_ = _child_index;
			_tmp7_ = _child_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _child_list;
			_tmp9_ = gee_list_get (_tmp8_, _child_index);
			child = (SidebarEntry*) _tmp9_;
			_tmp10_ = self->priv->store;
			_tmp11_ = *parent_iter;
			gtk_tree_store_append (_tmp10_, &_tmp12_, &_tmp11_);
			append_iter = _tmp12_;
			_tmp13_ = append_iter;
			_tmp14_ = child;
			sidebar_tree_associate_entry (self, &_tmp13_, _tmp14_);
			_tmp15_ = child;
			_tmp16_ = append_iter;
			sidebar_tree_associate_children (self, branch, _tmp15_, &_tmp16_);
			_g_object_unref0 (child);
		}
	}
	_g_object_unref0 (children);
}

static void
sidebar_tree_associate_entry (SidebarTree* self,
                              GtkTreeIter* assoc_iter,
                              SidebarEntry* entry)
{
	GtkTreeIter _tmp0_;
	GtkTreeStore* _tmp1_;
	GtkTreeStore* _tmp2_;
	GtkTreeIter _tmp3_;
	GtkTreePath* _tmp4_;
	GtkTreePath* _tmp5_;
	SidebarTreeEntryWrapper* _tmp6_;
	SidebarTreeEntryWrapper* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (assoc_iter != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = *assoc_iter;
	_tmp1_ = self->priv->store;
	_tmp2_ = self->priv->store;
	_tmp3_ = *assoc_iter;
	_tmp4_ = gtk_tree_model_get_path ((GtkTreeModel*) _tmp2_, &_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = sidebar_tree_entry_wrapper_new ((GtkTreeModel*) _tmp1_, entry, _tmp5_);
	_tmp7_ = _tmp6_;
	sidebar_tree_associate_wrapper (self, &_tmp0_, _tmp7_);
	_g_object_unref0 (_tmp7_);
	__vala_GtkTreePath_free0 (_tmp5_);
}

static void
_sidebar_tree_on_sidebar_tooltip_changed_sidebar_entry_sidebar_tooltip_changed (SidebarEntry* _sender,
                                                                                const gchar* tooltip,
                                                                                gpointer self)
{
	sidebar_tree_on_sidebar_tooltip_changed ((SidebarTree*) self, _sender, tooltip);
}

static void
_sidebar_tree_on_sidebar_icon_changed_sidebar_entry_sidebar_icon_changed (SidebarEntry* _sender,
                                                                          GIcon* icon,
                                                                          gpointer self)
{
	sidebar_tree_on_sidebar_icon_changed ((SidebarTree*) self, _sender, icon);
}

static void
_sidebar_tree_on_sidebar_page_created_sidebar_page_representative_page_created (SidebarPageRepresentative* _sender,
                                                                                Page* page,
                                                                                gpointer self)
{
	sidebar_tree_on_sidebar_page_created ((SidebarTree*) self, _sender, page);
}

static void
_sidebar_tree_on_sidebar_destroying_page_sidebar_page_representative_destroying_page (SidebarPageRepresentative* _sender,
                                                                                      Page* page,
                                                                                      gpointer self)
{
	sidebar_tree_on_sidebar_destroying_page ((SidebarTree*) self, _sender, page);
}

static void
_sidebar_tree_on_sidebar_name_changed_sidebar_renameable_entry_sidebar_name_changed (SidebarRenameableEntry* _sender,
                                                                                     const gchar* name,
                                                                                     gpointer self)
{
	sidebar_tree_on_sidebar_name_changed ((SidebarTree*) self, _sender, name);
}

static void
_sidebar_tree_on_sidebar_open_closed_icons_changed_sidebar_expandable_entry_sidebar_open_closed_icons_changed (SidebarExpandableEntry* _sender,
                                                                                                               GIcon* open,
                                                                                                               GIcon* closed,
                                                                                                               gpointer self)
{
	sidebar_tree_on_sidebar_open_closed_icons_changed ((SidebarTree*) self, _sender, open, closed);
}

static void
sidebar_tree_associate_wrapper (SidebarTree* self,
                                GtkTreeIter* assoc_iter,
                                SidebarTreeEntryWrapper* wrapper)
{
	SidebarEntry* entry = NULL;
	SidebarEntry* _tmp0_;
	SidebarEntry* _tmp1_;
	GeeHashMap* _tmp2_;
	SidebarEntry* _tmp3_;
	GeeHashMap* _tmp4_;
	SidebarEntry* _tmp5_;
	GtkTreeStore* _tmp6_;
	GtkTreeIter _tmp7_;
	SidebarEntry* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	GtkTreeStore* _tmp13_;
	GtkTreeIter _tmp14_;
	GtkTreeIter _tmp15_;
	SidebarEntry* _tmp16_;
	SidebarEntry* _tmp17_;
	SidebarPageRepresentative* pageable = NULL;
	SidebarEntry* _tmp18_;
	SidebarPageRepresentative* _tmp19_;
	SidebarPageRepresentative* _tmp20_;
	SidebarRenameableEntry* renameable = NULL;
	SidebarEntry* _tmp23_;
	SidebarRenameableEntry* _tmp24_;
	SidebarRenameableEntry* _tmp25_;
	SidebarExpandableEntry* expandable = NULL;
	SidebarEntry* _tmp27_;
	SidebarExpandableEntry* _tmp28_;
	SidebarExpandableEntry* _tmp29_;
	gchar* sidebar_name = NULL;
	SidebarEntry* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	SidebarEntry* _tmp44_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (assoc_iter != NULL);
	g_return_if_fail (wrapper != NULL);
	_tmp0_ = wrapper->entry;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	entry = _tmp1_;
	_tmp2_ = self->priv->entry_map;
	_tmp3_ = entry;
	_vala_assert (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp2_, _tmp3_), "!entry_map.has_key (entry)");
	_tmp4_ = self->priv->entry_map;
	_tmp5_ = entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, _tmp5_, wrapper);
	_tmp6_ = self->priv->store;
	_tmp7_ = *assoc_iter;
	_tmp8_ = entry;
	_tmp9_ = sidebar_entry_get_sidebar_tooltip (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = guarded_markup_escape_text (_tmp10_);
	_tmp12_ = _tmp11_;
	gtk_tree_store_set (_tmp6_, &_tmp7_, SIDEBAR_TREE_COLUMNS_TOOLTIP, _tmp12_, -1);
	_g_free0 (_tmp12_);
	_g_free0 (_tmp10_);
	_tmp13_ = self->priv->store;
	_tmp14_ = *assoc_iter;
	gtk_tree_store_set (_tmp13_, &_tmp14_, SIDEBAR_TREE_COLUMNS_WRAPPER, wrapper, -1);
	_tmp15_ = *assoc_iter;
	sidebar_tree_load_entry_icons (self, &_tmp15_);
	_tmp16_ = entry;
	g_signal_connect_object (_tmp16_, "sidebar-tooltip-changed", (GCallback) _sidebar_tree_on_sidebar_tooltip_changed_sidebar_entry_sidebar_tooltip_changed, self, 0);
	_tmp17_ = entry;
	g_signal_connect_object (_tmp17_, "sidebar-icon-changed", (GCallback) _sidebar_tree_on_sidebar_icon_changed_sidebar_entry_sidebar_icon_changed, self, 0);
	_tmp18_ = entry;
	_tmp19_ = _g_object_ref0 (SIDEBAR_IS_PAGE_REPRESENTATIVE (_tmp18_) ? ((SidebarPageRepresentative*) _tmp18_) : NULL);
	pageable = _tmp19_;
	_tmp20_ = pageable;
	if (_tmp20_ != NULL) {
		SidebarPageRepresentative* _tmp21_;
		SidebarPageRepresentative* _tmp22_;
		_tmp21_ = pageable;
		g_signal_connect_object (_tmp21_, "page-created", (GCallback) _sidebar_tree_on_sidebar_page_created_sidebar_page_representative_page_created, self, 0);
		_tmp22_ = pageable;
		g_signal_connect_object (_tmp22_, "destroying-page", (GCallback) _sidebar_tree_on_sidebar_destroying_page_sidebar_page_representative_destroying_page, self, 0);
	}
	_tmp23_ = entry;
	_tmp24_ = _g_object_ref0 (SIDEBAR_IS_RENAMEABLE_ENTRY (_tmp23_) ? ((SidebarRenameableEntry*) _tmp23_) : NULL);
	renameable = _tmp24_;
	_tmp25_ = renameable;
	if (_tmp25_ != NULL) {
		SidebarRenameableEntry* _tmp26_;
		_tmp26_ = renameable;
		g_signal_connect_object (_tmp26_, "sidebar-name-changed", (GCallback) _sidebar_tree_on_sidebar_name_changed_sidebar_renameable_entry_sidebar_name_changed, self, 0);
	}
	_tmp27_ = entry;
	_tmp28_ = _g_object_ref0 (SIDEBAR_IS_EXPANDABLE_ENTRY (_tmp27_) ? ((SidebarExpandableEntry*) _tmp27_) : NULL);
	expandable = _tmp28_;
	_tmp29_ = expandable;
	if (_tmp29_ != NULL) {
		SidebarExpandableEntry* _tmp30_;
		_tmp30_ = expandable;
		g_signal_connect_object (_tmp30_, "sidebar-open-closed-icons-changed", (GCallback) _sidebar_tree_on_sidebar_open_closed_icons_changed_sidebar_expandable_entry_sidebar_open_closed_icons_changed, self, 0);
	}
	_tmp31_ = entry;
	_tmp32_ = sidebar_entry_get_sidebar_name (_tmp31_);
	_tmp33_ = _tmp32_;
	_tmp34_ = guarded_markup_escape_text (_tmp33_);
	_tmp35_ = _tmp34_;
	_g_free0 (_tmp33_);
	sidebar_name = _tmp35_;
	if (sidebar_tree_is_category_header (wrapper)) {
		GtkTreeStore* _tmp36_;
		GtkTreeIter _tmp37_;
		const gchar* _tmp38_;
		gchar* _tmp39_;
		gchar* _tmp40_;
		_tmp36_ = self->priv->store;
		_tmp37_ = *assoc_iter;
		_tmp38_ = sidebar_name;
		_tmp39_ = g_strdup_printf ("<b>%s</b>", _tmp38_);
		_tmp40_ = _tmp39_;
		gtk_tree_store_set (_tmp36_, &_tmp37_, SIDEBAR_TREE_COLUMNS_NAME, _tmp40_, -1);
		_g_free0 (_tmp40_);
	} else {
		GtkTreeStore* _tmp41_;
		GtkTreeIter _tmp42_;
		const gchar* _tmp43_;
		_tmp41_ = self->priv->store;
		_tmp42_ = *assoc_iter;
		_tmp43_ = sidebar_name;
		gtk_tree_store_set (_tmp41_, &_tmp42_, SIDEBAR_TREE_COLUMNS_NAME, _tmp43_, -1);
	}
	_tmp44_ = entry;
	sidebar_entry_grafted (_tmp44_, self);
	_g_free0 (sidebar_name);
	_g_object_unref0 (expandable);
	_g_object_unref0 (renameable);
	_g_object_unref0 (pageable);
	_g_object_unref0 (entry);
}

static gboolean
sidebar_tree_is_category_header (SidebarTreeEntryWrapper* wrapper)
{
	gboolean _tmp0_ = FALSE;
	SidebarEntry* _tmp1_;
	gboolean result;
	g_return_val_if_fail (wrapper != NULL, FALSE);
	_tmp1_ = wrapper->entry;
	if (SIDEBAR_IS_EXPANDABLE_ENTRY (_tmp1_)) {
		GtkTreePath* _tmp2_;
		GtkTreePath* _tmp3_;
		_tmp2_ = sidebar_tree_entry_wrapper_get_path (wrapper);
		_tmp3_ = _tmp2_;
		_tmp0_ = gtk_tree_path_get_depth (_tmp3_) == 1;
		__vala_GtkTreePath_free0 (_tmp3_);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static SidebarTreeEntryWrapper*
sidebar_tree_reparent_wrapper (SidebarTree* self,
                               GtkTreeIter* new_iter,
                               SidebarTreeEntryWrapper* current_wrapper)
{
	SidebarEntry* entry = NULL;
	SidebarEntry* _tmp0_;
	SidebarEntry* _tmp1_;
	gboolean removed = FALSE;
	GeeHashMap* _tmp2_;
	SidebarTreeEntryWrapper* new_wrapper = NULL;
	GtkTreeStore* _tmp3_;
	GtkTreeStore* _tmp4_;
	GtkTreeIter _tmp5_;
	GtkTreePath* _tmp6_;
	GtkTreePath* _tmp7_;
	SidebarTreeEntryWrapper* _tmp8_;
	SidebarTreeEntryWrapper* _tmp9_;
	GeeHashMap* _tmp10_;
	GtkTreeStore* _tmp11_;
	GtkTreeIter _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	GtkTreeStore* _tmp17_;
	GtkTreeIter _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	GtkTreeStore* _tmp23_;
	GtkTreeIter _tmp24_;
	GtkTreeIter _tmp25_;
	SidebarTreeEntryWrapper* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (new_iter != NULL, NULL);
	g_return_val_if_fail (current_wrapper != NULL, NULL);
	_tmp0_ = current_wrapper->entry;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	entry = _tmp1_;
	_tmp2_ = self->priv->entry_map;
	removed = gee_abstract_map_unset ((GeeAbstractMap*) _tmp2_, entry, NULL);
	_vala_assert (removed, "removed");
	_tmp3_ = self->priv->store;
	_tmp4_ = self->priv->store;
	_tmp5_ = *new_iter;
	_tmp6_ = gtk_tree_model_get_path ((GtkTreeModel*) _tmp4_, &_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = sidebar_tree_entry_wrapper_new ((GtkTreeModel*) _tmp3_, entry, _tmp7_);
	_tmp9_ = _tmp8_;
	__vala_GtkTreePath_free0 (_tmp7_);
	new_wrapper = _tmp9_;
	_tmp10_ = self->priv->entry_map;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp10_, entry, new_wrapper);
	_tmp11_ = self->priv->store;
	_tmp12_ = *new_iter;
	_tmp13_ = sidebar_entry_get_sidebar_name (entry);
	_tmp14_ = _tmp13_;
	_tmp15_ = guarded_markup_escape_text (_tmp14_);
	_tmp16_ = _tmp15_;
	gtk_tree_store_set (_tmp11_, &_tmp12_, SIDEBAR_TREE_COLUMNS_NAME, _tmp16_, -1);
	_g_free0 (_tmp16_);
	_g_free0 (_tmp14_);
	_tmp17_ = self->priv->store;
	_tmp18_ = *new_iter;
	_tmp19_ = sidebar_entry_get_sidebar_tooltip (entry);
	_tmp20_ = _tmp19_;
	_tmp21_ = guarded_markup_escape_text (_tmp20_);
	_tmp22_ = _tmp21_;
	gtk_tree_store_set (_tmp17_, &_tmp18_, SIDEBAR_TREE_COLUMNS_TOOLTIP, _tmp22_, -1);
	_g_free0 (_tmp22_);
	_g_free0 (_tmp20_);
	_tmp23_ = self->priv->store;
	_tmp24_ = *new_iter;
	gtk_tree_store_set (_tmp23_, &_tmp24_, SIDEBAR_TREE_COLUMNS_WRAPPER, new_wrapper, -1);
	_tmp25_ = *new_iter;
	sidebar_tree_load_entry_icons (self, &_tmp25_);
	result = new_wrapper;
	_g_object_unref0 (entry);
	return result;
}

void
sidebar_tree_prune (SidebarTree* self,
                    SidebarBranch* branch)
{
	GeeHashMap* _tmp0_;
	SidebarEntry* _tmp1_;
	SidebarEntry* _tmp2_;
	gboolean _tmp3_;
	guint _tmp4_;
	guint _tmp5_;
	guint _tmp6_;
	guint _tmp7_;
	guint _tmp8_;
	guint _tmp9_;
	gboolean removed = FALSE;
	GeeHashMap* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	_tmp0_ = self->priv->branches;
	_vala_assert (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, branch), "branches.has_key (branch)");
	_tmp1_ = sidebar_branch_get_root (branch);
	_tmp2_ = _tmp1_;
	_tmp3_ = sidebar_tree_has_wrapper (self, _tmp2_);
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		sidebar_tree_disassociate_branch (self, branch);
	}
	g_signal_parse_name ("entry-added", SIDEBAR_TYPE_BRANCH, &_tmp4_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (branch, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _sidebar_tree_on_branch_entry_added_sidebar_branch_entry_added, self);
	g_signal_parse_name ("entry-removed", SIDEBAR_TYPE_BRANCH, &_tmp5_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (branch, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _sidebar_tree_on_branch_entry_removed_sidebar_branch_entry_removed, self);
	g_signal_parse_name ("entry-moved", SIDEBAR_TYPE_BRANCH, &_tmp6_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (branch, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, 0, NULL, (GCallback) _sidebar_tree_on_branch_entry_moved_sidebar_branch_entry_moved, self);
	g_signal_parse_name ("entry-reparented", SIDEBAR_TYPE_BRANCH, &_tmp7_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (branch, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _sidebar_tree_on_branch_entry_reparented_sidebar_branch_entry_reparented, self);
	g_signal_parse_name ("children-reordered", SIDEBAR_TYPE_BRANCH, &_tmp8_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (branch, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp8_, 0, NULL, (GCallback) _sidebar_tree_on_branch_children_reordered_sidebar_branch_children_reordered, self);
	g_signal_parse_name ("show-branch", SIDEBAR_TYPE_BRANCH, &_tmp9_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (branch, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _sidebar_tree_on_show_branch_sidebar_branch_show_branch, self);
	_tmp10_ = self->priv->branches;
	removed = gee_abstract_map_unset ((GeeAbstractMap*) _tmp10_, branch, NULL);
	_vala_assert (removed, "removed");
	g_signal_emit (self, sidebar_tree_signals[SIDEBAR_TREE_BRANCH_REMOVED_SIGNAL], 0, branch);
}

static void
sidebar_tree_disassociate_branch (SidebarTree* self,
                                  SidebarBranch* branch)
{
	SidebarTreeRootWrapper* root_wrapper = NULL;
	SidebarEntry* _tmp0_;
	SidebarEntry* _tmp1_;
	SidebarTreeEntryWrapper* _tmp2_;
	SidebarTreeRootWrapper* _tmp3_;
	SidebarTreeRootWrapper* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	_tmp0_ = sidebar_branch_get_root (branch);
	_tmp1_ = _tmp0_;
	_tmp2_ = sidebar_tree_get_wrapper (self, _tmp1_);
	_tmp3_ = SIDEBAR_TREE_IS_ROOT_WRAPPER (_tmp2_) ? ((SidebarTreeRootWrapper*) _tmp2_) : NULL;
	if (_tmp3_ == NULL) {
		_g_object_unref0 (_tmp2_);
	}
	_tmp4_ = _tmp3_;
	_g_object_unref0 (_tmp1_);
	root_wrapper = _tmp4_;
	_vala_assert (root_wrapper != NULL, "root_wrapper != null");
	sidebar_tree_disassociate_wrapper_and_signal (self, (SidebarTreeEntryWrapper*) root_wrapper, FALSE);
	_g_object_unref0 (root_wrapper);
}

static void
sidebar_tree_disassociate_wrapper_and_signal (SidebarTree* self,
                                              SidebarTreeEntryWrapper* wrapper,
                                              gboolean only_children)
{
	gboolean selected = FALSE;
	SidebarEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (wrapper != NULL);
	_tmp0_ = wrapper->entry;
	selected = sidebar_tree_is_selected (self, _tmp0_);
	sidebar_tree_disassociate_wrapper (self, wrapper, only_children);
	if (selected) {
		SidebarSelectableEntry* selectable = NULL;
		SidebarEntry* _tmp1_;
		SidebarSelectableEntry* _tmp2_;
		SidebarSelectableEntry* _tmp3_;
		SidebarSelectableEntry* _tmp4_;
		_tmp1_ = wrapper->entry;
		_tmp2_ = _g_object_ref0 (SIDEBAR_IS_SELECTABLE_ENTRY (_tmp1_) ? ((SidebarSelectableEntry*) _tmp1_) : NULL);
		selectable = _tmp2_;
		_tmp3_ = selectable;
		_vala_assert (_tmp3_ != NULL, "selectable != null");
		_tmp4_ = selectable;
		g_signal_emit (self, sidebar_tree_signals[SIDEBAR_TREE_SELECTED_ENTRY_REMOVED_SIGNAL], 0, _tmp4_);
		_g_object_unref0 (selectable);
	}
}

static void
sidebar_tree_disassociate_wrapper (SidebarTree* self,
                                   SidebarTreeEntryWrapper* wrapper,
                                   gboolean only_children)
{
	GeeArrayList* children = NULL;
	GeeArrayList* _tmp0_;
	GtkTreeIter child_iter = {0};
	gboolean found = FALSE;
	GtkTreeStore* _tmp1_;
	GtkTreeIter _tmp2_ = {0};
	GtkTreeIter _tmp3_ = {0};
	gboolean _tmp4_;
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp21_ = {0};
	GtkTreeStore* _tmp22_;
	SidebarTreeEntryWrapper* _tmp23_;
	SidebarEntry* entry = NULL;
	SidebarEntry* _tmp24_;
	SidebarEntry* _tmp25_;
	SidebarEntry* _tmp26_;
	SidebarEntry* _tmp27_;
	guint _tmp28_;
	SidebarEntry* _tmp29_;
	guint _tmp30_;
	SidebarPageRepresentative* pageable = NULL;
	SidebarEntry* _tmp31_;
	SidebarPageRepresentative* _tmp32_;
	SidebarPageRepresentative* _tmp33_;
	SidebarRenameableEntry* renameable = NULL;
	SidebarEntry* _tmp38_;
	SidebarRenameableEntry* _tmp39_;
	SidebarRenameableEntry* _tmp40_;
	SidebarExpandableEntry* expandable = NULL;
	SidebarEntry* _tmp43_;
	SidebarExpandableEntry* _tmp44_;
	SidebarExpandableEntry* _tmp45_;
	gboolean removed = FALSE;
	GeeHashMap* _tmp48_;
	SidebarEntry* _tmp49_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (wrapper != NULL);
	_tmp0_ = gee_array_list_new (SIDEBAR_TREE_TYPE_ENTRY_WRAPPER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	children = _tmp0_;
	_tmp1_ = self->priv->store;
	sidebar_tree_entry_wrapper_get_iter (wrapper, &_tmp2_);
	_tmp4_ = gtk_tree_model_iter_children ((GtkTreeModel*) _tmp1_, &_tmp3_, &_tmp2_);
	child_iter = _tmp3_;
	found = _tmp4_;
	while (TRUE) {
		SidebarTreeEntryWrapper* child_wrapper = NULL;
		GtkTreeIter _tmp5_;
		SidebarTreeEntryWrapper* _tmp6_;
		SidebarTreeEntryWrapper* _tmp7_;
		GeeArrayList* _tmp8_;
		SidebarTreeEntryWrapper* _tmp9_;
		GtkTreeStore* _tmp10_;
		gboolean _tmp11_;
		if (!found) {
			break;
		}
		_tmp5_ = child_iter;
		_tmp6_ = sidebar_tree_get_wrapper_at_iter (self, &_tmp5_);
		child_wrapper = _tmp6_;
		_tmp7_ = child_wrapper;
		_vala_assert (_tmp7_ != NULL, "child_wrapper != null");
		_tmp8_ = children;
		_tmp9_ = child_wrapper;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp8_, _tmp9_);
		_tmp10_ = self->priv->store;
		_tmp11_ = gtk_tree_model_iter_next ((GtkTreeModel*) _tmp10_, &child_iter);
		found = _tmp11_;
		_g_object_unref0 (child_wrapper);
	}
	{
		GeeArrayList* _child_wrapper_list = NULL;
		GeeArrayList* _tmp12_;
		gint _child_wrapper_size = 0;
		GeeArrayList* _tmp13_;
		gint _tmp14_;
		gint _tmp15_;
		gint _child_wrapper_index = 0;
		_tmp12_ = children;
		_child_wrapper_list = _tmp12_;
		_tmp13_ = _child_wrapper_list;
		_tmp14_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp13_);
		_tmp15_ = _tmp14_;
		_child_wrapper_size = _tmp15_;
		_child_wrapper_index = -1;
		while (TRUE) {
			gint _tmp16_;
			gint _tmp17_;
			SidebarTreeEntryWrapper* child_wrapper = NULL;
			GeeArrayList* _tmp18_;
			gpointer _tmp19_;
			SidebarTreeEntryWrapper* _tmp20_;
			_child_wrapper_index = _child_wrapper_index + 1;
			_tmp16_ = _child_wrapper_index;
			_tmp17_ = _child_wrapper_size;
			if (!(_tmp16_ < _tmp17_)) {
				break;
			}
			_tmp18_ = _child_wrapper_list;
			_tmp19_ = gee_abstract_list_get ((GeeAbstractList*) _tmp18_, _child_wrapper_index);
			child_wrapper = (SidebarTreeEntryWrapper*) _tmp19_;
			_tmp20_ = child_wrapper;
			sidebar_tree_disassociate_wrapper (self, _tmp20_, FALSE);
			_g_object_unref0 (child_wrapper);
		}
	}
	if (only_children) {
		_g_object_unref0 (children);
		return;
	}
	sidebar_tree_entry_wrapper_get_iter (wrapper, &_tmp21_);
	iter = _tmp21_;
	_tmp22_ = self->priv->store;
	gtk_tree_store_remove (_tmp22_, &iter);
	_tmp23_ = self->priv->selected_wrapper;
	if (_tmp23_ == wrapper) {
		self->priv->selected_wrapper = NULL;
	}
	_tmp24_ = wrapper->entry;
	_tmp25_ = _g_object_ref0 (_tmp24_);
	entry = _tmp25_;
	_tmp26_ = entry;
	sidebar_entry_pruned (_tmp26_, self);
	_tmp27_ = entry;
	g_signal_parse_name ("sidebar-tooltip-changed", SIDEBAR_TYPE_ENTRY, &_tmp28_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp27_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp28_, 0, NULL, (GCallback) _sidebar_tree_on_sidebar_tooltip_changed_sidebar_entry_sidebar_tooltip_changed, self);
	_tmp29_ = entry;
	g_signal_parse_name ("sidebar-icon-changed", SIDEBAR_TYPE_ENTRY, &_tmp30_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp29_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp30_, 0, NULL, (GCallback) _sidebar_tree_on_sidebar_icon_changed_sidebar_entry_sidebar_icon_changed, self);
	_tmp31_ = entry;
	_tmp32_ = _g_object_ref0 (SIDEBAR_IS_PAGE_REPRESENTATIVE (_tmp31_) ? ((SidebarPageRepresentative*) _tmp31_) : NULL);
	pageable = _tmp32_;
	_tmp33_ = pageable;
	if (_tmp33_ != NULL) {
		SidebarPageRepresentative* _tmp34_;
		guint _tmp35_;
		SidebarPageRepresentative* _tmp36_;
		guint _tmp37_;
		_tmp34_ = pageable;
		g_signal_parse_name ("page-created", SIDEBAR_TYPE_PAGE_REPRESENTATIVE, &_tmp35_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp34_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp35_, 0, NULL, (GCallback) _sidebar_tree_on_sidebar_page_created_sidebar_page_representative_page_created, self);
		_tmp36_ = pageable;
		g_signal_parse_name ("destroying-page", SIDEBAR_TYPE_PAGE_REPRESENTATIVE, &_tmp37_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp36_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp37_, 0, NULL, (GCallback) _sidebar_tree_on_sidebar_destroying_page_sidebar_page_representative_destroying_page, self);
	}
	_tmp38_ = entry;
	_tmp39_ = _g_object_ref0 (SIDEBAR_IS_RENAMEABLE_ENTRY (_tmp38_) ? ((SidebarRenameableEntry*) _tmp38_) : NULL);
	renameable = _tmp39_;
	_tmp40_ = renameable;
	if (_tmp40_ != NULL) {
		SidebarRenameableEntry* _tmp41_;
		guint _tmp42_;
		_tmp41_ = renameable;
		g_signal_parse_name ("sidebar-name-changed", SIDEBAR_TYPE_RENAMEABLE_ENTRY, &_tmp42_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp41_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp42_, 0, NULL, (GCallback) _sidebar_tree_on_sidebar_name_changed_sidebar_renameable_entry_sidebar_name_changed, self);
	}
	_tmp43_ = entry;
	_tmp44_ = _g_object_ref0 (SIDEBAR_IS_EXPANDABLE_ENTRY (_tmp43_) ? ((SidebarExpandableEntry*) _tmp43_) : NULL);
	expandable = _tmp44_;
	_tmp45_ = expandable;
	if (_tmp45_ != NULL) {
		SidebarExpandableEntry* _tmp46_;
		guint _tmp47_;
		_tmp46_ = expandable;
		g_signal_parse_name ("sidebar-open-closed-icons-changed", SIDEBAR_TYPE_EXPANDABLE_ENTRY, &_tmp47_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp46_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp47_, 0, NULL, (GCallback) _sidebar_tree_on_sidebar_open_closed_icons_changed_sidebar_expandable_entry_sidebar_open_closed_icons_changed, self);
	}
	_tmp48_ = self->priv->entry_map;
	_tmp49_ = entry;
	removed = gee_abstract_map_unset ((GeeAbstractMap*) _tmp48_, _tmp49_, NULL);
	_vala_assert (removed, "removed");
	_g_object_unref0 (expandable);
	_g_object_unref0 (renameable);
	_g_object_unref0 (pageable);
	_g_object_unref0 (entry);
	_g_object_unref0 (children);
}

static void
sidebar_tree_on_branch_entry_added (SidebarTree* self,
                                    SidebarBranch* branch,
                                    SidebarEntry* entry)
{
	SidebarEntry* parent = NULL;
	SidebarEntry* _tmp0_;
	SidebarEntry* _tmp1_;
	SidebarTreeEntryWrapper* parent_wrapper = NULL;
	SidebarEntry* _tmp2_;
	SidebarTreeEntryWrapper* _tmp3_;
	SidebarTreeEntryWrapper* _tmp4_;
	GtkTreeIter insertion_iter = {0};
	SidebarEntry* next = NULL;
	SidebarEntry* _tmp5_;
	SidebarEntry* _tmp6_;
	GtkTreeIter _tmp19_;
	GtkTreeIter _tmp20_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = sidebar_branch_get_parent (branch, entry);
	parent = _tmp0_;
	_tmp1_ = parent;
	_vala_assert (_tmp1_ != NULL, "parent != null");
	_tmp2_ = parent;
	_tmp3_ = sidebar_tree_get_wrapper (self, _tmp2_);
	parent_wrapper = _tmp3_;
	_tmp4_ = parent_wrapper;
	_vala_assert (_tmp4_ != NULL, "parent_wrapper != null");
	_tmp5_ = sidebar_branch_get_next_sibling (branch, entry);
	next = _tmp5_;
	_tmp6_ = next;
	if (_tmp6_ != NULL) {
		SidebarTreeEntryWrapper* next_wrapper = NULL;
		SidebarEntry* _tmp7_;
		SidebarTreeEntryWrapper* _tmp8_;
		GtkTreeStore* _tmp9_;
		SidebarTreeEntryWrapper* _tmp10_;
		GtkTreeIter _tmp11_ = {0};
		SidebarTreeEntryWrapper* _tmp12_;
		GtkTreeIter _tmp13_ = {0};
		GtkTreeIter _tmp14_ = {0};
		_tmp7_ = next;
		_tmp8_ = sidebar_tree_get_wrapper (self, _tmp7_);
		next_wrapper = _tmp8_;
		_tmp9_ = self->priv->store;
		_tmp10_ = parent_wrapper;
		sidebar_tree_entry_wrapper_get_iter (_tmp10_, &_tmp11_);
		_tmp12_ = next_wrapper;
		sidebar_tree_entry_wrapper_get_iter (_tmp12_, &_tmp13_);
		gtk_tree_store_insert_before (_tmp9_, &_tmp14_, &_tmp11_, &_tmp13_);
		insertion_iter = _tmp14_;
		_g_object_unref0 (next_wrapper);
	} else {
		GtkTreeStore* _tmp15_;
		SidebarTreeEntryWrapper* _tmp16_;
		GtkTreeIter _tmp17_ = {0};
		GtkTreeIter _tmp18_ = {0};
		_tmp15_ = self->priv->store;
		_tmp16_ = parent_wrapper;
		sidebar_tree_entry_wrapper_get_iter (_tmp16_, &_tmp17_);
		gtk_tree_store_append (_tmp15_, &_tmp18_, &_tmp17_);
		insertion_iter = _tmp18_;
	}
	_tmp19_ = insertion_iter;
	sidebar_tree_associate_entry (self, &_tmp19_, entry);
	_tmp20_ = insertion_iter;
	sidebar_tree_associate_children (self, branch, entry, &_tmp20_);
	if (sidebar_branch_is_auto_open_on_new_child (branch)) {
		sidebar_tree_expand_to_entry (self, entry);
	}
	_g_object_unref0 (next);
	_g_object_unref0 (parent_wrapper);
	_g_object_unref0 (parent);
}

static void
sidebar_tree_on_branch_entry_removed (SidebarTree* self,
                                      SidebarBranch* branch,
                                      SidebarEntry* entry)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_vala_assert (wrapper != NULL, "wrapper != null");
	_vala_assert (!SIDEBAR_TREE_IS_ROOT_WRAPPER (wrapper), "! (wrapper is RootWrapper)");
	sidebar_tree_disassociate_wrapper_and_signal (self, wrapper, FALSE);
	_g_object_unref0 (wrapper);
}

static void
sidebar_tree_on_branch_entry_moved (SidebarTree* self,
                                    SidebarBranch* branch,
                                    SidebarEntry* entry)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	SidebarTreeEntryWrapper* _tmp2_;
	GtkTreeIter* prev_iter = NULL;
	SidebarEntry* prev = NULL;
	SidebarEntry* _tmp3_;
	SidebarEntry* _tmp4_;
	GtkTreeIter entry_iter = {0};
	SidebarTreeEntryWrapper* _tmp11_;
	GtkTreeIter _tmp12_ = {0};
	GtkTreeStore* _tmp13_;
	GtkTreeIter* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_tmp1_ = wrapper;
	_vala_assert (_tmp1_ != NULL, "wrapper != null");
	_tmp2_ = wrapper;
	_vala_assert (!SIDEBAR_TREE_IS_ROOT_WRAPPER (_tmp2_), "! (wrapper is RootWrapper)");
	prev_iter = NULL;
	_tmp3_ = sidebar_branch_get_previous_sibling (branch, entry);
	prev = _tmp3_;
	_tmp4_ = prev;
	if (_tmp4_ != NULL) {
		SidebarTreeEntryWrapper* prev_wrapper = NULL;
		SidebarEntry* _tmp5_;
		SidebarTreeEntryWrapper* _tmp6_;
		SidebarTreeEntryWrapper* _tmp7_;
		SidebarTreeEntryWrapper* _tmp8_;
		GtkTreeIter _tmp9_ = {0};
		GtkTreeIter* _tmp10_;
		_tmp5_ = prev;
		_tmp6_ = sidebar_tree_get_wrapper (self, _tmp5_);
		prev_wrapper = _tmp6_;
		_tmp7_ = prev_wrapper;
		_vala_assert (_tmp7_ != NULL, "prev_wrapper != null");
		_tmp8_ = prev_wrapper;
		sidebar_tree_entry_wrapper_get_iter (_tmp8_, &_tmp9_);
		_tmp10_ = __vala_GtkTreeIter_copy0 (&_tmp9_);
		__vala_GtkTreeIter_free0 (prev_iter);
		prev_iter = _tmp10_;
		_g_object_unref0 (prev_wrapper);
	}
	_tmp11_ = wrapper;
	sidebar_tree_entry_wrapper_get_iter (_tmp11_, &_tmp12_);
	entry_iter = _tmp12_;
	_tmp13_ = self->priv->store;
	_tmp14_ = prev_iter;
	gtk_tree_store_move_after (_tmp13_, &entry_iter, _tmp14_);
	_g_object_unref0 (prev);
	__vala_GtkTreeIter_free0 (prev_iter);
	_g_object_unref0 (wrapper);
}

static void
sidebar_tree_on_branch_entry_reparented (SidebarTree* self,
                                         SidebarBranch* branch,
                                         SidebarEntry* entry,
                                         SidebarEntry* old_parent)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	SidebarTreeEntryWrapper* _tmp2_;
	gboolean selected = FALSE;
	GtkTreePath* _tmp3_;
	GtkTreePath* _tmp4_;
	SidebarTreeEntryWrapper* _tmp5_;
	GtkTreePath* _tmp6_;
	GtkTreePath* _tmp7_;
	gboolean _tmp8_;
	GtkTreeIter iter = {0};
	SidebarTreeEntryWrapper* _tmp9_;
	GtkTreeIter _tmp10_ = {0};
	GtkTreeStore* _tmp11_;
	SidebarEntry* parent = NULL;
	SidebarEntry* _tmp12_;
	SidebarEntry* _tmp13_;
	SidebarTreeEntryWrapper* parent_wrapper = NULL;
	SidebarEntry* _tmp14_;
	SidebarTreeEntryWrapper* _tmp15_;
	SidebarTreeEntryWrapper* _tmp16_;
	GtkTreeIter* prev_iter = NULL;
	SidebarEntry* prev = NULL;
	SidebarEntry* _tmp17_;
	SidebarEntry* _tmp18_;
	GtkTreeIter new_iter = {0};
	GtkTreeStore* _tmp25_;
	SidebarTreeEntryWrapper* _tmp26_;
	GtkTreeIter _tmp27_ = {0};
	GtkTreeIter* _tmp28_;
	GtkTreeIter _tmp29_ = {0};
	SidebarTreeEntryWrapper* new_wrapper = NULL;
	GtkTreeIter _tmp30_;
	SidebarTreeEntryWrapper* _tmp31_;
	SidebarTreeEntryWrapper* _tmp32_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (old_parent != NULL);
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_tmp1_ = wrapper;
	_vala_assert (_tmp1_ != NULL, "wrapper != null");
	_tmp2_ = wrapper;
	_vala_assert (!SIDEBAR_TREE_IS_ROOT_WRAPPER (_tmp2_), "! (wrapper is RootWrapper)");
	_tmp3_ = sidebar_tree_get_current_path (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = wrapper;
	_tmp6_ = sidebar_tree_entry_wrapper_get_path (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = gtk_tree_path_compare (_tmp4_, _tmp7_) == 0;
	__vala_GtkTreePath_free0 (_tmp7_);
	__vala_GtkTreePath_free0 (_tmp4_);
	selected = _tmp8_;
	_tmp9_ = wrapper;
	sidebar_tree_entry_wrapper_get_iter (_tmp9_, &_tmp10_);
	iter = _tmp10_;
	_tmp11_ = self->priv->store;
	gtk_tree_store_remove (_tmp11_, &iter);
	_tmp12_ = sidebar_branch_get_parent (branch, entry);
	parent = _tmp12_;
	_tmp13_ = parent;
	_vala_assert (_tmp13_ != NULL, "parent != null");
	_tmp14_ = parent;
	_tmp15_ = sidebar_tree_get_wrapper (self, _tmp14_);
	parent_wrapper = _tmp15_;
	_tmp16_ = parent_wrapper;
	_vala_assert (_tmp16_ != NULL, "parent_wrapper != null");
	prev_iter = NULL;
	_tmp17_ = sidebar_branch_get_previous_sibling (branch, entry);
	prev = _tmp17_;
	_tmp18_ = prev;
	if (_tmp18_ != NULL) {
		SidebarTreeEntryWrapper* prev_wrapper = NULL;
		SidebarEntry* _tmp19_;
		SidebarTreeEntryWrapper* _tmp20_;
		SidebarTreeEntryWrapper* _tmp21_;
		SidebarTreeEntryWrapper* _tmp22_;
		GtkTreeIter _tmp23_ = {0};
		GtkTreeIter* _tmp24_;
		_tmp19_ = prev;
		_tmp20_ = sidebar_tree_get_wrapper (self, _tmp19_);
		prev_wrapper = _tmp20_;
		_tmp21_ = prev_wrapper;
		_vala_assert (_tmp21_ != NULL, "prev_wrapper != null");
		_tmp22_ = prev_wrapper;
		sidebar_tree_entry_wrapper_get_iter (_tmp22_, &_tmp23_);
		_tmp24_ = __vala_GtkTreeIter_copy0 (&_tmp23_);
		__vala_GtkTreeIter_free0 (prev_iter);
		prev_iter = _tmp24_;
		_g_object_unref0 (prev_wrapper);
	}
	_tmp25_ = self->priv->store;
	_tmp26_ = parent_wrapper;
	sidebar_tree_entry_wrapper_get_iter (_tmp26_, &_tmp27_);
	_tmp28_ = prev_iter;
	gtk_tree_store_insert_after (_tmp25_, &_tmp29_, &_tmp27_, _tmp28_);
	new_iter = _tmp29_;
	_tmp30_ = new_iter;
	_tmp31_ = wrapper;
	_tmp32_ = sidebar_tree_reparent_wrapper (self, &_tmp30_, _tmp31_);
	new_wrapper = _tmp32_;
	if (selected) {
		SidebarTreeEntryWrapper* _tmp33_;
		SidebarEntry* _tmp34_;
		SidebarTreeEntryWrapper* _tmp35_;
		SidebarEntry* _tmp36_;
		_tmp33_ = new_wrapper;
		_tmp34_ = _tmp33_->entry;
		sidebar_tree_expand_to_entry (self, _tmp34_);
		_tmp35_ = new_wrapper;
		_tmp36_ = _tmp35_->entry;
		sidebar_tree_place_cursor (self, _tmp36_, FALSE);
	}
	_g_object_unref0 (new_wrapper);
	_g_object_unref0 (prev);
	__vala_GtkTreeIter_free0 (prev_iter);
	_g_object_unref0 (parent_wrapper);
	_g_object_unref0 (parent);
	_g_object_unref0 (wrapper);
}

static void
sidebar_tree_on_branch_children_reordered (SidebarTree* self,
                                           SidebarBranch* branch,
                                           SidebarEntry* entry)
{
	GeeList* children = NULL;
	GeeList* _tmp0_;
	GeeList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = sidebar_branch_get_children (branch, entry);
	children = _tmp0_;
	_tmp1_ = children;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (children);
		return;
	}
	{
		GeeList* _child_list = NULL;
		GeeList* _tmp2_;
		gint _child_size = 0;
		GeeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _child_index = 0;
		_tmp2_ = children;
		_child_list = _tmp2_;
		_tmp3_ = _child_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_child_size = _tmp5_;
		_child_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			SidebarEntry* child = NULL;
			GeeList* _tmp8_;
			gpointer _tmp9_;
			SidebarTreeEntryWrapper* child_wrapper = NULL;
			SidebarEntry* _tmp10_;
			SidebarTreeEntryWrapper* _tmp11_;
			SidebarTreeEntryWrapper* _tmp12_;
			GtkTreeIter child_iter = {0};
			SidebarTreeEntryWrapper* _tmp13_;
			GtkTreeIter _tmp14_ = {0};
			GtkTreeStore* _tmp15_;
			_child_index = _child_index + 1;
			_tmp6_ = _child_index;
			_tmp7_ = _child_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _child_list;
			_tmp9_ = gee_list_get (_tmp8_, _child_index);
			child = (SidebarEntry*) _tmp9_;
			_tmp10_ = child;
			_tmp11_ = sidebar_tree_get_wrapper (self, _tmp10_);
			child_wrapper = _tmp11_;
			_tmp12_ = child_wrapper;
			_vala_assert (_tmp12_ != NULL, "child_wrapper != null");
			_tmp13_ = child_wrapper;
			sidebar_tree_entry_wrapper_get_iter (_tmp13_, &_tmp14_);
			child_iter = _tmp14_;
			_tmp15_ = self->priv->store;
			gtk_tree_store_move_before (_tmp15_, &child_iter, NULL);
			_g_object_unref0 (child_wrapper);
			_g_object_unref0 (child);
		}
	}
	_g_object_unref0 (children);
}

static void
sidebar_tree_on_show_branch (SidebarTree* self,
                             SidebarBranch* branch,
                             gboolean shown)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (branch != NULL);
	if (shown) {
		sidebar_tree_associate_branch (self, branch);
	} else {
		sidebar_tree_disassociate_branch (self, branch);
	}
	g_signal_emit (self, sidebar_tree_signals[SIDEBAR_TREE_BRANCH_SHOWN_SIGNAL], 0, branch, shown);
}

static void
sidebar_tree_on_sidebar_tooltip_changed (SidebarTree* self,
                                         SidebarEntry* entry,
                                         const gchar* tooltip)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	GtkTreeStore* _tmp1_;
	GtkTreeIter _tmp2_ = {0};
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_vala_assert (wrapper != NULL, "wrapper != null");
	_tmp1_ = self->priv->store;
	sidebar_tree_entry_wrapper_get_iter (wrapper, &_tmp2_);
	_tmp3_ = guarded_markup_escape_text (tooltip);
	_tmp4_ = _tmp3_;
	gtk_tree_store_set (_tmp1_, &_tmp2_, SIDEBAR_TREE_COLUMNS_TOOLTIP, _tmp4_, -1);
	_g_free0 (_tmp4_);
	_g_object_unref0 (wrapper);
}

static void
sidebar_tree_on_sidebar_icon_changed (SidebarTree* self,
                                      SidebarEntry* entry,
                                      GIcon* icon)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	GtkTreeStore* _tmp1_;
	GtkTreeIter _tmp2_ = {0};
	GtkTreeStore* _tmp3_;
	GtkTreeIter _tmp4_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_vala_assert (wrapper != NULL, "wrapper != null");
	_tmp1_ = self->priv->store;
	sidebar_tree_entry_wrapper_get_iter (wrapper, &_tmp2_);
	gtk_tree_store_set (_tmp1_, &_tmp2_, SIDEBAR_TREE_COLUMNS_ICON, icon, -1);
	_tmp3_ = self->priv->store;
	sidebar_tree_entry_wrapper_get_iter (wrapper, &_tmp4_);
	gtk_tree_store_set (_tmp3_, &_tmp4_, SIDEBAR_TREE_COLUMNS_PIXBUF_VISIBLE, !sidebar_tree_is_category_header (wrapper), -1);
	_g_object_unref0 (wrapper);
}

static void
sidebar_tree_on_sidebar_page_created (SidebarTree* self,
                                      SidebarPageRepresentative* entry,
                                      Page* page)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (page != NULL);
	g_signal_emit (self, sidebar_tree_signals[SIDEBAR_TREE_PAGE_CREATED_SIGNAL], 0, entry, page);
}

static void
sidebar_tree_on_sidebar_destroying_page (SidebarTree* self,
                                         SidebarPageRepresentative* entry,
                                         Page* page)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (page != NULL);
	g_signal_emit (self, sidebar_tree_signals[SIDEBAR_TREE_DESTROYING_PAGE_SIGNAL], 0, entry, page);
}

static void
sidebar_tree_on_sidebar_open_closed_icons_changed (SidebarTree* self,
                                                   SidebarExpandableEntry* entry,
                                                   GIcon* open,
                                                   GIcon* closed)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	GtkTreeStore* _tmp1_;
	GtkTreeIter _tmp2_ = {0};
	GdkPixbuf* _tmp3_;
	GdkPixbuf* _tmp4_;
	GtkTreeStore* _tmp5_;
	GtkTreeIter _tmp6_ = {0};
	GdkPixbuf* _tmp7_;
	GdkPixbuf* _tmp8_;
	GtkTreeStore* _tmp9_;
	GtkTreeIter _tmp10_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = sidebar_tree_get_wrapper (self, (SidebarEntry*) entry);
	wrapper = _tmp0_;
	_vala_assert (wrapper != NULL, "wrapper != null");
	_tmp1_ = self->priv->store;
	sidebar_tree_entry_wrapper_get_iter (wrapper, &_tmp2_);
	_tmp3_ = sidebar_tree_fetch_icon_pixbuf (self, open);
	_tmp4_ = _tmp3_;
	gtk_tree_store_set (_tmp1_, &_tmp2_, SIDEBAR_TREE_COLUMNS_OPEN_PIXBUF, _tmp4_, -1);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = self->priv->store;
	sidebar_tree_entry_wrapper_get_iter (wrapper, &_tmp6_);
	_tmp7_ = sidebar_tree_fetch_icon_pixbuf (self, closed);
	_tmp8_ = _tmp7_;
	gtk_tree_store_set (_tmp5_, &_tmp6_, SIDEBAR_TREE_COLUMNS_CLOSED_PIXBUF, _tmp8_, -1);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = self->priv->store;
	sidebar_tree_entry_wrapper_get_iter (wrapper, &_tmp10_);
	gtk_tree_store_set (_tmp9_, &_tmp10_, SIDEBAR_TREE_COLUMNS_PIXBUF_VISIBLE, !sidebar_tree_is_category_header (wrapper), -1);
	_g_object_unref0 (wrapper);
}

static void
sidebar_tree_on_sidebar_name_changed (SidebarTree* self,
                                      SidebarRenameableEntry* entry,
                                      const gchar* name)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	GtkTreeStore* _tmp1_;
	GtkTreeIter _tmp2_ = {0};
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = sidebar_tree_get_wrapper (self, (SidebarEntry*) entry);
	wrapper = _tmp0_;
	_vala_assert (wrapper != NULL, "wrapper != null");
	_tmp1_ = self->priv->store;
	sidebar_tree_entry_wrapper_get_iter (wrapper, &_tmp2_);
	_tmp3_ = guarded_markup_escape_text (name);
	_tmp4_ = _tmp3_;
	gtk_tree_store_set (_tmp1_, &_tmp2_, SIDEBAR_TREE_COLUMNS_NAME, _tmp4_, -1);
	_g_free0 (_tmp4_);
	_g_object_unref0 (wrapper);
}

static GdkPixbuf*
sidebar_tree_fetch_icon_pixbuf (SidebarTree* self,
                                GIcon* gicon)
{
	GError* _inner_error0_ = NULL;
	GdkPixbuf* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (gicon == NULL) {
		result = NULL;
		return result;
	}
	{
		GdkPixbuf* icon = NULL;
		GeeHashMap* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gpointer _tmp3_;
		GdkPixbuf* _tmp4_;
		GdkPixbuf* _tmp5_;
		GtkIconInfo* info = NULL;
		GtkIconTheme* _tmp6_;
		GtkIconInfo* _tmp7_;
		GtkIconInfo* _tmp8_;
		GdkPixbuf* _tmp9_ = NULL;
		GtkIconInfo* _tmp10_;
		GdkPixbuf* _tmp11_;
		GdkPixbuf* _tmp12_;
		GdkPixbuf* _tmp13_;
		GeeHashMap* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		GdkPixbuf* _tmp17_;
		_tmp0_ = self->priv->icon_cache;
		_tmp1_ = g_icon_to_string (gicon);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, _tmp2_);
		_tmp4_ = (GdkPixbuf*) _tmp3_;
		_g_free0 (_tmp2_);
		icon = _tmp4_;
		_tmp5_ = icon;
		if (_tmp5_ != NULL) {
			result = icon;
			return result;
		}
		_tmp6_ = self->priv->icon_theme;
		_tmp7_ = gtk_icon_theme_lookup_by_gicon_for_scale (_tmp6_, gicon, 16, gtk_widget_get_scale_factor ((GtkWidget*) self), GTK_ICON_LOOKUP_FORCE_SIZE);
		info = _tmp7_;
		_tmp8_ = info;
		if (_tmp8_ == NULL) {
			result = NULL;
			_g_object_unref0 (info);
			_g_object_unref0 (icon);
			return result;
		}
		_tmp10_ = info;
		_tmp11_ = gtk_icon_info_load_icon (_tmp10_, &_inner_error0_);
		_tmp9_ = _tmp11_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (info);
			_g_object_unref0 (icon);
			goto __catch0_g_error;
		}
		_tmp12_ = _tmp9_;
		_tmp9_ = NULL;
		_g_object_unref0 (icon);
		icon = _tmp12_;
		_tmp13_ = icon;
		if (_tmp13_ == NULL) {
			result = NULL;
			_g_object_unref0 (_tmp9_);
			_g_object_unref0 (info);
			_g_object_unref0 (icon);
			return result;
		}
		_tmp14_ = self->priv->icon_cache;
		_tmp15_ = g_icon_to_string (gicon);
		_tmp16_ = _tmp15_;
		_tmp17_ = icon;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp14_, _tmp16_, _tmp17_);
		_g_free0 (_tmp16_);
		result = icon;
		_g_object_unref0 (_tmp9_);
		_g_object_unref0 (info);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		gchar* _tmp18_;
		gchar* _tmp19_;
		GError* _tmp20_;
		const gchar* _tmp21_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp18_ = g_icon_to_string (gicon);
		_tmp19_ = _tmp18_;
		_tmp20_ = err;
		_tmp21_ = _tmp20_->message;
		g_warning ("Tree.vala:760: Unable to load icon %s: %s", _tmp19_, _tmp21_);
		_g_free0 (_tmp19_);
		result = NULL;
		_g_error_free0 (err);
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
sidebar_tree_load_entry_icons (SidebarTree* self,
                               GtkTreeIter* iter)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	GtkTreeIter _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	SidebarTreeEntryWrapper* _tmp2_;
	GIcon* icon = NULL;
	SidebarTreeEntryWrapper* _tmp3_;
	SidebarEntry* _tmp4_;
	GIcon* _tmp5_;
	GIcon* open = NULL;
	GIcon* closed = NULL;
	SidebarExpandableEntry* expandable = NULL;
	SidebarTreeEntryWrapper* _tmp6_;
	SidebarEntry* _tmp7_;
	SidebarExpandableEntry* _tmp8_;
	SidebarExpandableEntry* _tmp9_;
	GIcon* _tmp14_;
	GIcon* _tmp17_;
	GtkTreeStore* _tmp20_;
	GtkTreeIter _tmp21_;
	GIcon* _tmp22_;
	GtkTreeStore* _tmp23_;
	GtkTreeIter _tmp24_;
	GIcon* _tmp25_;
	GdkPixbuf* _tmp26_;
	GdkPixbuf* _tmp27_;
	GtkTreeStore* _tmp28_;
	GtkTreeIter _tmp29_;
	GIcon* _tmp30_;
	GdkPixbuf* _tmp31_;
	GdkPixbuf* _tmp32_;
	GtkTreeStore* _tmp33_;
	SidebarTreeEntryWrapper* _tmp34_;
	GtkTreeIter _tmp35_ = {0};
	SidebarTreeEntryWrapper* _tmp36_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = *iter;
	_tmp1_ = sidebar_tree_get_wrapper_at_iter (self, &_tmp0_);
	wrapper = _tmp1_;
	_tmp2_ = wrapper;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (wrapper);
		return;
	}
	_tmp3_ = wrapper;
	_tmp4_ = _tmp3_->entry;
	_tmp5_ = sidebar_entry_get_sidebar_icon (_tmp4_);
	icon = _tmp5_;
	open = NULL;
	closed = NULL;
	_tmp6_ = wrapper;
	_tmp7_ = _tmp6_->entry;
	_tmp8_ = _g_object_ref0 (SIDEBAR_IS_EXPANDABLE_ENTRY (_tmp7_) ? ((SidebarExpandableEntry*) _tmp7_) : NULL);
	expandable = _tmp8_;
	_tmp9_ = expandable;
	if (_tmp9_ != NULL) {
		SidebarExpandableEntry* _tmp10_;
		GIcon* _tmp11_;
		SidebarExpandableEntry* _tmp12_;
		GIcon* _tmp13_;
		_tmp10_ = expandable;
		_tmp11_ = sidebar_expandable_entry_get_sidebar_open_icon (_tmp10_);
		_g_object_unref0 (open);
		open = _tmp11_;
		_tmp12_ = expandable;
		_tmp13_ = sidebar_expandable_entry_get_sidebar_closed_icon (_tmp12_);
		_g_object_unref0 (closed);
		closed = _tmp13_;
	}
	_tmp14_ = open;
	if (_tmp14_ == NULL) {
		GIcon* _tmp15_;
		GIcon* _tmp16_;
		_tmp15_ = icon;
		_tmp16_ = _g_object_ref0 (_tmp15_);
		_g_object_unref0 (open);
		open = _tmp16_;
	}
	_tmp17_ = closed;
	if (_tmp17_ == NULL) {
		GIcon* _tmp18_;
		GIcon* _tmp19_;
		_tmp18_ = icon;
		_tmp19_ = _g_object_ref0 (_tmp18_);
		_g_object_unref0 (closed);
		closed = _tmp19_;
	}
	_tmp20_ = self->priv->store;
	_tmp21_ = *iter;
	_tmp22_ = icon;
	gtk_tree_store_set (_tmp20_, &_tmp21_, SIDEBAR_TREE_COLUMNS_ICON, _tmp22_, -1);
	_tmp23_ = self->priv->store;
	_tmp24_ = *iter;
	_tmp25_ = open;
	_tmp26_ = sidebar_tree_fetch_icon_pixbuf (self, _tmp25_);
	_tmp27_ = _tmp26_;
	gtk_tree_store_set (_tmp23_, &_tmp24_, SIDEBAR_TREE_COLUMNS_OPEN_PIXBUF, _tmp27_, -1);
	_g_object_unref0 (_tmp27_);
	_tmp28_ = self->priv->store;
	_tmp29_ = *iter;
	_tmp30_ = closed;
	_tmp31_ = sidebar_tree_fetch_icon_pixbuf (self, _tmp30_);
	_tmp32_ = _tmp31_;
	gtk_tree_store_set (_tmp28_, &_tmp29_, SIDEBAR_TREE_COLUMNS_CLOSED_PIXBUF, _tmp32_, -1);
	_g_object_unref0 (_tmp32_);
	_tmp33_ = self->priv->store;
	_tmp34_ = wrapper;
	sidebar_tree_entry_wrapper_get_iter (_tmp34_, &_tmp35_);
	_tmp36_ = wrapper;
	gtk_tree_store_set (_tmp33_, &_tmp35_, SIDEBAR_TREE_COLUMNS_PIXBUF_VISIBLE, !sidebar_tree_is_category_header (_tmp36_), -1);
	_g_object_unref0 (expandable);
	_g_object_unref0 (closed);
	_g_object_unref0 (open);
	_g_object_unref0 (icon);
	_g_object_unref0 (wrapper);
}

static void
sidebar_tree_load_branch_icons (SidebarTree* self,
                                GtkTreeIter* iter)
{
	GtkTreeIter _tmp0_;
	GtkTreeIter child_iter = {0};
	GtkTreeStore* _tmp1_;
	GtkTreeIter _tmp2_;
	GtkTreeIter _tmp3_ = {0};
	gboolean _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = *iter;
	sidebar_tree_load_entry_icons (self, &_tmp0_);
	_tmp1_ = self->priv->store;
	_tmp2_ = *iter;
	_tmp4_ = gtk_tree_model_iter_children ((GtkTreeModel*) _tmp1_, &_tmp3_, &_tmp2_);
	child_iter = _tmp3_;
	if (_tmp4_) {
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				GtkTreeIter _tmp8_;
				if (!_tmp5_) {
					GtkTreeStore* _tmp6_;
					gboolean _tmp7_;
					_tmp6_ = self->priv->store;
					_tmp7_ = gtk_tree_model_iter_next ((GtkTreeModel*) _tmp6_, &child_iter);
					if (!_tmp7_) {
						break;
					}
				}
				_tmp5_ = FALSE;
				_tmp8_ = child_iter;
				sidebar_tree_load_branch_icons (self, &_tmp8_);
			}
		}
	}
}

static void
sidebar_tree_on_theme_change (SidebarTree* self)
{
	GtkTreeIter iter = {0};
	GtkTreeStore* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->store;
	_tmp2_ = gtk_tree_model_get_iter_first ((GtkTreeModel*) _tmp0_, &_tmp1_);
	iter = _tmp1_;
	if (_tmp2_) {
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				GtkTreeIter _tmp6_;
				if (!_tmp3_) {
					GtkTreeStore* _tmp4_;
					gboolean _tmp5_;
					_tmp4_ = self->priv->store;
					_tmp5_ = gtk_tree_model_iter_next ((GtkTreeModel*) _tmp4_, &iter);
					if (!_tmp5_) {
						break;
					}
				}
				_tmp3_ = FALSE;
				_tmp6_ = iter;
				sidebar_tree_load_branch_icons (self, &_tmp6_);
			}
		}
	}
}

static gboolean
sidebar_tree_on_selection (SidebarTree* self,
                           GtkTreeSelection* selection,
                           GtkTreeModel* model,
                           GtkTreePath* path,
                           gboolean path_currently_selected)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	gboolean _tmp1_ = FALSE;
	SidebarTreeEntryWrapper* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (selection != NULL, FALSE);
	g_return_val_if_fail (model != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	_tmp0_ = sidebar_tree_get_wrapper_at_path (self, path);
	wrapper = _tmp0_;
	_tmp2_ = wrapper;
	if (_tmp2_ != NULL) {
		SidebarTreeEntryWrapper* _tmp3_;
		SidebarEntry* _tmp4_;
		_tmp3_ = wrapper;
		_tmp4_ = _tmp3_->entry;
		_tmp1_ = SIDEBAR_IS_SELECTABLE_ENTRY (_tmp4_);
	} else {
		_tmp1_ = FALSE;
	}
	result = _tmp1_;
	_g_object_unref0 (wrapper);
	return result;
}

static GtkTreePath*
sidebar_tree_get_path_from_event (SidebarTree* self,
                                  GdkEventButton* event)
{
	gint x = 0;
	gint y = 0;
	GdkModifierType mask = 0U;
	GdkSeat* seat = NULL;
	GdkSeat* _tmp0_;
	GdkSeat* _tmp1_;
	GdkWindow* _tmp2_;
	GdkSeat* _tmp3_;
	GdkDevice* _tmp4_;
	gint _tmp5_ = 0;
	gint _tmp6_ = 0;
	GdkModifierType _tmp7_ = 0U;
	gint cell_x = 0;
	gint cell_y = 0;
	GtkTreePath* path = NULL;
	GtkTreePath* _tmp8_ = NULL;
	GtkTreePath* _tmp9_ = NULL;
	gint _tmp10_ = 0;
	gint _tmp11_ = 0;
	gboolean _tmp12_;
	GtkTreePath* _tmp14_;
	GtkTreePath* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (event != NULL, NULL);
	_tmp0_ = gdk_event_get_seat ((GdkEvent*) event);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	seat = _tmp1_;
	_tmp2_ = event->window;
	_tmp3_ = seat;
	_tmp4_ = gdk_seat_get_pointer (_tmp3_);
	gdk_window_get_device_position (_tmp2_, _tmp4_, &_tmp5_, &_tmp6_, &_tmp7_);
	x = _tmp5_;
	y = _tmp6_;
	mask = _tmp7_;
	_tmp12_ = gtk_tree_view_get_path_at_pos ((GtkTreeView*) self, x, y, &_tmp9_, NULL, &_tmp10_, &_tmp11_);
	__vala_GtkTreePath_free0 (path);
	path = _tmp9_;
	cell_x = _tmp10_;
	cell_y = _tmp11_;
	if (_tmp12_) {
		GtkTreePath* _tmp13_;
		_tmp13_ = path;
		_tmp8_ = _tmp13_;
	} else {
		_tmp8_ = NULL;
	}
	_tmp14_ = __vala_GtkTreePath_copy0 (_tmp8_);
	result = _tmp14_;
	__vala_GtkTreePath_free0 (path);
	_g_object_unref0 (seat);
	return result;
}

static GtkTreePath*
sidebar_tree_get_current_path (SidebarTree* self)
{
	GtkTreeModel* model = NULL;
	GList* rows = NULL;
	GtkTreeSelection* _tmp0_;
	GtkTreeModel* _tmp1_ = NULL;
	GList* _tmp2_;
	GtkTreeModel* _tmp3_;
	gboolean _tmp4_ = FALSE;
	GList* _tmp5_;
	GtkTreePath* _tmp7_ = NULL;
	GList* _tmp8_;
	GtkTreePath* _tmp11_;
	GtkTreePath* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	_tmp2_ = gtk_tree_selection_get_selected_rows (_tmp0_, &_tmp1_);
	_g_object_unref0 (model);
	_tmp3_ = _g_object_ref0 (_tmp1_);
	model = _tmp3_;
	rows = _tmp2_;
	_tmp5_ = rows;
	if (g_list_length (_tmp5_) == ((guint) 0)) {
		_tmp4_ = TRUE;
	} else {
		GList* _tmp6_;
		_tmp6_ = rows;
		_tmp4_ = g_list_length (_tmp6_) == ((guint) 1);
	}
	_vala_assert (_tmp4_, "rows.length () == 0 || rows.length () == 1");
	_tmp8_ = rows;
	if (g_list_length (_tmp8_) != ((guint) 0)) {
		GList* _tmp9_;
		gconstpointer _tmp10_;
		_tmp9_ = rows;
		_tmp10_ = g_list_nth_data (_tmp9_, (guint) 0);
		_tmp7_ = (GtkTreePath*) _tmp10_;
	} else {
		_tmp7_ = NULL;
	}
	_tmp11_ = __vala_GtkTreePath_copy0 (_tmp7_);
	result = _tmp11_;
	(rows == NULL) ? NULL : (rows = (_g_list_free___vala_GtkTreePath_free0_ (rows), NULL));
	_g_object_unref0 (model);
	return result;
}

static gboolean
sidebar_tree_on_context_menu_keypress (SidebarTree* self)
{
	GList* rows = NULL;
	GtkTreeSelection* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	GtkTreePath* path = NULL;
	GList* _tmp3_;
	gconstpointer _tmp4_;
	GtkTreePath* _tmp5_;
	GtkTreePath* _tmp6_;
	GtkTreePath* _tmp7_;
	GtkTreePath* _tmp8_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	_tmp1_ = gtk_tree_selection_get_selected_rows (_tmp0_, NULL);
	rows = _tmp1_;
	_tmp2_ = rows;
	if (_tmp2_ == NULL) {
		result = FALSE;
		(rows == NULL) ? NULL : (rows = (_g_list_free___vala_GtkTreePath_free0_ (rows), NULL));
		return result;
	}
	_tmp3_ = rows;
	_tmp4_ = _tmp3_->data;
	_tmp5_ = __vala_GtkTreePath_copy0 ((GtkTreePath*) _tmp4_);
	path = _tmp5_;
	_tmp6_ = path;
	if (_tmp6_ == NULL) {
		result = FALSE;
		__vala_GtkTreePath_free0 (path);
		(rows == NULL) ? NULL : (rows = (_g_list_free___vala_GtkTreePath_free0_ (rows), NULL));
		return result;
	}
	_tmp7_ = path;
	gtk_tree_view_scroll_to_cell ((GtkTreeView*) self, _tmp7_, NULL, FALSE, (gfloat) 0, (gfloat) 0);
	_tmp8_ = path;
	result = sidebar_tree_popup_context_menu (self, _tmp8_, NULL);
	__vala_GtkTreePath_free0 (path);
	(rows == NULL) ? NULL : (rows = (_g_list_free___vala_GtkTreePath_free0_ (rows), NULL));
	return result;
}

static gboolean
sidebar_tree_popup_context_menu (SidebarTree* self,
                                 GtkTreePath* path,
                                 GdkEventButton* event)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	SidebarContextable* contextable = NULL;
	SidebarTreeEntryWrapper* _tmp2_;
	SidebarEntry* _tmp3_;
	SidebarContextable* _tmp4_;
	SidebarContextable* _tmp5_;
	SidebarSelectableEntry* selectable = NULL;
	SidebarTreeEntryWrapper* _tmp6_;
	SidebarEntry* _tmp7_;
	SidebarSelectableEntry* _tmp8_;
	SidebarSelectableEntry* _tmp9_;
	GtkMenu* context_menu = NULL;
	SidebarContextable* _tmp11_;
	GtkMenu* _tmp12_;
	GtkMenu* _tmp13_;
	GtkMenu* _tmp14_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	_tmp0_ = sidebar_tree_get_wrapper_at_path (self, path);
	wrapper = _tmp0_;
	_tmp1_ = wrapper;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp2_ = wrapper;
	_tmp3_ = _tmp2_->entry;
	_tmp4_ = _g_object_ref0 (SIDEBAR_IS_CONTEXTABLE (_tmp3_) ? ((SidebarContextable*) _tmp3_) : NULL);
	contextable = _tmp4_;
	_tmp5_ = contextable;
	if (_tmp5_ == NULL) {
		result = FALSE;
		_g_object_unref0 (contextable);
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp6_ = wrapper;
	_tmp7_ = _tmp6_->entry;
	_tmp8_ = _g_object_ref0 (SIDEBAR_IS_SELECTABLE_ENTRY (_tmp7_) ? ((SidebarSelectableEntry*) _tmp7_) : NULL);
	selectable = _tmp8_;
	_tmp9_ = selectable;
	if (_tmp9_ != NULL) {
		SidebarSelectableEntry* _tmp10_;
		_tmp10_ = selectable;
		g_signal_emit (self, sidebar_tree_signals[SIDEBAR_TREE_ENTRY_SELECTED_SIGNAL], 0, _tmp10_);
	}
	_tmp11_ = contextable;
	_tmp12_ = sidebar_contextable_get_sidebar_context_menu (_tmp11_, event);
	context_menu = _tmp12_;
	_tmp13_ = context_menu;
	if (_tmp13_ == NULL) {
		result = FALSE;
		_g_object_unref0 (context_menu);
		_g_object_unref0 (selectable);
		_g_object_unref0 (contextable);
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp14_ = context_menu;
	gtk_menu_popup_at_pointer (_tmp14_, (GdkEvent*) event);
	result = TRUE;
	_g_object_unref0 (context_menu);
	_g_object_unref0 (selectable);
	_g_object_unref0 (contextable);
	_g_object_unref0 (wrapper);
	return result;
}

static void
___lambda18_ (SidebarTree* self)
{
}

static void
____lambda18__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda18_ ((SidebarTree*) self);
}

static void
___lambda98_ (SidebarTree* self)
{
}

static void
____lambda98__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda98_ ((SidebarTree*) self);
}

static gboolean
sidebar_tree_popup_default_context_menu (SidebarTree* self,
                                         GdkEventButton* event)
{
	GtkMenu* _tmp0_;
	GtkMenu* _tmp11_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = self->priv->default_context_menu;
	if (_tmp0_ == NULL) {
		GtkMenu* _tmp1_;
		GtkMenuItem* new_search_menu_item = NULL;
		GtkMenuItem* _tmp2_;
		GtkMenuItem* _tmp3_;
		GtkMenuItem* new_tag_menu_item = NULL;
		GtkMenuItem* _tmp4_;
		GtkMenuItem* _tmp5_;
		GtkMenu* _tmp6_;
		GtkMenuItem* _tmp7_;
		GtkMenu* _tmp8_;
		GtkMenuItem* _tmp9_;
		GtkMenu* _tmp10_;
		_tmp1_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp1_);
		_g_object_unref0 (self->priv->default_context_menu);
		self->priv->default_context_menu = _tmp1_;
		_tmp2_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_ ("New Smart Album…"));
		g_object_ref_sink (_tmp2_);
		new_search_menu_item = _tmp2_;
		_tmp3_ = new_search_menu_item;
		g_signal_connect_object (_tmp3_, "activate", (GCallback) ____lambda18__gtk_menu_item_activate, self, 0);
		_tmp4_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_ ("New _Tag…"));
		g_object_ref_sink (_tmp4_);
		new_tag_menu_item = _tmp4_;
		_tmp5_ = new_tag_menu_item;
		g_signal_connect_object (_tmp5_, "activate", (GCallback) ____lambda98__gtk_menu_item_activate, self, 0);
		_tmp6_ = self->priv->default_context_menu;
		_tmp7_ = new_search_menu_item;
		gtk_container_add ((GtkContainer*) _tmp6_, (GtkWidget*) _tmp7_);
		_tmp8_ = self->priv->default_context_menu;
		_tmp9_ = new_tag_menu_item;
		gtk_container_add ((GtkContainer*) _tmp8_, (GtkWidget*) _tmp9_);
		_tmp10_ = self->priv->default_context_menu;
		gtk_widget_show_all ((GtkWidget*) _tmp10_);
		_g_object_unref0 (new_tag_menu_item);
		_g_object_unref0 (new_search_menu_item);
	}
	_tmp11_ = self->priv->default_context_menu;
	gtk_menu_popup_at_pointer (_tmp11_, (GdkEvent*) event);
	result = TRUE;
	return result;
}

static gboolean
sidebar_tree_real_button_press_event (GtkWidget* base,
                                      GdkEventButton* event)
{
	SidebarTree * self;
	GtkTreePath* path = NULL;
	GtkTreePath* _tmp0_;
	gboolean _tmp1_ = FALSE;
	GtkTreePath* _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean result;
	self = (SidebarTree*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = sidebar_tree_get_path_from_event (self, event);
	path = _tmp0_;
	_tmp2_ = path;
	if (_tmp2_ == NULL) {
		_tmp1_ = event->button != ((guint) 3);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		result = TRUE;
		__vala_GtkTreePath_free0 (path);
		return result;
	}
	if (event->button == ((guint) 3)) {
		_tmp3_ = event->type == GDK_BUTTON_PRESS;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		GtkTreePath* _tmp4_;
		_tmp4_ = path;
		if (_tmp4_ != NULL) {
			GtkTreePath* _tmp5_;
			_tmp5_ = path;
			sidebar_tree_popup_context_menu (self, _tmp5_, event);
		} else {
			sidebar_tree_popup_default_context_menu (self, event);
		}
	} else {
		gboolean _tmp6_ = FALSE;
		if (event->button == ((guint) 1)) {
			_tmp6_ = event->type == GDK_2BUTTON_PRESS;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			GtkTreePath* _tmp7_;
			_tmp7_ = path;
			if (_tmp7_ != NULL) {
				GtkTreePath* _tmp8_;
				GtkTreePath* _tmp9_;
				_tmp8_ = path;
				sidebar_tree_toggle_branch_expansion (self, _tmp8_, FALSE);
				_tmp9_ = path;
				if (sidebar_tree_can_rename_path (self, _tmp9_)) {
					result = FALSE;
					__vala_GtkTreePath_free0 (path);
					return result;
				}
			}
		} else {
			gboolean _tmp10_ = FALSE;
			if (event->button == ((guint) 1)) {
				_tmp10_ = event->type == GDK_BUTTON_PRESS;
			} else {
				_tmp10_ = FALSE;
			}
			if (_tmp10_) {
				gboolean _tmp11_ = FALSE;
				gboolean _tmp12_ = FALSE;
				GtkTreeRowReference* _tmp13_;
				gboolean _tmp22_ = FALSE;
				GtkTreePath* _tmp23_;
				GtkTreeRowReference* _tmp29_ = NULL;
				GtkTreePath* _tmp30_;
				GtkTreeRowReference* _tmp34_;
				_tmp13_ = self->priv->old_path_ref;
				if (_tmp13_ != NULL) {
					GtkTreeRowReference* _tmp14_;
					GtkTreePath* _tmp15_;
					GtkTreePath* _tmp16_;
					_tmp14_ = self->priv->old_path_ref;
					_tmp15_ = gtk_tree_row_reference_get_path (_tmp14_);
					_tmp16_ = _tmp15_;
					_tmp12_ = _tmp16_ != NULL;
					__vala_GtkTreePath_free0 (_tmp16_);
				} else {
					_tmp12_ = FALSE;
				}
				if (_tmp12_) {
					GtkTreeRowReference* _tmp17_;
					GtkTreePath* _tmp18_;
					GtkTreePath* _tmp19_;
					GtkTreePath* _tmp20_;
					_tmp17_ = self->priv->old_path_ref;
					_tmp18_ = gtk_tree_row_reference_get_path (_tmp17_);
					_tmp19_ = _tmp18_;
					_tmp20_ = path;
					_tmp11_ = gtk_tree_path_compare (_tmp19_, _tmp20_) == 0;
					__vala_GtkTreePath_free0 (_tmp19_);
				} else {
					_tmp11_ = FALSE;
				}
				if (_tmp11_) {
					GtkCellRendererText* _tmp21_;
					_tmp21_ = self->priv->text_renderer;
					g_object_set (_tmp21_, "editable", FALSE, NULL);
					result = GTK_WIDGET_CLASS (sidebar_tree_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
					__vala_GtkTreePath_free0 (path);
					return result;
				}
				_tmp23_ = path;
				if (_tmp23_ != NULL) {
					GtkTreePath* _tmp24_;
					SidebarTreeEntryWrapper* _tmp25_;
					SidebarTreeEntryWrapper* _tmp26_;
					SidebarEntry* _tmp27_;
					_tmp24_ = path;
					_tmp25_ = sidebar_tree_get_wrapper_at_path (self, _tmp24_);
					_tmp26_ = _tmp25_;
					_tmp27_ = _tmp26_->entry;
					_tmp22_ = SIDEBAR_IS_RENAMEABLE_ENTRY (_tmp27_);
					_g_object_unref0 (_tmp26_);
				} else {
					_tmp22_ = FALSE;
				}
				if (_tmp22_) {
					GtkCellRendererText* _tmp28_;
					_tmp28_ = self->priv->text_renderer;
					g_object_set (_tmp28_, "editable", TRUE, NULL);
				}
				_tmp30_ = path;
				if (_tmp30_ != NULL) {
					GtkTreeStore* _tmp31_;
					GtkTreePath* _tmp32_;
					GtkTreeRowReference* _tmp33_;
					_tmp31_ = self->priv->store;
					_tmp32_ = path;
					_tmp33_ = gtk_tree_row_reference_new ((GtkTreeModel*) _tmp31_, _tmp32_);
					__vala_GtkTreeRowReference_free0 (_tmp29_);
					_tmp29_ = _tmp33_;
				} else {
					__vala_GtkTreeRowReference_free0 (_tmp29_);
					_tmp29_ = NULL;
				}
				_tmp34_ = _tmp29_;
				_tmp29_ = NULL;
				__vala_GtkTreeRowReference_free0 (self->priv->old_path_ref);
				self->priv->old_path_ref = _tmp34_;
				__vala_GtkTreeRowReference_free0 (_tmp29_);
			}
		}
	}
	result = GTK_WIDGET_CLASS (sidebar_tree_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
	__vala_GtkTreePath_free0 (path);
	return result;
}

gboolean
sidebar_tree_is_keypress_interpreted (SidebarTree* self,
                                      GdkEventKey* event)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	static GQuark _tmp2_label2 = 0;
	static GQuark _tmp2_label3 = 0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = gdk_keyval_name (event->keyval);
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	if ((((_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("F2")))) || (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("Delete"))))) || (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("Return"))))) || (_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("KP_Enter"))))) {
		switch (0) {
			default:
			{
				result = TRUE;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = FALSE;
				return result;
			}
		}
	}
}

static gboolean
sidebar_tree_real_key_press_event (GtkWidget* base,
                                   GdkEventKey* event)
{
	SidebarTree * self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	static GQuark _tmp2_label2 = 0;
	static GQuark _tmp2_label3 = 0;
	gboolean result;
	self = (SidebarTree*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = gdk_keyval_name (event->keyval);
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	if ((_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("Return")))) || (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("KP_Enter"))))) {
		switch (0) {
			default:
			{
				GtkTreePath* path = NULL;
				GtkTreePath* _tmp4_;
				GtkTreePath* _tmp5_;
				_tmp4_ = sidebar_tree_get_current_path (self);
				path = _tmp4_;
				_tmp5_ = path;
				if (_tmp5_ != NULL) {
					GtkTreePath* _tmp6_;
					_tmp6_ = path;
					sidebar_tree_toggle_branch_expansion (self, _tmp6_, FALSE);
				}
				result = TRUE;
				__vala_GtkTreePath_free0 (path);
				return result;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("F2")))) {
		switch (0) {
			default:
			{
				result = sidebar_tree_rename_in_place (self);
				return result;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("Delete")))) {
		switch (0) {
			default:
			{
				GtkTreePath* path = NULL;
				GtkTreePath* _tmp7_;
				gboolean _tmp8_ = FALSE;
				GtkTreePath* _tmp9_;
				_tmp7_ = sidebar_tree_get_current_path (self);
				path = _tmp7_;
				_tmp9_ = path;
				if (_tmp9_ != NULL) {
					GtkTreePath* _tmp10_;
					_tmp10_ = path;
					_tmp8_ = sidebar_tree_destroy_path (self, _tmp10_);
				} else {
					_tmp8_ = FALSE;
				}
				result = _tmp8_;
				__vala_GtkTreePath_free0 (path);
				return result;
			}
		}
	}
	result = GTK_WIDGET_CLASS (sidebar_tree_parent_class)->key_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
	return result;
}

gboolean
sidebar_tree_rename_entry_in_place (SidebarTree* self,
                                    SidebarEntry* entry)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	if (!sidebar_tree_expand_to_entry (self, entry)) {
		result = FALSE;
		return result;
	}
	if (!sidebar_tree_place_cursor (self, entry, FALSE)) {
		result = FALSE;
		return result;
	}
	result = sidebar_tree_rename_in_place (self);
	return result;
}

static gboolean
sidebar_tree_rename_in_place (SidebarTree* self)
{
	GtkTreePath* cursor_path = NULL;
	GtkTreeViewColumn* cursor_column = NULL;
	GtkTreePath* _tmp0_ = NULL;
	GtkTreeViewColumn* _tmp1_ = NULL;
	GtkTreeViewColumn* _tmp2_;
	GtkTreePath* _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	gtk_tree_view_get_cursor ((GtkTreeView*) self, &_tmp0_, &_tmp1_);
	__vala_GtkTreePath_free0 (cursor_path);
	cursor_path = _tmp0_;
	_g_object_unref0 (cursor_column);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	cursor_column = _tmp2_;
	_tmp3_ = cursor_path;
	if (sidebar_tree_can_rename_path (self, _tmp3_)) {
		GtkTreePath* _tmp4_;
		GtkTreeViewColumn* _tmp5_;
		_tmp4_ = cursor_path;
		_tmp5_ = cursor_column;
		gtk_tree_view_set_cursor ((GtkTreeView*) self, _tmp4_, _tmp5_, TRUE);
		result = TRUE;
		_g_object_unref0 (cursor_column);
		__vala_GtkTreePath_free0 (cursor_path);
		return result;
	}
	result = FALSE;
	_g_object_unref0 (cursor_column);
	__vala_GtkTreePath_free0 (cursor_path);
	return result;
}

gboolean
sidebar_tree_scroll_to_entry (SidebarTree* self,
                              SidebarEntry* entry)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	SidebarTreeEntryWrapper* _tmp2_;
	GtkTreePath* _tmp3_;
	GtkTreePath* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	_tmp0_ = sidebar_tree_get_wrapper (self, entry);
	wrapper = _tmp0_;
	_tmp1_ = wrapper;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp2_ = wrapper;
	_tmp3_ = sidebar_tree_entry_wrapper_get_path (_tmp2_);
	_tmp4_ = _tmp3_;
	gtk_tree_view_scroll_to_cell ((GtkTreeView*) self, _tmp4_, NULL, FALSE, (gfloat) 0, (gfloat) 0);
	__vala_GtkTreePath_free0 (_tmp4_);
	result = TRUE;
	_g_object_unref0 (wrapper);
	return result;
}

static void
sidebar_tree_real_drag_data_get (GtkWidget* base,
                                 GdkDragContext* context,
                                 GtkSelectionData* selection_data,
                                 guint info,
                                 guint time)
{
	SidebarTree * self;
	SidebarInternalDragSourceEntry* drag_source = NULL;
	SidebarEntry* _tmp0_;
	SidebarInternalDragSourceEntry* _tmp6_;
	SidebarInternalDragSourceEntry* _tmp16_;
	self = (SidebarTree*) base;
	g_return_if_fail (context != NULL);
	g_return_if_fail (selection_data != NULL);
	drag_source = NULL;
	_tmp0_ = self->priv->internal_drag_source_entry;
	if (_tmp0_ != NULL) {
		SidebarSelectableEntry* selectable = NULL;
		SidebarEntry* _tmp1_;
		SidebarSelectableEntry* _tmp2_;
		SidebarSelectableEntry* _tmp3_;
		_tmp1_ = self->priv->internal_drag_source_entry;
		_tmp2_ = _g_object_ref0 (SIDEBAR_IS_SELECTABLE_ENTRY (_tmp1_) ? ((SidebarSelectableEntry*) _tmp1_) : NULL);
		selectable = _tmp2_;
		_tmp3_ = selectable;
		if (_tmp3_ == NULL) {
			SidebarEntry* _tmp4_;
			SidebarInternalDragSourceEntry* _tmp5_;
			_tmp4_ = self->priv->internal_drag_source_entry;
			_tmp5_ = _g_object_ref0 (SIDEBAR_IS_INTERNAL_DRAG_SOURCE_ENTRY (_tmp4_) ? ((SidebarInternalDragSourceEntry*) _tmp4_) : NULL);
			_g_object_unref0 (drag_source);
			drag_source = _tmp5_;
		}
		_g_object_unref0 (selectable);
	}
	_tmp6_ = drag_source;
	if (_tmp6_ == NULL) {
		GtkTreePath* selected_path = NULL;
		GtkTreePath* _tmp7_;
		GtkTreePath* _tmp8_;
		SidebarTreeEntryWrapper* wrapper = NULL;
		GtkTreePath* _tmp9_;
		SidebarTreeEntryWrapper* _tmp10_;
		SidebarTreeEntryWrapper* _tmp11_;
		SidebarTreeEntryWrapper* _tmp12_;
		SidebarEntry* _tmp13_;
		SidebarInternalDragSourceEntry* _tmp14_;
		SidebarInternalDragSourceEntry* _tmp15_;
		_tmp7_ = sidebar_tree_get_selected_path (self);
		selected_path = _tmp7_;
		_tmp8_ = selected_path;
		if (_tmp8_ == NULL) {
			__vala_GtkTreePath_free0 (selected_path);
			_g_object_unref0 (drag_source);
			return;
		}
		_tmp9_ = selected_path;
		_tmp10_ = sidebar_tree_get_wrapper_at_path (self, _tmp9_);
		wrapper = _tmp10_;
		_tmp11_ = wrapper;
		if (_tmp11_ == NULL) {
			_g_object_unref0 (wrapper);
			__vala_GtkTreePath_free0 (selected_path);
			_g_object_unref0 (drag_source);
			return;
		}
		_tmp12_ = wrapper;
		_tmp13_ = _tmp12_->entry;
		_tmp14_ = _g_object_ref0 (SIDEBAR_IS_INTERNAL_DRAG_SOURCE_ENTRY (_tmp13_) ? ((SidebarInternalDragSourceEntry*) _tmp13_) : NULL);
		_g_object_unref0 (drag_source);
		drag_source = _tmp14_;
		_tmp15_ = drag_source;
		if (_tmp15_ == NULL) {
			_g_object_unref0 (wrapper);
			__vala_GtkTreePath_free0 (selected_path);
			_g_object_unref0 (drag_source);
			return;
		}
		_g_object_unref0 (wrapper);
		__vala_GtkTreePath_free0 (selected_path);
	}
	_tmp16_ = drag_source;
	sidebar_internal_drag_source_entry_prepare_selection_data (_tmp16_, selection_data);
	_g_object_unref0 (drag_source);
}

static void
sidebar_tree_real_drag_data_received (GtkWidget* base,
                                      GdkDragContext* context,
                                      gint x,
                                      gint y,
                                      GtkSelectionData* selection_data,
                                      guint info,
                                      guint time)
{
	SidebarTree * self;
	GtkTreePath* path = NULL;
	GtkTreeViewDropPosition pos = 0;
	GtkTreePath* _tmp0_ = NULL;
	GtkTreeViewDropPosition _tmp1_ = 0;
	gboolean _tmp2_;
	SidebarTreeEntryWrapper* wrapper = NULL;
	GtkTreePath* _tmp5_;
	SidebarTreeEntryWrapper* _tmp6_;
	GtkWidget* _tmp7_;
	SidebarTreeEntryWrapper* _tmp13_;
	SidebarInternalDropTargetEntry* targetable = NULL;
	SidebarTreeEntryWrapper* _tmp14_;
	SidebarEntry* _tmp15_;
	SidebarInternalDropTargetEntry* _tmp16_;
	SidebarInternalDropTargetEntry* _tmp17_;
	gboolean success = FALSE;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gboolean _tmp20_;
	self = (SidebarTree*) base;
	g_return_if_fail (context != NULL);
	g_return_if_fail (selection_data != NULL);
	_tmp2_ = gtk_tree_view_get_dest_row_at_pos ((GtkTreeView*) self, x, y, &_tmp0_, &_tmp1_);
	__vala_GtkTreePath_free0 (path);
	path = _tmp0_;
	pos = _tmp1_;
	if (!_tmp2_) {
		GtkWidget* _tmp3_;
		_tmp3_ = gtk_drag_get_source_widget (context);
		if (_tmp3_ == NULL) {
			SidebarTreeExternalDropHandler _tmp4_;
			gpointer _tmp4__target;
			_tmp4_ = self->priv->drop_handler;
			_tmp4__target = self->priv->drop_handler_target;
			_tmp4_ (context, NULL, selection_data, info, time, _tmp4__target);
		} else {
			gtk_drag_finish (context, FALSE, FALSE, (guint32) time);
		}
		__vala_GtkTreePath_free0 (path);
		return;
	}
	_tmp5_ = path;
	_tmp6_ = sidebar_tree_get_wrapper_at_path (self, _tmp5_);
	wrapper = _tmp6_;
	_tmp7_ = gtk_drag_get_source_widget (context);
	if (_tmp7_ == NULL) {
		SidebarEntry* _tmp8_ = NULL;
		SidebarTreeEntryWrapper* _tmp9_;
		SidebarTreeExternalDropHandler _tmp12_;
		gpointer _tmp12__target;
		_tmp9_ = wrapper;
		if (_tmp9_ != NULL) {
			SidebarTreeEntryWrapper* _tmp10_;
			SidebarEntry* _tmp11_;
			_tmp10_ = wrapper;
			_tmp11_ = _tmp10_->entry;
			_tmp8_ = _tmp11_;
		} else {
			_tmp8_ = NULL;
		}
		_tmp12_ = self->priv->drop_handler;
		_tmp12__target = self->priv->drop_handler_target;
		_tmp12_ (context, _tmp8_, selection_data, info, time, _tmp12__target);
		_g_object_unref0 (wrapper);
		__vala_GtkTreePath_free0 (path);
		return;
	}
	_tmp13_ = wrapper;
	if (_tmp13_ == NULL) {
		gtk_drag_finish (context, FALSE, FALSE, (guint32) time);
		_g_object_unref0 (wrapper);
		__vala_GtkTreePath_free0 (path);
		return;
	}
	_tmp14_ = wrapper;
	_tmp15_ = _tmp14_->entry;
	_tmp16_ = _g_object_ref0 (SIDEBAR_IS_INTERNAL_DROP_TARGET_ENTRY (_tmp15_) ? ((SidebarInternalDropTargetEntry*) _tmp15_) : NULL);
	targetable = _tmp16_;
	_tmp17_ = targetable;
	if (_tmp17_ == NULL) {
		gtk_drag_finish (context, FALSE, FALSE, (guint32) time);
		_g_object_unref0 (targetable);
		_g_object_unref0 (wrapper);
		__vala_GtkTreePath_free0 (path);
		return;
	}
	success = FALSE;
	_tmp18_ = gdk_atom_name (gtk_selection_data_get_data_type (selection_data));
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strcmp0 (_tmp19_, LIBRARY_WINDOW_TAG_PATH_MIME_TYPE) == 0;
	_g_free0 (_tmp19_);
	if (_tmp20_) {
		SidebarInternalDropTargetEntry* _tmp21_;
		_tmp21_ = targetable;
		success = sidebar_internal_drop_target_entry_internal_drop_received_arbitrary (_tmp21_, selection_data);
	} else {
		GeeList* media = NULL;
		guint8* _tmp22_;
		GeeList* _tmp23_;
		gboolean _tmp24_ = FALSE;
		GeeList* _tmp25_;
		_tmp22_ = gtk_selection_data_get_data (selection_data);
		_tmp23_ = unserialize_media_sources (_tmp22_, gtk_selection_data_get_length (selection_data));
		media = _tmp23_;
		_tmp25_ = media;
		if (_tmp25_ != NULL) {
			GeeList* _tmp26_;
			gint _tmp27_;
			gint _tmp28_;
			_tmp26_ = media;
			_tmp27_ = gee_collection_get_size ((GeeCollection*) _tmp26_);
			_tmp28_ = _tmp27_;
			_tmp24_ = _tmp28_ > 0;
		} else {
			_tmp24_ = FALSE;
		}
		if (_tmp24_) {
			SidebarInternalDropTargetEntry* _tmp29_;
			GeeList* _tmp30_;
			_tmp29_ = targetable;
			_tmp30_ = media;
			success = sidebar_internal_drop_target_entry_internal_drop_received (_tmp29_, _tmp30_);
		}
		_g_object_unref0 (media);
	}
	gtk_drag_finish (context, success, FALSE, (guint32) time);
	_g_object_unref0 (targetable);
	_g_object_unref0 (wrapper);
	__vala_GtkTreePath_free0 (path);
}

static gboolean
sidebar_tree_real_drag_motion (GtkWidget* base,
                               GdkDragContext* context,
                               gint x,
                               gint y,
                               guint time)
{
	SidebarTree * self;
	GtkTreePath* path = NULL;
	GtkTreeViewDropPosition pos = 0;
	gboolean has_dest = FALSE;
	GtkTreePath* _tmp0_ = NULL;
	GtkTreeViewDropPosition _tmp1_ = 0;
	gboolean _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean result;
	self = (SidebarTree*) base;
	g_return_val_if_fail (context != NULL, FALSE);
	GTK_WIDGET_CLASS (sidebar_tree_parent_class)->drag_motion ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), context, x, y, time);
	_tmp2_ = gtk_tree_view_get_dest_row_at_pos ((GtkTreeView*) self, x, y, &_tmp0_, &_tmp1_);
	__vala_GtkTreePath_free0 (path);
	path = _tmp0_;
	pos = _tmp1_;
	has_dest = _tmp2_;
	if (!has_dest) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = pos == GTK_TREE_VIEW_DROP_BEFORE;
	}
	if (_tmp3_) {
		GtkTreePath* _tmp4_;
		_tmp4_ = path;
		gtk_tree_view_set_drag_dest_row ((GtkTreeView*) self, _tmp4_, GTK_TREE_VIEW_DROP_INTO_OR_BEFORE);
	} else {
		if (pos == GTK_TREE_VIEW_DROP_AFTER) {
			GtkTreePath* _tmp5_;
			_tmp5_ = path;
			gtk_tree_view_set_drag_dest_row ((GtkTreeView*) self, _tmp5_, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
		}
	}
	gdk_drag_status (context, gdk_drag_context_get_suggested_action (context), (guint32) time);
	result = has_dest;
	__vala_GtkTreePath_free0 (path);
	return result;
}

static gboolean
sidebar_tree_can_rename_path (SidebarTree* self,
                              GtkTreePath* path)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	SidebarRenameableEntry* renameable = NULL;
	SidebarTreeEntryWrapper* _tmp2_;
	SidebarEntry* _tmp3_;
	SidebarRenameableEntry* _tmp4_;
	SidebarRenameableEntry* _tmp5_;
	GtkTreeSelection* _tmp6_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	if (self->priv->editing_disabled > 0) {
		result = FALSE;
		return result;
	}
	_tmp0_ = sidebar_tree_get_wrapper_at_path (self, path);
	wrapper = _tmp0_;
	_tmp1_ = wrapper;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp2_ = wrapper;
	_tmp3_ = _tmp2_->entry;
	_tmp4_ = _g_object_ref0 (SIDEBAR_IS_RENAMEABLE_ENTRY (_tmp3_) ? ((SidebarRenameableEntry*) _tmp3_) : NULL);
	renameable = _tmp4_;
	_tmp5_ = renameable;
	if (_tmp5_ == NULL) {
		result = FALSE;
		_g_object_unref0 (renameable);
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp6_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	gtk_tree_selection_select_path (_tmp6_, path);
	result = TRUE;
	_g_object_unref0 (renameable);
	_g_object_unref0 (wrapper);
	return result;
}

static gboolean
sidebar_tree_destroy_path (SidebarTree* self,
                           GtkTreePath* path)
{
	SidebarTreeEntryWrapper* wrapper = NULL;
	SidebarTreeEntryWrapper* _tmp0_;
	SidebarTreeEntryWrapper* _tmp1_;
	SidebarDestroyableEntry* destroyable = NULL;
	SidebarTreeEntryWrapper* _tmp2_;
	SidebarEntry* _tmp3_;
	SidebarDestroyableEntry* _tmp4_;
	SidebarDestroyableEntry* _tmp5_;
	SidebarDestroyableEntry* _tmp6_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	_tmp0_ = sidebar_tree_get_wrapper_at_path (self, path);
	wrapper = _tmp0_;
	_tmp1_ = wrapper;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp2_ = wrapper;
	_tmp3_ = _tmp2_->entry;
	_tmp4_ = _g_object_ref0 (SIDEBAR_IS_DESTROYABLE_ENTRY (_tmp3_) ? ((SidebarDestroyableEntry*) _tmp3_) : NULL);
	destroyable = _tmp4_;
	_tmp5_ = destroyable;
	if (_tmp5_ == NULL) {
		result = FALSE;
		_g_object_unref0 (destroyable);
		_g_object_unref0 (wrapper);
		return result;
	}
	_tmp6_ = destroyable;
	sidebar_destroyable_entry_destroy_source (_tmp6_);
	result = TRUE;
	_g_object_unref0 (destroyable);
	_g_object_unref0 (wrapper);
	return result;
}

static void
_sidebar_tree_on_editing_done_gtk_cell_editable_editing_done (GtkCellEditable* _sender,
                                                              gpointer self)
{
	sidebar_tree_on_editing_done ((SidebarTree*) self);
}

static gboolean
_sidebar_tree_on_editing_focus_out_gtk_widget_focus_out_event (GtkWidget* _sender,
                                                               GdkEventFocus* event,
                                                               gpointer self)
{
	gboolean result;
	result = sidebar_tree_on_editing_focus_out ((SidebarTree*) self, event);
	return result;
}

static void
sidebar_tree_on_editing_started (SidebarTree* self,
                                 GtkCellEditable* editable,
                                 const gchar* path)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (editable != NULL);
	g_return_if_fail (path != NULL);
	if (G_TYPE_CHECK_INSTANCE_TYPE (editable, gtk_entry_get_type ())) {
		GtkEntry* _tmp0_;
		GtkEntry* _tmp1_;
		GtkEntry* _tmp2_;
		GtkEntry* _tmp3_;
		_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (editable, gtk_entry_get_type (), GtkEntry));
		_g_object_unref0 (self->priv->text_entry);
		self->priv->text_entry = _tmp0_;
		_tmp1_ = self->priv->text_entry;
		g_signal_connect_object ((GtkCellEditable*) _tmp1_, "editing-done", (GCallback) _sidebar_tree_on_editing_done_gtk_cell_editable_editing_done, self, 0);
		_tmp2_ = self->priv->text_entry;
		g_signal_connect_object ((GtkWidget*) _tmp2_, "focus-out-event", (GCallback) _sidebar_tree_on_editing_focus_out_gtk_widget_focus_out_event, self, 0);
		_tmp3_ = self->priv->text_entry;
		g_object_set (_tmp3_, "editable", TRUE, NULL);
	}
}

static void
sidebar_tree_on_editing_canceled (SidebarTree* self)
{
	GtkEntry* _tmp0_;
	GtkEntry* _tmp1_;
	guint _tmp2_;
	GtkEntry* _tmp3_;
	guint _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->text_entry;
	g_object_set (_tmp0_, "editable", FALSE, NULL);
	_tmp1_ = self->priv->text_entry;
	g_signal_parse_name ("editing-done", gtk_cell_editable_get_type (), &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkCellEditable*) _tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _sidebar_tree_on_editing_done_gtk_cell_editable_editing_done, self);
	_tmp3_ = self->priv->text_entry;
	g_signal_parse_name ("focus-out-event", gtk_widget_get_type (), &_tmp4_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _sidebar_tree_on_editing_focus_out_gtk_widget_focus_out_event, self);
}

static void
sidebar_tree_on_editing_done (SidebarTree* self)
{
	GtkEntry* _tmp0_;
	SidebarTreeEntryWrapper* wrapper = NULL;
	GtkTreePath* _tmp1_;
	GtkTreePath* _tmp2_;
	SidebarTreeEntryWrapper* _tmp3_;
	SidebarTreeEntryWrapper* _tmp4_;
	SidebarTreeEntryWrapper* _tmp5_;
	GtkEntry* _tmp13_;
	guint _tmp14_;
	GtkEntry* _tmp15_;
	guint _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->text_entry;
	g_object_set (_tmp0_, "editable", FALSE, NULL);
	_tmp1_ = sidebar_tree_get_current_path (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = sidebar_tree_get_wrapper_at_path (self, _tmp2_);
	_tmp4_ = _tmp3_;
	__vala_GtkTreePath_free0 (_tmp2_);
	wrapper = _tmp4_;
	_tmp5_ = wrapper;
	if (_tmp5_ != NULL) {
		SidebarRenameableEntry* renameable = NULL;
		SidebarTreeEntryWrapper* _tmp6_;
		SidebarEntry* _tmp7_;
		SidebarRenameableEntry* _tmp8_;
		SidebarRenameableEntry* _tmp9_;
		_tmp6_ = wrapper;
		_tmp7_ = _tmp6_->entry;
		_tmp8_ = _g_object_ref0 (SIDEBAR_IS_RENAMEABLE_ENTRY (_tmp7_) ? ((SidebarRenameableEntry*) _tmp7_) : NULL);
		renameable = _tmp8_;
		_tmp9_ = renameable;
		if (_tmp9_ != NULL) {
			SidebarRenameableEntry* _tmp10_;
			GtkEntry* _tmp11_;
			const gchar* _tmp12_;
			_tmp10_ = renameable;
			_tmp11_ = self->priv->text_entry;
			_tmp12_ = gtk_entry_get_text (_tmp11_);
			sidebar_renameable_entry_rename (_tmp10_, _tmp12_);
		}
		_g_object_unref0 (renameable);
	}
	_tmp13_ = self->priv->text_entry;
	g_signal_parse_name ("editing-done", gtk_cell_editable_get_type (), &_tmp14_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkCellEditable*) _tmp13_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp14_, 0, NULL, (GCallback) _sidebar_tree_on_editing_done_gtk_cell_editable_editing_done, self);
	_tmp15_ = self->priv->text_entry;
	g_signal_parse_name ("focus-out-event", gtk_widget_get_type (), &_tmp16_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp15_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp16_, 0, NULL, (GCallback) _sidebar_tree_on_editing_focus_out_gtk_widget_focus_out_event, self);
	_g_object_unref0 (wrapper);
}

static gboolean
sidebar_tree_on_editing_focus_out (SidebarTree* self,
                                   GdkEventFocus* event)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	result = FALSE;
	return result;
}

static void
sidebar_tree_on_new_search (SidebarTree* self)
{
	SavedSearchDialog* _tmp0_;
	SavedSearchDialog* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = saved_search_dialog_new ();
	_tmp1_ = _tmp0_;
	saved_search_dialog_show (_tmp1_);
	_g_object_unref0 (_tmp1_);
}

static void
sidebar_tree_on_new_tag (SidebarTree* self)
{
	NewRootTagCommand* creation_command = NULL;
	NewRootTagCommand* _tmp0_;
	CommandManager* _tmp1_;
	CommandManager* _tmp2_;
	LibraryWindow* _tmp3_;
	LibraryWindow* _tmp4_;
	Tag* _tmp5_;
	Tag* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = new_root_tag_command_new ();
	creation_command = _tmp0_;
	_tmp1_ = app_window_get_command_manager ();
	_tmp2_ = _tmp1_;
	command_manager_execute (_tmp2_, (Command*) creation_command);
	_command_manager_unref0 (_tmp2_);
	_tmp3_ = library_window_get_app ();
	_tmp4_ = _tmp3_;
	_tmp5_ = new_root_tag_command_get_created_tag (creation_command);
	_tmp6_ = _tmp5_;
	library_window_rename_tag_in_sidebar (_tmp4_, _tmp6_);
	_g_object_unref0 (_tmp6_);
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (creation_command);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_BOOLEAN) (gpointer data1, gpointer arg_1, gboolean arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_BOOLEAN 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_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_boolean (param_values + 2), data2);
}

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 SidebarTreeEntryWrapper*
sidebar_tree_entry_wrapper_construct (GType object_type,
                                      GtkTreeModel* model,
                                      SidebarEntry* entry,
                                      GtkTreePath* path)
{
	SidebarTreeEntryWrapper * self = NULL;
	SidebarEntry* _tmp0_;
	GtkTreeRowReference* _tmp1_;
	g_return_val_if_fail (model != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	g_return_val_if_fail (path != NULL, NULL);
	self = (SidebarTreeEntryWrapper*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (entry);
	_g_object_unref0 (self->entry);
	self->entry = _tmp0_;
	_tmp1_ = gtk_tree_row_reference_new (model, path);
	__vala_GtkTreeRowReference_free0 (self->row);
	self->row = _tmp1_;
	return self;
}

static SidebarTreeEntryWrapper*
sidebar_tree_entry_wrapper_new (GtkTreeModel* model,
                                SidebarEntry* entry,
                                GtkTreePath* path)
{
	return sidebar_tree_entry_wrapper_construct (SIDEBAR_TREE_TYPE_ENTRY_WRAPPER, model, entry, path);
}

static GtkTreePath*
sidebar_tree_entry_wrapper_get_path (SidebarTreeEntryWrapper* self)
{
	GtkTreeRowReference* _tmp0_;
	GtkTreePath* _tmp1_;
	GtkTreePath* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->row;
	_tmp1_ = gtk_tree_row_reference_get_path (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
sidebar_tree_entry_wrapper_get_iter (SidebarTreeEntryWrapper* self,
                                     GtkTreeIter* result)
{
	GtkTreeIter iter = {0};
	gboolean valid = FALSE;
	GtkTreeRowReference* _tmp0_;
	GtkTreeModel* _tmp1_;
	GtkTreePath* _tmp2_;
	GtkTreePath* _tmp3_;
	GtkTreeIter _tmp4_ = {0};
	gboolean _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->row;
	_tmp1_ = gtk_tree_row_reference_get_model (_tmp0_);
	_tmp2_ = sidebar_tree_entry_wrapper_get_path (self);
	_tmp3_ = _tmp2_;
	_tmp5_ = gtk_tree_model_get_iter (_tmp1_, &_tmp4_, _tmp3_);
	iter = _tmp4_;
	_tmp6_ = _tmp5_;
	__vala_GtkTreePath_free0 (_tmp3_);
	valid = _tmp6_;
	_vala_assert (valid, "valid");
	*result = iter;
	return;
}

static void
sidebar_tree_entry_wrapper_class_init (SidebarTreeEntryWrapperClass * klass,
                                       gpointer klass_data)
{
	sidebar_tree_entry_wrapper_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = sidebar_tree_entry_wrapper_finalize;
}

static void
sidebar_tree_entry_wrapper_instance_init (SidebarTreeEntryWrapper * self,
                                          gpointer klass)
{
}

static void
sidebar_tree_entry_wrapper_finalize (GObject * obj)
{
	SidebarTreeEntryWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDEBAR_TREE_TYPE_ENTRY_WRAPPER, SidebarTreeEntryWrapper);
	_g_object_unref0 (self->entry);
	__vala_GtkTreeRowReference_free0 (self->row);
	G_OBJECT_CLASS (sidebar_tree_entry_wrapper_parent_class)->finalize (obj);
}

static GType
sidebar_tree_entry_wrapper_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SidebarTreeEntryWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sidebar_tree_entry_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SidebarTreeEntryWrapper), 0, (GInstanceInitFunc) sidebar_tree_entry_wrapper_instance_init, NULL };
	GType sidebar_tree_entry_wrapper_type_id;
	sidebar_tree_entry_wrapper_type_id = g_type_register_static (G_TYPE_OBJECT, "SidebarTreeEntryWrapper", &g_define_type_info, 0);
	return sidebar_tree_entry_wrapper_type_id;
}

static GType
sidebar_tree_entry_wrapper_get_type (void)
{
	static volatile gsize sidebar_tree_entry_wrapper_type_id__once = 0;
	if (g_once_init_enter (&sidebar_tree_entry_wrapper_type_id__once)) {
		GType sidebar_tree_entry_wrapper_type_id;
		sidebar_tree_entry_wrapper_type_id = sidebar_tree_entry_wrapper_get_type_once ();
		g_once_init_leave (&sidebar_tree_entry_wrapper_type_id__once, sidebar_tree_entry_wrapper_type_id);
	}
	return sidebar_tree_entry_wrapper_type_id__once;
}

static SidebarTreeRootWrapper*
sidebar_tree_root_wrapper_construct (GType object_type,
                                     GtkTreeModel* model,
                                     SidebarEntry* entry,
                                     GtkTreePath* path,
                                     gint root_position)
{
	SidebarTreeRootWrapper * self = NULL;
	g_return_val_if_fail (model != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	g_return_val_if_fail (path != NULL, NULL);
	_vala_return_val_if_fail (root_position >= 0, "root_position >= 0", NULL);
	self = (SidebarTreeRootWrapper*) sidebar_tree_entry_wrapper_construct (object_type, model, entry, path);
	self->root_position = root_position;
	return self;
}

static SidebarTreeRootWrapper*
sidebar_tree_root_wrapper_new (GtkTreeModel* model,
                               SidebarEntry* entry,
                               GtkTreePath* path,
                               gint root_position)
{
	return sidebar_tree_root_wrapper_construct (SIDEBAR_TREE_TYPE_ROOT_WRAPPER, model, entry, path, root_position);
}

static void
sidebar_tree_root_wrapper_class_init (SidebarTreeRootWrapperClass * klass,
                                      gpointer klass_data)
{
	sidebar_tree_root_wrapper_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = sidebar_tree_root_wrapper_finalize;
}

static void
sidebar_tree_root_wrapper_instance_init (SidebarTreeRootWrapper * self,
                                         gpointer klass)
{
}

static void
sidebar_tree_root_wrapper_finalize (GObject * obj)
{
	SidebarTreeRootWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDEBAR_TREE_TYPE_ROOT_WRAPPER, SidebarTreeRootWrapper);
	G_OBJECT_CLASS (sidebar_tree_root_wrapper_parent_class)->finalize (obj);
}

static GType
sidebar_tree_root_wrapper_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SidebarTreeRootWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sidebar_tree_root_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SidebarTreeRootWrapper), 0, (GInstanceInitFunc) sidebar_tree_root_wrapper_instance_init, NULL };
	GType sidebar_tree_root_wrapper_type_id;
	sidebar_tree_root_wrapper_type_id = g_type_register_static (SIDEBAR_TREE_TYPE_ENTRY_WRAPPER, "SidebarTreeRootWrapper", &g_define_type_info, 0);
	return sidebar_tree_root_wrapper_type_id;
}

static GType
sidebar_tree_root_wrapper_get_type (void)
{
	static volatile gsize sidebar_tree_root_wrapper_type_id__once = 0;
	if (g_once_init_enter (&sidebar_tree_root_wrapper_type_id__once)) {
		GType sidebar_tree_root_wrapper_type_id;
		sidebar_tree_root_wrapper_type_id = sidebar_tree_root_wrapper_get_type_once ();
		g_once_init_leave (&sidebar_tree_root_wrapper_type_id__once, sidebar_tree_root_wrapper_type_id);
	}
	return sidebar_tree_root_wrapper_type_id__once;
}

static void
sidebar_tree_class_init (SidebarTreeClass * klass,
                         gpointer klass_data)
{
	sidebar_tree_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SidebarTree_private_offset);
	((GtkTreeViewClass *) klass)->cursor_changed = (void (*) (GtkTreeView*)) sidebar_tree_real_cursor_changed;
	((GtkWidgetClass *) klass)->button_press_event = (gboolean (*) (GtkWidget*, GdkEventButton*)) sidebar_tree_real_button_press_event;
	((GtkWidgetClass *) klass)->key_press_event = (gboolean (*) (GtkWidget*, GdkEventKey*)) sidebar_tree_real_key_press_event;
	((GtkWidgetClass *) klass)->drag_data_get = (void (*) (GtkWidget*, GdkDragContext*, GtkSelectionData*, guint, guint)) sidebar_tree_real_drag_data_get;
	((GtkWidgetClass *) klass)->drag_data_received = (void (*) (GtkWidget*, GdkDragContext*, gint, gint, GtkSelectionData*, guint, guint)) sidebar_tree_real_drag_data_received;
	((GtkWidgetClass *) klass)->drag_motion = (gboolean (*) (GtkWidget*, GdkDragContext*, gint, gint, guint)) sidebar_tree_real_drag_motion;
	G_OBJECT_CLASS (klass)->finalize = sidebar_tree_finalize;
	sidebar_tree_signals[SIDEBAR_TREE_ENTRY_SELECTED_SIGNAL] = g_signal_new ("entry-selected", SIDEBAR_TYPE_TREE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SIDEBAR_TYPE_SELECTABLE_ENTRY);
	sidebar_tree_signals[SIDEBAR_TREE_SELECTED_ENTRY_REMOVED_SIGNAL] = g_signal_new ("selected-entry-removed", SIDEBAR_TYPE_TREE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SIDEBAR_TYPE_SELECTABLE_ENTRY);
	sidebar_tree_signals[SIDEBAR_TREE_BRANCH_ADDED_SIGNAL] = g_signal_new ("branch-added", SIDEBAR_TYPE_TREE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SIDEBAR_TYPE_BRANCH);
	sidebar_tree_signals[SIDEBAR_TREE_BRANCH_REMOVED_SIGNAL] = g_signal_new ("branch-removed", SIDEBAR_TYPE_TREE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SIDEBAR_TYPE_BRANCH);
	sidebar_tree_signals[SIDEBAR_TREE_BRANCH_SHOWN_SIGNAL] = g_signal_new ("branch-shown", SIDEBAR_TYPE_TREE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, SIDEBAR_TYPE_BRANCH, G_TYPE_BOOLEAN);
	sidebar_tree_signals[SIDEBAR_TREE_PAGE_CREATED_SIGNAL] = g_signal_new ("page-created", SIDEBAR_TYPE_TREE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, SIDEBAR_TYPE_PAGE_REPRESENTATIVE, TYPE_PAGE);
	sidebar_tree_signals[SIDEBAR_TREE_DESTROYING_PAGE_SIGNAL] = g_signal_new ("destroying-page", SIDEBAR_TYPE_TREE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, SIDEBAR_TYPE_PAGE_REPRESENTATIVE, TYPE_PAGE);
}

static void
sidebar_tree_instance_init (SidebarTree * self,
                            gpointer klass)
{
	GtkTreeStore* _tmp0_;
	GeeHashMap* _tmp1_;
	GeeHashMap* _tmp2_;
	GeeHashMap* _tmp3_;
	self->priv = sidebar_tree_get_instance_private (self);
	_tmp0_ = gtk_tree_store_new ((gint) SIDEBAR_TREE_COLUMNS_N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, SIDEBAR_TREE_TYPE_ENTRY_WRAPPER, g_icon_get_type (), gdk_pixbuf_get_type (), gdk_pixbuf_get_type (), G_TYPE_BOOLEAN);
	self->priv->store = _tmp0_;
	self->priv->text_entry = NULL;
	_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, gdk_pixbuf_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->icon_cache = _tmp1_;
	_tmp2_ = gee_hash_map_new (SIDEBAR_TYPE_ENTRY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, SIDEBAR_TREE_TYPE_ENTRY_WRAPPER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->entry_map = _tmp2_;
	_tmp3_ = gee_hash_map_new (SIDEBAR_TYPE_BRANCH, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, G_TYPE_INT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->branches = _tmp3_;
	self->priv->editing_disabled = 0;
	self->priv->mask_entry_selected_signal = FALSE;
	self->priv->selected_wrapper = NULL;
	self->priv->default_context_menu = NULL;
	self->priv->is_internal_drag_in_progress = FALSE;
	self->priv->internal_drag_source_entry = NULL;
	self->priv->old_path_ref = NULL;
}

static void
sidebar_tree_finalize (GObject * obj)
{
	SidebarTree * self;
	GtkCellRendererText* _tmp0_;
	guint _tmp1_;
	GtkCellRendererText* _tmp2_;
	guint _tmp3_;
	GtkIconTheme* _tmp4_;
	guint _tmp5_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDEBAR_TYPE_TREE, SidebarTree);
	_tmp0_ = self->priv->text_renderer;
	g_signal_parse_name ("editing-canceled", gtk_cell_renderer_get_type (), &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkCellRenderer*) _tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _sidebar_tree_on_editing_canceled_gtk_cell_renderer_editing_canceled, self);
	_tmp2_ = self->priv->text_renderer;
	g_signal_parse_name ("editing-started", gtk_cell_renderer_get_type (), &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkCellRenderer*) _tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _sidebar_tree_on_editing_started_gtk_cell_renderer_editing_started, self);
	_tmp4_ = self->priv->icon_theme;
	g_signal_parse_name ("changed", gtk_icon_theme_get_type (), &_tmp5_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _sidebar_tree_on_theme_change_gtk_icon_theme_changed, self);
	_g_object_unref0 (self->priv->store);
	_g_object_unref0 (self->priv->icon_theme);
	_g_object_unref0 (self->priv->text_renderer);
	_g_object_unref0 (self->priv->text_entry);
	_g_object_unref0 (self->priv->icon_cache);
	_g_object_unref0 (self->priv->entry_map);
	_g_object_unref0 (self->priv->branches);
	_g_object_unref0 (self->priv->default_context_menu);
	_g_object_unref0 (self->priv->internal_drag_source_entry);
	__vala_GtkTreeRowReference_free0 (self->priv->old_path_ref);
	G_OBJECT_CLASS (sidebar_tree_parent_class)->finalize (obj);
}

static GType
sidebar_tree_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SidebarTreeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sidebar_tree_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SidebarTree), 0, (GInstanceInitFunc) sidebar_tree_instance_init, NULL };
	GType sidebar_tree_type_id;
	sidebar_tree_type_id = g_type_register_static (gtk_tree_view_get_type (), "SidebarTree", &g_define_type_info, 0);
	SidebarTree_private_offset = g_type_add_instance_private (sidebar_tree_type_id, sizeof (SidebarTreePrivate));
	return sidebar_tree_type_id;
}

GType
sidebar_tree_get_type (void)
{
	static volatile gsize sidebar_tree_type_id__once = 0;
	if (g_once_init_enter (&sidebar_tree_type_id__once)) {
		GType sidebar_tree_type_id;
		sidebar_tree_type_id = sidebar_tree_get_type_once ();
		g_once_init_leave (&sidebar_tree_type_id__once, sidebar_tree_type_id);
	}
	return sidebar_tree_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;
}

