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

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include <glib-object.h>
#include <gee.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define SIDEBAR_TYPE_BRANCH (sidebar_branch_get_type ())
#define SIDEBAR_BRANCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_BRANCH, SidebarBranch))
#define SIDEBAR_BRANCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDEBAR_TYPE_BRANCH, SidebarBranchClass))
#define SIDEBAR_IS_BRANCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_BRANCH))
#define SIDEBAR_IS_BRANCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDEBAR_TYPE_BRANCH))
#define SIDEBAR_BRANCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDEBAR_TYPE_BRANCH, SidebarBranchClass))

typedef struct _SidebarBranch SidebarBranch;
typedef struct _SidebarBranchClass SidebarBranchClass;
typedef struct _SidebarBranchPrivate SidebarBranchPrivate;

#define FOLDERS_TYPE_BRANCH (folders_branch_get_type ())
#define FOLDERS_BRANCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLDERS_TYPE_BRANCH, FoldersBranch))
#define FOLDERS_BRANCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLDERS_TYPE_BRANCH, FoldersBranchClass))
#define FOLDERS_IS_BRANCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLDERS_TYPE_BRANCH))
#define FOLDERS_IS_BRANCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLDERS_TYPE_BRANCH))
#define FOLDERS_BRANCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLDERS_TYPE_BRANCH, FoldersBranchClass))

typedef struct _FoldersBranch FoldersBranch;
typedef struct _FoldersBranchClass FoldersBranchClass;
typedef struct _FoldersBranchPrivate FoldersBranchPrivate;

#define SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY (sidebar_simple_page_entry_get_type ())
#define SIDEBAR_SIMPLE_PAGE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, SidebarSimplePageEntry))
#define SIDEBAR_SIMPLE_PAGE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, SidebarSimplePageEntryClass))
#define SIDEBAR_IS_SIMPLE_PAGE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY))
#define SIDEBAR_IS_SIMPLE_PAGE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY))
#define SIDEBAR_SIMPLE_PAGE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, SidebarSimplePageEntryClass))

typedef struct _SidebarSimplePageEntry SidebarSimplePageEntry;
typedef struct _SidebarSimplePageEntryClass SidebarSimplePageEntryClass;

#define FOLDERS_TYPE_SIDEBAR_ENTRY (folders_sidebar_entry_get_type ())
#define FOLDERS_SIDEBAR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry))
#define FOLDERS_SIDEBAR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntryClass))
#define FOLDERS_IS_SIDEBAR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLDERS_TYPE_SIDEBAR_ENTRY))
#define FOLDERS_IS_SIDEBAR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLDERS_TYPE_SIDEBAR_ENTRY))
#define FOLDERS_SIDEBAR_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntryClass))

typedef struct _FoldersSidebarEntry FoldersSidebarEntry;
typedef struct _FoldersSidebarEntryClass FoldersSidebarEntryClass;
enum  {
	FOLDERS_BRANCH_0_PROPERTY,
	FOLDERS_BRANCH_NUM_PROPERTIES
};
static GParamSpec* folders_branch_properties[FOLDERS_BRANCH_NUM_PROPERTIES];

#define TYPE_DATA_COLLECTION (data_collection_get_type ())
#define DATA_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_COLLECTION, DataCollection))
#define DATA_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_COLLECTION, DataCollectionClass))
#define IS_DATA_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_COLLECTION))
#define IS_DATA_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_COLLECTION))
#define DATA_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_COLLECTION, DataCollectionClass))

typedef struct _DataCollection DataCollection;
typedef struct _DataCollectionClass DataCollectionClass;

#define TYPE_SOURCE_COLLECTION (source_collection_get_type ())
#define SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_COLLECTION, SourceCollection))
#define SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_COLLECTION, SourceCollectionClass))
#define IS_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_COLLECTION))
#define IS_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_COLLECTION))
#define SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_COLLECTION, SourceCollectionClass))

typedef struct _SourceCollection SourceCollection;
typedef struct _SourceCollectionClass SourceCollectionClass;

#define TYPE_DATABASE_SOURCE_COLLECTION (database_source_collection_get_type ())
#define DATABASE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollection))
#define DATABASE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollectionClass))
#define IS_DATABASE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_SOURCE_COLLECTION))
#define IS_DATABASE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_SOURCE_COLLECTION))
#define DATABASE_SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollectionClass))

typedef struct _DatabaseSourceCollection DatabaseSourceCollection;
typedef struct _DatabaseSourceCollectionClass DatabaseSourceCollectionClass;

#define TYPE_MEDIA_SOURCE_COLLECTION (media_source_collection_get_type ())
#define MEDIA_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_SOURCE_COLLECTION, MediaSourceCollection))
#define MEDIA_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_SOURCE_COLLECTION, MediaSourceCollectionClass))
#define IS_MEDIA_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_SOURCE_COLLECTION))
#define IS_MEDIA_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_SOURCE_COLLECTION))
#define MEDIA_SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_SOURCE_COLLECTION, MediaSourceCollectionClass))

typedef struct _MediaSourceCollection MediaSourceCollection;
typedef struct _MediaSourceCollectionClass MediaSourceCollectionClass;

#define TYPE_MEDIA_COLLECTION_REGISTRY (media_collection_registry_get_type ())
#define MEDIA_COLLECTION_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_COLLECTION_REGISTRY, MediaCollectionRegistry))
#define MEDIA_COLLECTION_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_COLLECTION_REGISTRY, MediaCollectionRegistryClass))
#define IS_MEDIA_COLLECTION_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_COLLECTION_REGISTRY))
#define IS_MEDIA_COLLECTION_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_COLLECTION_REGISTRY))
#define MEDIA_COLLECTION_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_COLLECTION_REGISTRY, MediaCollectionRegistryClass))

typedef struct _MediaCollectionRegistry MediaCollectionRegistry;
typedef struct _MediaCollectionRegistryClass MediaCollectionRegistryClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _media_collection_registry_unref0(var) ((var == NULL) ? NULL : (var = (media_collection_registry_unref (var), NULL)))

#define TYPE_DATA_OBJECT (data_object_get_type ())
#define DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_OBJECT, DataObject))
#define DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_OBJECT, DataObjectClass))
#define IS_DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_OBJECT))
#define IS_DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_OBJECT))
#define DATA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_OBJECT, DataObjectClass))

typedef struct _DataObject DataObject;
typedef struct _DataObjectClass DataObjectClass;
#define _data_collection_unref0(var) ((var == NULL) ? NULL : (var = (data_collection_unref (var), NULL)))

#define SIDEBAR_TYPE_GROUPING (sidebar_grouping_get_type ())
#define SIDEBAR_GROUPING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_GROUPING, SidebarGrouping))
#define SIDEBAR_GROUPING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDEBAR_TYPE_GROUPING, SidebarGroupingClass))
#define SIDEBAR_IS_GROUPING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_GROUPING))
#define SIDEBAR_IS_GROUPING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDEBAR_TYPE_GROUPING))
#define SIDEBAR_GROUPING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDEBAR_TYPE_GROUPING, SidebarGroupingClass))

typedef struct _SidebarGrouping SidebarGrouping;
typedef struct _SidebarGroupingClass SidebarGroupingClass;

#define SIDEBAR_TYPE_HEADER (sidebar_header_get_type ())
#define SIDEBAR_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_HEADER, SidebarHeader))
#define SIDEBAR_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDEBAR_TYPE_HEADER, SidebarHeaderClass))
#define SIDEBAR_IS_HEADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_HEADER))
#define SIDEBAR_IS_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDEBAR_TYPE_HEADER))
#define SIDEBAR_HEADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDEBAR_TYPE_HEADER, SidebarHeaderClass))

typedef struct _SidebarHeader SidebarHeader;
typedef struct _SidebarHeaderClass SidebarHeaderClass;

#define FOLDERS_TYPE_ROOT (folders_root_get_type ())
#define FOLDERS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLDERS_TYPE_ROOT, FoldersRoot))
#define FOLDERS_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLDERS_TYPE_ROOT, FoldersRootClass))
#define FOLDERS_IS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLDERS_TYPE_ROOT))
#define FOLDERS_IS_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLDERS_TYPE_ROOT))
#define FOLDERS_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLDERS_TYPE_ROOT, FoldersRootClass))

typedef struct _FoldersRoot FoldersRoot;
typedef struct _FoldersRootClass FoldersRootClass;

#define SIDEBAR_TYPE_ENTRY (sidebar_entry_get_type ())
#define SIDEBAR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_ENTRY, SidebarEntry))
#define SIDEBAR_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_ENTRY))
#define SIDEBAR_ENTRY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SIDEBAR_TYPE_ENTRY, SidebarEntryIface))

typedef struct _SidebarEntry SidebarEntry;
typedef struct _SidebarEntryIface SidebarEntryIface;

#define SIDEBAR_TYPE_TREE (sidebar_tree_get_type ())
#define SIDEBAR_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_TREE, SidebarTree))
#define SIDEBAR_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDEBAR_TYPE_TREE, SidebarTreeClass))
#define SIDEBAR_IS_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_TREE))
#define SIDEBAR_IS_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDEBAR_TYPE_TREE))
#define SIDEBAR_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDEBAR_TYPE_TREE, SidebarTreeClass))

typedef struct _SidebarTree SidebarTree;
typedef struct _SidebarTreeClass SidebarTreeClass;
typedef enum  {
	SIDEBAR_BRANCH_OPTIONS_NONE = 0,
	SIDEBAR_BRANCH_OPTIONS_HIDE_IF_EMPTY = 1 << 0,
	SIDEBAR_BRANCH_OPTIONS_AUTO_OPEN_ON_NEW_CHILD = 1 << 1,
	SIDEBAR_BRANCH_OPTIONS_STARTUP_EXPAND_TO_FIRST_CHILD = 1 << 2,
	SIDEBAR_BRANCH_OPTIONS_STARTUP_OPEN_GROUPING = 1 << 3
} SidebarBranchOptions;

#define SIDEBAR_BRANCH_TYPE_OPTIONS (sidebar_branch_options_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_DATA_SOURCE (data_source_get_type ())
#define DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_SOURCE, DataSource))
#define DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_SOURCE, DataSourceClass))
#define IS_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_SOURCE))
#define IS_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_SOURCE))
#define DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_SOURCE, DataSourceClass))

typedef struct _DataSource DataSource;
typedef struct _DataSourceClass DataSourceClass;

#define TYPE_THUMBNAIL_SOURCE (thumbnail_source_get_type ())
#define THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSource))
#define THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass))
#define IS_THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THUMBNAIL_SOURCE))
#define IS_THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THUMBNAIL_SOURCE))
#define THUMBNAIL_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass))

typedef struct _ThumbnailSource ThumbnailSource;
typedef struct _ThumbnailSourceClass ThumbnailSourceClass;

#define TYPE_MEDIA_SOURCE (media_source_get_type ())
#define MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_SOURCE, MediaSource))
#define MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_SOURCE, MediaSourceClass))
#define IS_MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_SOURCE))
#define IS_MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_SOURCE))
#define MEDIA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_SOURCE, MediaSourceClass))

typedef struct _MediaSource MediaSource;
typedef struct _MediaSourceClass MediaSourceClass;

#define SIDEBAR_TYPE_EXPANDABLE_ENTRY (sidebar_expandable_entry_get_type ())
#define SIDEBAR_EXPANDABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_EXPANDABLE_ENTRY, SidebarExpandableEntry))
#define SIDEBAR_IS_EXPANDABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_EXPANDABLE_ENTRY))
#define SIDEBAR_EXPANDABLE_ENTRY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SIDEBAR_TYPE_EXPANDABLE_ENTRY, SidebarExpandableEntryIface))

typedef struct _SidebarExpandableEntry SidebarExpandableEntry;
typedef struct _SidebarExpandableEntryIface SidebarExpandableEntryIface;

#define SIDEBAR_TYPE_RENAMEABLE_ENTRY (sidebar_renameable_entry_get_type ())
#define SIDEBAR_RENAMEABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_RENAMEABLE_ENTRY, SidebarRenameableEntry))
#define SIDEBAR_IS_RENAMEABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_RENAMEABLE_ENTRY))
#define SIDEBAR_RENAMEABLE_ENTRY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SIDEBAR_TYPE_RENAMEABLE_ENTRY, SidebarRenameableEntryIface))

typedef struct _SidebarRenameableEntry SidebarRenameableEntry;
typedef struct _SidebarRenameableEntryIface SidebarRenameableEntryIface;
typedef struct _SidebarGroupingPrivate SidebarGroupingPrivate;

#define SIDEBAR_TYPE_EMPHASIZABLE_ENTRY (sidebar_emphasizable_entry_get_type ())
#define SIDEBAR_EMPHASIZABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_EMPHASIZABLE_ENTRY, SidebarEmphasizableEntry))
#define SIDEBAR_IS_EMPHASIZABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_EMPHASIZABLE_ENTRY))
#define SIDEBAR_EMPHASIZABLE_ENTRY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SIDEBAR_TYPE_EMPHASIZABLE_ENTRY, SidebarEmphasizableEntryIface))

typedef struct _SidebarEmphasizableEntry SidebarEmphasizableEntry;
typedef struct _SidebarEmphasizableEntryIface SidebarEmphasizableEntryIface;
typedef struct _SidebarHeaderPrivate SidebarHeaderPrivate;
typedef struct _FoldersRootPrivate FoldersRootPrivate;
enum  {
	FOLDERS_ROOT_0_PROPERTY,
	FOLDERS_ROOT_NUM_PROPERTIES
};
static GParamSpec* folders_root_properties[FOLDERS_ROOT_NUM_PROPERTIES];

#define SIDEBAR_TYPE_SELECTABLE_ENTRY (sidebar_selectable_entry_get_type ())
#define SIDEBAR_SELECTABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_SELECTABLE_ENTRY, SidebarSelectableEntry))
#define SIDEBAR_IS_SELECTABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_SELECTABLE_ENTRY))
#define SIDEBAR_SELECTABLE_ENTRY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SIDEBAR_TYPE_SELECTABLE_ENTRY, SidebarSelectableEntryIface))

typedef struct _SidebarSelectableEntry SidebarSelectableEntry;
typedef struct _SidebarSelectableEntryIface SidebarSelectableEntryIface;

#define SIDEBAR_TYPE_PAGE_REPRESENTATIVE (sidebar_page_representative_get_type ())
#define SIDEBAR_PAGE_REPRESENTATIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_PAGE_REPRESENTATIVE, SidebarPageRepresentative))
#define SIDEBAR_IS_PAGE_REPRESENTATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_PAGE_REPRESENTATIVE))
#define SIDEBAR_PAGE_REPRESENTATIVE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SIDEBAR_TYPE_PAGE_REPRESENTATIVE, SidebarPageRepresentativeIface))

typedef struct _SidebarPageRepresentative SidebarPageRepresentative;
typedef struct _SidebarPageRepresentativeIface SidebarPageRepresentativeIface;

#define TYPE_PAGE (page_get_type ())
#define PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE, Page))
#define PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE, PageClass))
#define IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE))
#define IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE))
#define PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE, PageClass))

typedef struct _Page Page;
typedef struct _PageClass PageClass;

#define SIDEBAR_TYPE_CONTEXTABLE (sidebar_contextable_get_type ())
#define SIDEBAR_CONTEXTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_CONTEXTABLE, SidebarContextable))
#define SIDEBAR_IS_CONTEXTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_CONTEXTABLE))
#define SIDEBAR_CONTEXTABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SIDEBAR_TYPE_CONTEXTABLE, SidebarContextableIface))

typedef struct _SidebarContextable SidebarContextable;
typedef struct _SidebarContextableIface SidebarContextableIface;
typedef struct _SidebarSimplePageEntryPrivate SidebarSimplePageEntryPrivate;
typedef struct _FoldersSidebarEntryPrivate FoldersSidebarEntryPrivate;
enum  {
	FOLDERS_SIDEBAR_ENTRY_0_PROPERTY,
	FOLDERS_SIDEBAR_ENTRY_DIR_PROPERTY,
	FOLDERS_SIDEBAR_ENTRY_COLLATION_PROPERTY,
	FOLDERS_SIDEBAR_ENTRY_COUNT_PROPERTY,
	FOLDERS_SIDEBAR_ENTRY_NUM_PROPERTIES
};
static GParamSpec* folders_sidebar_entry_properties[FOLDERS_SIDEBAR_ENTRY_NUM_PROPERTIES];

#define TYPE_CHECKERBOARD_PAGE (checkerboard_page_get_type ())
#define CHECKERBOARD_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CHECKERBOARD_PAGE, CheckerboardPage))
#define CHECKERBOARD_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CHECKERBOARD_PAGE, CheckerboardPageClass))
#define IS_CHECKERBOARD_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CHECKERBOARD_PAGE))
#define IS_CHECKERBOARD_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CHECKERBOARD_PAGE))
#define CHECKERBOARD_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CHECKERBOARD_PAGE, CheckerboardPageClass))

typedef struct _CheckerboardPage CheckerboardPage;
typedef struct _CheckerboardPageClass CheckerboardPageClass;

#define TYPE_MEDIA_PAGE (media_page_get_type ())
#define MEDIA_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_PAGE, MediaPage))
#define MEDIA_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_PAGE, MediaPageClass))
#define IS_MEDIA_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_PAGE))
#define IS_MEDIA_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_PAGE))
#define MEDIA_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_PAGE, MediaPageClass))

typedef struct _MediaPage MediaPage;
typedef struct _MediaPageClass MediaPageClass;

#define TYPE_COLLECTION_PAGE (collection_page_get_type ())
#define COLLECTION_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_PAGE, CollectionPage))
#define COLLECTION_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_PAGE, CollectionPageClass))
#define IS_COLLECTION_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_PAGE))
#define IS_COLLECTION_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_PAGE))
#define COLLECTION_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_PAGE, CollectionPageClass))

typedef struct _CollectionPage CollectionPage;
typedef struct _CollectionPageClass CollectionPageClass;

#define FOLDERS_TYPE_PAGE (folders_page_get_type ())
#define FOLDERS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLDERS_TYPE_PAGE, FoldersPage))
#define FOLDERS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLDERS_TYPE_PAGE, FoldersPageClass))
#define FOLDERS_IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLDERS_TYPE_PAGE))
#define FOLDERS_IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLDERS_TYPE_PAGE))
#define FOLDERS_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLDERS_TYPE_PAGE, FoldersPageClass))

typedef struct _FoldersPage FoldersPage;
typedef struct _FoldersPageClass FoldersPageClass;
#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 _SidebarBranch {
	GObject parent_instance;
	SidebarBranchPrivate * priv;
};

struct _SidebarBranchClass {
	GObjectClass parent_class;
};

struct _FoldersBranch {
	SidebarBranch parent_instance;
	FoldersBranchPrivate * priv;
};

struct _FoldersBranchClass {
	SidebarBranchClass parent_class;
};

struct _FoldersBranchPrivate {
	GeeHashMap* entries;
	GFile* home_dir;
};

struct _SidebarEntryIface {
	GTypeInterface parent_iface;
	gchar* (*get_sidebar_name) (SidebarEntry* self);
	gchar* (*get_sidebar_tooltip) (SidebarEntry* self);
	gchar* (*get_sidebar_icon) (SidebarEntry* self);
	gchar* (*to_string) (SidebarEntry* self);
	void (*grafted) (SidebarEntry* self, SidebarTree* tree);
	void (*pruned) (SidebarEntry* self, SidebarTree* tree);
};

struct _SidebarExpandableEntryIface {
	GTypeInterface parent_iface;
	gboolean (*expand_on_select) (SidebarExpandableEntry* self);
};

struct _SidebarRenameableEntryIface {
	GTypeInterface parent_iface;
	void (*rename) (SidebarRenameableEntry* self, const gchar* new_name);
	gboolean (*is_user_renameable) (SidebarRenameableEntry* self);
};

struct _SidebarGrouping {
	GObject parent_instance;
	SidebarGroupingPrivate * priv;
};

struct _SidebarGroupingClass {
	GObjectClass parent_class;
};

struct _SidebarEmphasizableEntryIface {
	GTypeInterface parent_iface;
	gboolean (*is_emphasized) (SidebarEmphasizableEntry* self);
};

struct _SidebarHeader {
	SidebarGrouping parent_instance;
	SidebarHeaderPrivate * priv;
};

struct _SidebarHeaderClass {
	SidebarGroupingClass parent_class;
};

struct _FoldersRoot {
	SidebarHeader parent_instance;
	FoldersRootPrivate * priv;
};

struct _FoldersRootClass {
	SidebarHeaderClass parent_class;
};

struct _SidebarSelectableEntryIface {
	GTypeInterface parent_iface;
};

struct _SidebarPageRepresentativeIface {
	GTypeInterface parent_iface;
	gboolean (*has_page) (SidebarPageRepresentative* self);
	Page* (*get_page) (SidebarPageRepresentative* self);
};

struct _SidebarContextableIface {
	GTypeInterface parent_iface;
	GtkMenu* (*get_sidebar_context_menu) (SidebarContextable* self, GdkEventButton* event);
};

struct _SidebarSimplePageEntry {
	GObject parent_instance;
	SidebarSimplePageEntryPrivate * priv;
};

struct _SidebarSimplePageEntryClass {
	GObjectClass parent_class;
	gchar* (*get_sidebar_name) (SidebarSimplePageEntry* self);
	gchar* (*get_sidebar_tooltip) (SidebarSimplePageEntry* self);
	gchar* (*get_sidebar_icon) (SidebarSimplePageEntry* self);
	gchar* (*to_string) (SidebarSimplePageEntry* self);
	Page* (*create_page) (SidebarSimplePageEntry* self);
};

struct _FoldersSidebarEntry {
	SidebarSimplePageEntry parent_instance;
	FoldersSidebarEntryPrivate * priv;
};

struct _FoldersSidebarEntryClass {
	SidebarSimplePageEntryClass parent_class;
};

struct _FoldersSidebarEntryPrivate {
	GFile* _dir;
	gchar* _collation;
	gint _count;
};

static gint FoldersBranch_private_offset;
static gpointer folders_branch_parent_class = NULL;
static gpointer folders_root_parent_class = NULL;
static gint FoldersSidebarEntry_private_offset;
static gpointer folders_sidebar_entry_parent_class = NULL;
VALA_EXTERN gchar* folders_icon;
VALA_EXTERN gchar* folders_have_photos_icon;
static SidebarExpandableEntryIface * folders_sidebar_entry_sidebar_expandable_entry_parent_iface = NULL;

VALA_EXTERN GType sidebar_branch_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SidebarBranch, g_object_unref)
VALA_EXTERN GType folders_branch_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FoldersBranch, g_object_unref)
VALA_EXTERN GType sidebar_simple_page_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SidebarSimplePageEntry, g_object_unref)
VALA_EXTERN GType folders_sidebar_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FoldersSidebarEntry, g_object_unref)
VALA_EXTERN gpointer data_collection_ref (gpointer instance);
VALA_EXTERN void data_collection_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_data_collection (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_data_collection (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_data_collection (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_data_collection (const GValue* value);
VALA_EXTERN GType data_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataCollection, data_collection_unref)
VALA_EXTERN GType source_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SourceCollection, data_collection_unref)
VALA_EXTERN GType database_source_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DatabaseSourceCollection, data_collection_unref)
VALA_EXTERN GType media_source_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MediaSourceCollection, data_collection_unref)
VALA_EXTERN gpointer media_collection_registry_ref (gpointer instance);
VALA_EXTERN void media_collection_registry_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_media_collection_registry (const gchar* name,
                                                  const gchar* nick,
                                                  const gchar* blurb,
                                                  GType object_type,
                                                  GParamFlags flags);
VALA_EXTERN void value_set_media_collection_registry (GValue* value,
                                          gpointer v_object);
VALA_EXTERN void value_take_media_collection_registry (GValue* value,
                                           gpointer v_object);
VALA_EXTERN gpointer value_get_media_collection_registry (const GValue* value);
VALA_EXTERN GType media_collection_registry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MediaCollectionRegistry, media_collection_registry_unref)
VALA_EXTERN MediaCollectionRegistry* media_collection_registry_get_instance (void);
VALA_EXTERN GeeCollection* media_collection_registry_get_all (MediaCollectionRegistry* self);
VALA_EXTERN GType data_object_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataObject, g_object_unref)
static void folders_branch_on_media_contents_altered (FoldersBranch* self,
                                               GeeIterable* added,
                                               GeeIterable* removed);
static void _folders_branch_on_media_contents_altered_data_collection_contents_altered (DataCollection* _sender,
                                                                                 GeeIterable* added,
                                                                                 GeeIterable* removed,
                                                                                 gpointer self);
VALA_EXTERN guint file_hash (GFile* file);
static guint _file_hash_gee_hash_data_func (gconstpointer v,
                                     gpointer self);
VALA_EXTERN gboolean file_equal (GFile* a,
                     GFile* b);
static gboolean _file_equal_gee_equal_data_func (gconstpointer a,
                                          gconstpointer b,
                                          gpointer self);
VALA_EXTERN FoldersBranch* folders_branch_new (void);
VALA_EXTERN FoldersBranch* folders_branch_construct (GType object_type);
VALA_EXTERN FoldersRoot* folders_root_new (void);
VALA_EXTERN FoldersRoot* folders_root_construct (GType object_type);
VALA_EXTERN GType sidebar_grouping_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SidebarGrouping, g_object_unref)
VALA_EXTERN GType sidebar_header_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SidebarHeader, g_object_unref)
VALA_EXTERN GType folders_root_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FoldersRoot, g_object_unref)
VALA_EXTERN GType sidebar_tree_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SidebarTree, g_object_unref)
VALA_EXTERN GType sidebar_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SidebarEntry, g_object_unref)
VALA_EXTERN GType sidebar_branch_options_get_type (void) G_GNUC_CONST ;
static gint folders_branch_comparator (SidebarEntry* a,
                                SidebarEntry* b);
static gint _folders_branch_comparator_gcompare_func (gconstpointer a,
                                               gconstpointer b);
VALA_EXTERN SidebarBranch* sidebar_branch_new (SidebarEntry* root,
                                   SidebarBranchOptions options,
                                   GCompareFunc default_comparator,
                                   GCompareFunc root_comparator);
VALA_EXTERN SidebarBranch* sidebar_branch_construct (GType object_type,
                                         SidebarEntry* root,
                                         SidebarBranchOptions options,
                                         GCompareFunc default_comparator,
                                         GCompareFunc root_comparator);
VALA_EXTERN GeeCollection* data_collection_get_all (DataCollection* self);
VALA_EXTERN const gchar* folders_sidebar_entry_get_collation (FoldersSidebarEntry* self);
VALA_EXTERN gchar* sidebar_simple_page_entry_get_sidebar_name (SidebarSimplePageEntry* self);
VALA_EXTERN GType data_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataSource, g_object_unref)
VALA_EXTERN GType thumbnail_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ThumbnailSource, g_object_unref)
VALA_EXTERN GType media_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MediaSource, g_object_unref)
static void folders_branch_on_master_source_replaced (FoldersBranch* self,
                                               MediaSource* media_source,
                                               GFile* old_file,
                                               GFile* new_file);
static void folders_branch_remove_entry (FoldersBranch* self,
                                  GFile* file);
static void folders_branch_add_entry (FoldersBranch* self,
                               MediaSource* media);
static void _folders_branch_on_master_source_replaced_media_source_master_replaced (MediaSource* _sender,
                                                                             GFile* old_file,
                                                                             GFile* new_file,
                                                                             gpointer self);
VALA_EXTERN GFile* media_source_get_file (MediaSource* self);
VALA_EXTERN FoldersSidebarEntry* folders_sidebar_entry_new (GFile* dir);
VALA_EXTERN FoldersSidebarEntry* folders_sidebar_entry_construct (GType object_type,
                                                      GFile* dir);
VALA_EXTERN SidebarEntry* sidebar_branch_get_root (SidebarBranch* self);
VALA_EXTERN void sidebar_branch_graft (SidebarBranch* self,
                           SidebarEntry* parent,
                           SidebarEntry* entry,
                           GCompareFunc comparator);
VALA_EXTERN gint folders_sidebar_entry_get_count (FoldersSidebarEntry* self);
VALA_EXTERN void folders_sidebar_entry_set_count (FoldersSidebarEntry* self,
                                      gint value);
VALA_EXTERN gint sidebar_branch_get_child_count (SidebarBranch* self,
                                     SidebarEntry* parent);
VALA_EXTERN GFile* folders_sidebar_entry_get_dir (FoldersSidebarEntry* self);
VALA_EXTERN SidebarEntry* sidebar_branch_get_parent (SidebarBranch* self,
                                         SidebarEntry* entry);
VALA_EXTERN void sidebar_branch_prune (SidebarBranch* self,
                           SidebarEntry* entry);
static void folders_branch_finalize (GObject * obj);
static GType folders_branch_get_type_once (void);
VALA_EXTERN GType sidebar_expandable_entry_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType sidebar_renameable_entry_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType sidebar_emphasizable_entry_get_type (void) G_GNUC_CONST ;
VALA_EXTERN SidebarHeader* sidebar_header_new (const gchar* name,
                                   const gchar* tooltip,
                                   gboolean emphasized);
VALA_EXTERN SidebarHeader* sidebar_header_construct (GType object_type,
                                         const gchar* name,
                                         const gchar* tooltip,
                                         gboolean emphasized);
static GType folders_root_get_type_once (void);
VALA_EXTERN GType sidebar_selectable_entry_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Page, g_object_unref)
VALA_EXTERN GType sidebar_page_representative_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType sidebar_contextable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SidebarContextable, g_object_unref)
VALA_EXTERN gchar* sidebar_simple_page_entry_get_sidebar_icon (SidebarSimplePageEntry* self);
VALA_EXTERN gchar* sidebar_simple_page_entry_to_string (SidebarSimplePageEntry* self);
VALA_EXTERN Page* sidebar_simple_page_entry_create_page (SidebarSimplePageEntry* self);
VALA_EXTERN SidebarSimplePageEntry* sidebar_simple_page_entry_construct (GType object_type);
static void folders_sidebar_entry_set_dir (FoldersSidebarEntry* self,
                                    GFile* value);
static void folders_sidebar_entry_set_collation (FoldersSidebarEntry* self,
                                          const gchar* value);
static gchar* folders_sidebar_entry_real_get_sidebar_name (SidebarSimplePageEntry* base);
static gchar* folders_sidebar_entry_real_get_sidebar_icon (SidebarSimplePageEntry* base);
static gchar* folders_sidebar_entry_real_to_string (SidebarSimplePageEntry* base);
static gboolean folders_sidebar_entry_real_expand_on_select (SidebarExpandableEntry* base);
static Page* folders_sidebar_entry_real_create_page (SidebarSimplePageEntry* base);
VALA_EXTERN FoldersPage* folders_page_new (GFile* dir);
VALA_EXTERN FoldersPage* folders_page_construct (GType object_type,
                                     GFile* dir);
VALA_EXTERN GType checkerboard_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CheckerboardPage, g_object_unref)
VALA_EXTERN GType media_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MediaPage, g_object_unref)
VALA_EXTERN GType collection_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CollectionPage, g_object_unref)
VALA_EXTERN GType folders_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FoldersPage, g_object_unref)
VALA_EXTERN gboolean sidebar_expandable_entry_expand_on_select (SidebarExpandableEntry* self);
static void folders_sidebar_entry_finalize (GObject * obj);
static GType folders_sidebar_entry_get_type_once (void);
static void _vala_folders_sidebar_entry_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_folders_sidebar_entry_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
folders_branch_get_instance_private (FoldersBranch* self)
{
	return G_STRUCT_MEMBER_P (self, FoldersBranch_private_offset);
}

static void
_folders_branch_on_media_contents_altered_data_collection_contents_altered (DataCollection* _sender,
                                                                            GeeIterable* added,
                                                                            GeeIterable* removed,
                                                                            gpointer self)
{
	folders_branch_on_media_contents_altered ((FoldersBranch*) self, added, removed);
}

static guint
_file_hash_gee_hash_data_func (gconstpointer v,
                               gpointer self)
{
	guint result;
	result = file_hash ((GFile*) v);
	return result;
}

static gboolean
_file_equal_gee_equal_data_func (gconstpointer a,
                                 gconstpointer b,
                                 gpointer self)
{
	gboolean result;
	result = file_equal ((GFile*) a, (GFile*) b);
	return result;
}

static gint
_folders_branch_comparator_gcompare_func (gconstpointer a,
                                          gconstpointer b)
{
	gint result;
	result = folders_branch_comparator ((SidebarEntry*) a, (SidebarEntry*) b);
	return result;
}

FoldersBranch*
folders_branch_construct (GType object_type)
{
	FoldersBranch * self = NULL;
	FoldersRoot* _tmp0_;
	FoldersRoot* _tmp1_;
	const gchar* _tmp2_;
	GFile* _tmp3_;
	_tmp0_ = folders_root_new ();
	_tmp1_ = _tmp0_;
	self = (FoldersBranch*) sidebar_branch_construct (object_type, G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, SIDEBAR_TYPE_ENTRY, SidebarEntry), SIDEBAR_BRANCH_OPTIONS_STARTUP_OPEN_GROUPING | SIDEBAR_BRANCH_OPTIONS_HIDE_IF_EMPTY, _folders_branch_comparator_gcompare_func, NULL);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = g_get_home_dir ();
	_tmp3_ = g_file_new_for_path (_tmp2_);
	_g_object_unref0 (self->priv->home_dir);
	self->priv->home_dir = _tmp3_;
	{
		GeeIterator* _sources_it = NULL;
		MediaCollectionRegistry* _tmp4_;
		MediaCollectionRegistry* _tmp5_;
		GeeCollection* _tmp6_;
		GeeCollection* _tmp7_;
		GeeIterator* _tmp8_;
		GeeIterator* _tmp9_;
		_tmp4_ = media_collection_registry_get_instance ();
		_tmp5_ = _tmp4_;
		_tmp6_ = media_collection_registry_get_all (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEE_TYPE_ITERABLE, GeeIterable));
		_tmp9_ = _tmp8_;
		_g_object_unref0 (_tmp7_);
		_media_collection_registry_unref0 (_tmp5_);
		_sources_it = _tmp9_;
		while (TRUE) {
			GeeIterator* _tmp10_;
			MediaSourceCollection* sources = NULL;
			GeeIterator* _tmp11_;
			gpointer _tmp12_;
			MediaSourceCollection* _tmp13_;
			GeeCollection* _tmp14_;
			GeeCollection* _tmp15_;
			MediaSourceCollection* _tmp16_;
			_tmp10_ = _sources_it;
			if (!gee_iterator_next (_tmp10_)) {
				break;
			}
			_tmp11_ = _sources_it;
			_tmp12_ = gee_iterator_get (_tmp11_);
			sources = (MediaSourceCollection*) _tmp12_;
			_tmp13_ = sources;
			_tmp14_ = data_collection_get_all (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, TYPE_DATA_COLLECTION, DataCollection));
			_tmp15_ = _tmp14_;
			folders_branch_on_media_contents_altered (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GEE_TYPE_ITERABLE, GeeIterable), NULL);
			_g_object_unref0 (_tmp15_);
			_tmp16_ = sources;
			g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, TYPE_DATA_COLLECTION, DataCollection), "contents-altered", (GCallback) _folders_branch_on_media_contents_altered_data_collection_contents_altered, self, 0);
			_data_collection_unref0 (sources);
		}
		_g_object_unref0 (_sources_it);
	}
	return self;
}

FoldersBranch*
folders_branch_new (void)
{
	return folders_branch_construct (FOLDERS_TYPE_BRANCH);
}

static gint
folders_branch_comparator (SidebarEntry* a,
                           SidebarEntry* b)
{
	gint coll_key_equality = 0;
	GCompareFunc _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gint result;
	g_return_val_if_fail (SIDEBAR_IS_ENTRY (a), -1);
	g_return_val_if_fail (SIDEBAR_IS_ENTRY (b), -1);
	if (a == b) {
		result = 0;
		return result;
	}
	_tmp0_ = ((GCompareFunc) g_strcmp0);
	_tmp1_ = folders_sidebar_entry_get_collation (G_TYPE_CHECK_INSTANCE_CAST (a, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry));
	_tmp2_ = _tmp1_;
	_tmp3_ = folders_sidebar_entry_get_collation (G_TYPE_CHECK_INSTANCE_CAST (b, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry));
	_tmp4_ = _tmp3_;
	coll_key_equality = _tmp0_ (_tmp2_, _tmp4_);
	if (coll_key_equality == 0) {
		GCompareFunc _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gint _tmp10_;
		_tmp5_ = ((GCompareFunc) g_strcmp0);
		_tmp6_ = sidebar_simple_page_entry_get_sidebar_name (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (a, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry), SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, SidebarSimplePageEntry));
		_tmp7_ = _tmp6_;
		_tmp8_ = sidebar_simple_page_entry_get_sidebar_name (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (b, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry), SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, SidebarSimplePageEntry));
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp5_ (_tmp7_, _tmp9_);
		_g_free0 (_tmp9_);
		_g_free0 (_tmp7_);
		result = _tmp10_;
		return result;
	}
	result = coll_key_equality;
	return result;
}

static void
folders_branch_on_master_source_replaced (FoldersBranch* self,
                                          MediaSource* media_source,
                                          GFile* old_file,
                                          GFile* new_file)
{
	g_return_if_fail (FOLDERS_IS_BRANCH (self));
	g_return_if_fail (IS_MEDIA_SOURCE (media_source));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (old_file, g_file_get_type ()));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (new_file, g_file_get_type ()));
	folders_branch_remove_entry (self, old_file);
	folders_branch_add_entry (self, media_source);
}

static void
_folders_branch_on_master_source_replaced_media_source_master_replaced (MediaSource* _sender,
                                                                        GFile* old_file,
                                                                        GFile* new_file,
                                                                        gpointer self)
{
	folders_branch_on_master_source_replaced ((FoldersBranch*) self, _sender, old_file, new_file);
}

static void
folders_branch_on_media_contents_altered (FoldersBranch* self,
                                          GeeIterable* added,
                                          GeeIterable* removed)
{
	g_return_if_fail (FOLDERS_IS_BRANCH (self));
	g_return_if_fail ((added == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (added, GEE_TYPE_ITERABLE));
	g_return_if_fail ((removed == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (removed, GEE_TYPE_ITERABLE));
	if (added != NULL) {
		{
			GeeIterator* _object_it = NULL;
			GeeIterator* _tmp0_;
			_tmp0_ = gee_iterable_iterator (added);
			_object_it = _tmp0_;
			while (TRUE) {
				GeeIterator* _tmp1_;
				DataObject* object = NULL;
				GeeIterator* _tmp2_;
				gpointer _tmp3_;
				DataObject* _tmp4_;
				DataObject* _tmp5_;
				_tmp1_ = _object_it;
				if (!gee_iterator_next (_tmp1_)) {
					break;
				}
				_tmp2_ = _object_it;
				_tmp3_ = gee_iterator_get (_tmp2_);
				object = (DataObject*) _tmp3_;
				_tmp4_ = object;
				folders_branch_add_entry (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_MEDIA_SOURCE, MediaSource));
				_tmp5_ = object;
				g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, TYPE_MEDIA_SOURCE, MediaSource), "master-replaced", (GCallback) _folders_branch_on_master_source_replaced_media_source_master_replaced, self, 0);
				_g_object_unref0 (object);
			}
			_g_object_unref0 (_object_it);
		}
	}
	if (removed != NULL) {
		{
			GeeIterator* _object_it = NULL;
			GeeIterator* _tmp6_;
			_tmp6_ = gee_iterable_iterator (removed);
			_object_it = _tmp6_;
			while (TRUE) {
				GeeIterator* _tmp7_;
				DataObject* object = NULL;
				GeeIterator* _tmp8_;
				gpointer _tmp9_;
				DataObject* _tmp10_;
				GFile* _tmp11_;
				GFile* _tmp12_;
				DataObject* _tmp13_;
				guint _tmp14_;
				_tmp7_ = _object_it;
				if (!gee_iterator_next (_tmp7_)) {
					break;
				}
				_tmp8_ = _object_it;
				_tmp9_ = gee_iterator_get (_tmp8_);
				object = (DataObject*) _tmp9_;
				_tmp10_ = object;
				_tmp11_ = media_source_get_file (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, TYPE_MEDIA_SOURCE, MediaSource));
				_tmp12_ = _tmp11_;
				folders_branch_remove_entry (self, _tmp12_);
				_g_object_unref0 (_tmp12_);
				_tmp13_ = object;
				g_signal_parse_name ("master-replaced", TYPE_MEDIA_SOURCE, &_tmp14_, NULL, FALSE);
				g_signal_handlers_disconnect_matched (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, TYPE_MEDIA_SOURCE, MediaSource), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp14_, 0, NULL, (GCallback) _folders_branch_on_master_source_replaced_media_source_master_replaced, self);
				_g_object_unref0 (object);
			}
			_g_object_unref0 (_object_it);
		}
	}
}

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

static void
folders_branch_add_entry (FoldersBranch* self,
                          MediaSource* media)
{
	GFile* file = NULL;
	GFile* _tmp0_;
	GeeArrayList* elements = NULL;
	GeeArrayList* _tmp1_;
	GFile* parent = NULL;
	GFile* _tmp2_;
	GFile* _tmp3_;
	FoldersSidebarEntry* parent_entry = NULL;
	g_return_if_fail (FOLDERS_IS_BRANCH (self));
	g_return_if_fail (IS_MEDIA_SOURCE (media));
	_tmp0_ = media_source_get_file (media);
	file = _tmp0_;
	_tmp1_ = gee_array_list_new (g_file_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	elements = _tmp1_;
	_tmp2_ = file;
	_tmp3_ = g_file_get_parent (_tmp2_);
	parent = _tmp3_;
	while (TRUE) {
		gboolean _tmp4_ = FALSE;
		GFile* _tmp5_;
		GFile* _tmp9_;
		GFile* _tmp10_;
		GFile* _tmp11_;
		GFile* _tmp12_;
		gboolean _tmp13_;
		GeeArrayList* _tmp14_;
		GFile* _tmp15_;
		GFile* _tmp16_;
		GFile* _tmp17_;
		_tmp5_ = parent;
		if (_tmp5_ != NULL) {
			GFile* _tmp6_;
			gchar* _tmp7_;
			gchar* _tmp8_;
			_tmp6_ = parent;
			_tmp7_ = g_file_get_path (_tmp6_);
			_tmp8_ = _tmp7_;
			_tmp4_ = _tmp8_ != NULL;
			_g_free0 (_tmp8_);
		} else {
			_tmp4_ = FALSE;
		}
		if (!_tmp4_) {
			break;
		}
		_tmp9_ = parent;
		_tmp10_ = self->priv->home_dir;
		_tmp11_ = g_file_get_parent (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = g_file_equal (_tmp9_, _tmp12_);
		_g_object_unref0 (_tmp12_);
		if (_tmp13_) {
			break;
		}
		_tmp14_ = elements;
		_tmp15_ = parent;
		gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp15_);
		_tmp16_ = parent;
		_tmp17_ = g_file_get_parent (_tmp16_);
		_g_object_unref0 (parent);
		parent = _tmp17_;
	}
	parent_entry = NULL;
	{
		gint ctr = 0;
		GeeArrayList* _tmp18_;
		gint _tmp19_;
		gint _tmp20_;
		_tmp18_ = elements;
		_tmp19_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
		_tmp20_ = _tmp19_;
		ctr = _tmp20_ - 1;
		{
			gboolean _tmp21_ = FALSE;
			_tmp21_ = TRUE;
			while (TRUE) {
				GFile* parent_dir = NULL;
				GeeArrayList* _tmp23_;
				gpointer _tmp24_;
				FoldersSidebarEntry* old_parent_entry = NULL;
				FoldersSidebarEntry* _tmp25_;
				FoldersSidebarEntry* _tmp26_;
				GeeHashMap* _tmp27_;
				GFile* _tmp28_;
				gpointer _tmp29_;
				FoldersSidebarEntry* _tmp30_;
				if (!_tmp21_) {
					gint _tmp22_;
					_tmp22_ = ctr;
					ctr = _tmp22_ - 1;
				}
				_tmp21_ = FALSE;
				if (!(ctr >= 0)) {
					break;
				}
				_tmp23_ = elements;
				_tmp24_ = gee_abstract_list_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList), ctr);
				parent_dir = (GFile*) _tmp24_;
				_tmp25_ = parent_entry;
				_tmp26_ = _g_object_ref0 (_tmp25_);
				old_parent_entry = _tmp26_;
				_tmp27_ = self->priv->entries;
				_tmp28_ = parent_dir;
				_tmp29_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp27_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp28_);
				_g_object_unref0 (parent_entry);
				parent_entry = (FoldersSidebarEntry*) _tmp29_;
				_tmp30_ = parent_entry;
				if (_tmp30_ == NULL) {
					GFile* _tmp31_;
					FoldersSidebarEntry* _tmp32_;
					GeeHashMap* _tmp33_;
					GFile* _tmp34_;
					FoldersSidebarEntry* _tmp35_;
					SidebarEntry* _tmp36_ = NULL;
					FoldersSidebarEntry* _tmp37_;
					FoldersSidebarEntry* _tmp41_;
					_tmp31_ = parent_dir;
					_tmp32_ = folders_sidebar_entry_new (_tmp31_);
					_g_object_unref0 (parent_entry);
					parent_entry = _tmp32_;
					_tmp33_ = self->priv->entries;
					_tmp34_ = parent_dir;
					_tmp35_ = parent_entry;
					gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp33_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp34_, _tmp35_);
					_tmp37_ = old_parent_entry;
					if (_tmp37_ == NULL) {
						SidebarEntry* _tmp38_;
						_tmp38_ = sidebar_branch_get_root (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_BRANCH, SidebarBranch));
						_g_object_unref0 (_tmp36_);
						_tmp36_ = _tmp38_;
					} else {
						FoldersSidebarEntry* _tmp39_;
						SidebarEntry* _tmp40_;
						_tmp39_ = old_parent_entry;
						_tmp40_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp39_, SIDEBAR_TYPE_ENTRY, SidebarEntry));
						_g_object_unref0 (_tmp36_);
						_tmp36_ = _tmp40_;
					}
					_tmp41_ = parent_entry;
					sidebar_branch_graft (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_BRANCH, SidebarBranch), _tmp36_, G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, SIDEBAR_TYPE_ENTRY, SidebarEntry), NULL);
					_g_object_unref0 (_tmp36_);
				}
				if (ctr == 0) {
					FoldersSidebarEntry* _tmp42_;
					gint _tmp43_;
					gint _tmp44_;
					_tmp42_ = parent_entry;
					_tmp43_ = folders_sidebar_entry_get_count (_tmp42_);
					_tmp44_ = _tmp43_;
					folders_sidebar_entry_set_count (_tmp42_, _tmp44_ + 1);
				}
				_g_object_unref0 (old_parent_entry);
				_g_object_unref0 (parent_dir);
			}
		}
	}
	_g_object_unref0 (parent_entry);
	_g_object_unref0 (parent);
	_g_object_unref0 (elements);
	_g_object_unref0 (file);
}

static void
folders_branch_remove_entry (FoldersBranch* self,
                             GFile* file)
{
	FoldersSidebarEntry* folder_entry = NULL;
	GeeHashMap* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	gpointer _tmp3_;
	FoldersSidebarEntry* _tmp4_;
	FoldersSidebarEntry* _tmp5_;
	FoldersSidebarEntry* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gboolean _tmp9_ = FALSE;
	FoldersSidebarEntry* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	FoldersSidebarEntry* prune_point = NULL;
	FoldersSidebarEntry* _tmp15_;
	FoldersSidebarEntry* _tmp16_;
	FoldersSidebarEntry* _tmp17_;
	FoldersSidebarEntry* _tmp35_;
	g_return_if_fail (FOLDERS_IS_BRANCH (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()));
	_tmp0_ = self->priv->entries;
	_tmp1_ = g_file_get_parent (file);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp2_);
	_tmp4_ = (FoldersSidebarEntry*) _tmp3_;
	_g_object_unref0 (_tmp2_);
	folder_entry = _tmp4_;
	_tmp5_ = folder_entry;
	if (_tmp5_ == NULL) {
		_g_object_unref0 (folder_entry);
		return;
	}
	_tmp6_ = folder_entry;
	_tmp7_ = folders_sidebar_entry_get_count (_tmp6_);
	_tmp8_ = _tmp7_;
	_vala_assert (_tmp8_ > 0, "folder_entry.count > 0");
	_tmp10_ = folder_entry;
	_tmp11_ = folders_sidebar_entry_get_count (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp12_ = _tmp12_ - 1;
	_tmp13_ = _tmp12_;
	folders_sidebar_entry_set_count (_tmp10_, _tmp13_);
	if (_tmp13_ > 0) {
		_tmp9_ = TRUE;
	} else {
		FoldersSidebarEntry* _tmp14_;
		_tmp14_ = folder_entry;
		_tmp9_ = sidebar_branch_get_child_count (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_BRANCH, SidebarBranch), G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, SIDEBAR_TYPE_ENTRY, SidebarEntry)) > 0;
	}
	if (_tmp9_) {
		_g_object_unref0 (folder_entry);
		return;
	}
	_tmp15_ = folder_entry;
	_tmp16_ = _g_object_ref0 (_tmp15_);
	prune_point = _tmp16_;
	_tmp17_ = prune_point;
	_vala_assert (_tmp17_ != NULL, "prune_point != null");
	{
		gboolean _tmp18_ = FALSE;
		_tmp18_ = TRUE;
		while (TRUE) {
			gboolean removed = FALSE;
			GeeHashMap* _tmp19_;
			FoldersSidebarEntry* _tmp20_;
			GFile* _tmp21_;
			GFile* _tmp22_;
			FoldersSidebarEntry* parent = NULL;
			FoldersSidebarEntry* _tmp23_;
			SidebarEntry* _tmp24_;
			FoldersSidebarEntry* _tmp25_;
			gboolean _tmp26_ = FALSE;
			gboolean _tmp27_ = FALSE;
			FoldersSidebarEntry* _tmp28_;
			FoldersSidebarEntry* _tmp33_;
			FoldersSidebarEntry* _tmp34_;
			if (!_tmp18_) {
			}
			_tmp18_ = FALSE;
			_tmp19_ = self->priv->entries;
			_tmp20_ = prune_point;
			_tmp21_ = folders_sidebar_entry_get_dir (_tmp20_);
			_tmp22_ = _tmp21_;
			removed = gee_abstract_map_unset (G_TYPE_CHECK_INSTANCE_CAST (_tmp19_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp22_, NULL);
			_vala_assert (removed, "removed");
			_tmp23_ = prune_point;
			_tmp24_ = sidebar_branch_get_parent (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_BRANCH, SidebarBranch), G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, SIDEBAR_TYPE_ENTRY, SidebarEntry));
			_tmp25_ = FOLDERS_IS_SIDEBAR_ENTRY (_tmp24_) ? ((FoldersSidebarEntry*) _tmp24_) : NULL;
			if (_tmp25_ == NULL) {
				_g_object_unref0 (_tmp24_);
			}
			parent = _tmp25_;
			_tmp28_ = parent;
			if (_tmp28_ == NULL) {
				_tmp27_ = TRUE;
			} else {
				FoldersSidebarEntry* _tmp29_;
				gint _tmp30_;
				gint _tmp31_;
				_tmp29_ = parent;
				_tmp30_ = folders_sidebar_entry_get_count (_tmp29_);
				_tmp31_ = _tmp30_;
				_tmp27_ = _tmp31_ != 0;
			}
			if (_tmp27_) {
				_tmp26_ = TRUE;
			} else {
				FoldersSidebarEntry* _tmp32_;
				_tmp32_ = parent;
				_tmp26_ = sidebar_branch_get_child_count (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_BRANCH, SidebarBranch), G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, SIDEBAR_TYPE_ENTRY, SidebarEntry)) > 1;
			}
			if (_tmp26_) {
				_g_object_unref0 (parent);
				break;
			}
			_tmp33_ = parent;
			_tmp34_ = _g_object_ref0 (_tmp33_);
			_g_object_unref0 (prune_point);
			prune_point = _tmp34_;
			_g_object_unref0 (parent);
		}
	}
	_tmp35_ = prune_point;
	sidebar_branch_prune (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_BRANCH, SidebarBranch), G_TYPE_CHECK_INSTANCE_CAST (_tmp35_, SIDEBAR_TYPE_ENTRY, SidebarEntry));
	_g_object_unref0 (prune_point);
	_g_object_unref0 (folder_entry);
}

static void
folders_branch_class_init (FoldersBranchClass * klass,
                           gpointer klass_data)
{
	folders_branch_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FoldersBranch_private_offset);
	G_OBJECT_CLASS (klass)->finalize = folders_branch_finalize;
}

static void
folders_branch_instance_init (FoldersBranch * self,
                              gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = folders_branch_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (g_file_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, FOLDERS_TYPE_SIDEBAR_ENTRY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _file_hash_gee_hash_data_func, NULL, NULL, _file_equal_gee_equal_data_func, NULL, NULL, NULL, NULL, NULL);
	self->priv->entries = _tmp0_;
}

static void
folders_branch_finalize (GObject * obj)
{
	FoldersBranch * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLDERS_TYPE_BRANCH, FoldersBranch);
	{
		GeeIterator* _sources_it = NULL;
		MediaCollectionRegistry* _tmp0_;
		MediaCollectionRegistry* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = media_collection_registry_get_instance ();
		_tmp1_ = _tmp0_;
		_tmp2_ = media_collection_registry_get_all (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GEE_TYPE_ITERABLE, GeeIterable));
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_media_collection_registry_unref0 (_tmp1_);
		_sources_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			MediaSourceCollection* sources = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			MediaSourceCollection* _tmp9_;
			guint _tmp10_;
			_tmp6_ = _sources_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _sources_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			sources = (MediaSourceCollection*) _tmp8_;
			_tmp9_ = sources;
			g_signal_parse_name ("contents-altered", TYPE_DATA_COLLECTION, &_tmp10_, NULL, FALSE);
			g_signal_handlers_disconnect_matched (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, TYPE_DATA_COLLECTION, DataCollection), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp10_, 0, NULL, (GCallback) _folders_branch_on_media_contents_altered_data_collection_contents_altered, self);
			_data_collection_unref0 (sources);
		}
		_g_object_unref0 (_sources_it);
	}
	_g_object_unref0 (self->priv->entries);
	_g_object_unref0 (self->priv->home_dir);
	G_OBJECT_CLASS (folders_branch_parent_class)->finalize (obj);
}

static GType
folders_branch_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FoldersBranchClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folders_branch_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FoldersBranch), 0, (GInstanceInitFunc) folders_branch_instance_init, NULL };
	GType folders_branch_type_id;
	folders_branch_type_id = g_type_register_static (SIDEBAR_TYPE_BRANCH, "FoldersBranch", &g_define_type_info, 0);
	FoldersBranch_private_offset = g_type_add_instance_private (folders_branch_type_id, sizeof (FoldersBranchPrivate));
	return folders_branch_type_id;
}

GType
folders_branch_get_type (void)
{
	static volatile gsize folders_branch_type_id__once = 0;
	if (g_once_init_enter (&folders_branch_type_id__once)) {
		GType folders_branch_type_id;
		folders_branch_type_id = folders_branch_get_type_once ();
		g_once_init_leave (&folders_branch_type_id__once, folders_branch_type_id);
	}
	return folders_branch_type_id__once;
}

FoldersRoot*
folders_root_construct (GType object_type)
{
	FoldersRoot * self = NULL;
	self = (FoldersRoot*) sidebar_header_construct (object_type, _ ("Folders"), _ ("Browse the library’s folder structure"), TRUE);
	return self;
}

FoldersRoot*
folders_root_new (void)
{
	return folders_root_construct (FOLDERS_TYPE_ROOT);
}

static void
folders_root_class_init (FoldersRootClass * klass,
                         gpointer klass_data)
{
	folders_root_parent_class = g_type_class_peek_parent (klass);
}

static void
folders_root_instance_init (FoldersRoot * self,
                            gpointer klass)
{
}

static GType
folders_root_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FoldersRootClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folders_root_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FoldersRoot), 0, (GInstanceInitFunc) folders_root_instance_init, NULL };
	GType folders_root_type_id;
	folders_root_type_id = g_type_register_static (SIDEBAR_TYPE_HEADER, "FoldersRoot", &g_define_type_info, 0);
	return folders_root_type_id;
}

GType
folders_root_get_type (void)
{
	static volatile gsize folders_root_type_id__once = 0;
	if (g_once_init_enter (&folders_root_type_id__once)) {
		GType folders_root_type_id;
		folders_root_type_id = folders_root_get_type_once ();
		g_once_init_leave (&folders_root_type_id__once, folders_root_type_id);
	}
	return folders_root_type_id__once;
}

static inline gpointer
folders_sidebar_entry_get_instance_private (FoldersSidebarEntry* self)
{
	return G_STRUCT_MEMBER_P (self, FoldersSidebarEntry_private_offset);
}

FoldersSidebarEntry*
folders_sidebar_entry_construct (GType object_type,
                                 GFile* dir)
{
	FoldersSidebarEntry * self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (dir, g_file_get_type ()), NULL);
	self = (FoldersSidebarEntry*) sidebar_simple_page_entry_construct (object_type);
	folders_sidebar_entry_set_dir (self, dir);
	_tmp0_ = sidebar_simple_page_entry_to_string (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, SidebarSimplePageEntry));
	_tmp1_ = _tmp0_;
	_tmp2_ = g_utf8_collate_key_for_filename (_tmp1_, (gssize) -1);
	_tmp3_ = _tmp2_;
	folders_sidebar_entry_set_collation (self, _tmp3_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	return self;
}

FoldersSidebarEntry*
folders_sidebar_entry_new (GFile* dir)
{
	return folders_sidebar_entry_construct (FOLDERS_TYPE_SIDEBAR_ENTRY, dir);
}

static gchar*
folders_sidebar_entry_real_get_sidebar_name (SidebarSimplePageEntry* base)
{
	FoldersSidebarEntry * self;
	GError* _inner_error0_ = NULL;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry);
	{
		GFileInfo* _tmp0_ = NULL;
		GFile* _tmp1_;
		GFileInfo* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp1_ = self->priv->_dir;
		_tmp2_ = g_file_query_info (_tmp1_, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, G_FILE_QUERY_INFO_NONE, NULL, &_inner_error0_);
		_tmp0_ = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = g_file_info_get_display_name (_tmp0_);
		_tmp4_ = g_strdup (_tmp3_);
		result = _tmp4_;
		_g_object_unref0 (_tmp0_);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		gchar* _tmp5_;
		g_clear_error (&_inner_error0_);
		_tmp5_ = sidebar_simple_page_entry_to_string (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, SidebarSimplePageEntry));
		result = _tmp5_;
		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 gchar*
folders_sidebar_entry_real_get_sidebar_icon (SidebarSimplePageEntry* base)
{
	FoldersSidebarEntry * self;
	const gchar* _tmp0_ = NULL;
	gint _tmp1_;
	gint _tmp2_;
	gchar* _tmp5_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry);
	_tmp1_ = folders_sidebar_entry_get_count (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == 0) {
		const gchar* _tmp3_;
		_tmp3_ = folders_icon;
		_tmp0_ = _tmp3_;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = folders_have_photos_icon;
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = g_strdup (_tmp0_);
	result = _tmp5_;
	return result;
}

static gchar*
folders_sidebar_entry_real_to_string (SidebarSimplePageEntry* base)
{
	FoldersSidebarEntry * self;
	GFile* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry);
	_tmp0_ = self->priv->_dir;
	_tmp1_ = g_file_get_path (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_filename_display_name (_tmp2_);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	result = _tmp4_;
	return result;
}

static gboolean
folders_sidebar_entry_real_expand_on_select (SidebarExpandableEntry* base)
{
	FoldersSidebarEntry * self;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry);
	result = TRUE;
	return result;
}

static Page*
folders_sidebar_entry_real_create_page (SidebarSimplePageEntry* base)
{
	FoldersSidebarEntry * self;
	GFile* _tmp0_;
	FoldersPage* _tmp1_;
	Page* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry);
	_tmp0_ = self->priv->_dir;
	_tmp1_ = folders_page_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_PAGE, Page);
	return result;
}

GFile*
folders_sidebar_entry_get_dir (FoldersSidebarEntry* self)
{
	GFile* result;
	GFile* _tmp0_;
	g_return_val_if_fail (FOLDERS_IS_SIDEBAR_ENTRY (self), NULL);
	_tmp0_ = self->priv->_dir;
	result = _tmp0_;
	return result;
}

static void
folders_sidebar_entry_set_dir (FoldersSidebarEntry* self,
                               GFile* value)
{
	GFile* old_value;
	g_return_if_fail (FOLDERS_IS_SIDEBAR_ENTRY (self));
	old_value = folders_sidebar_entry_get_dir (self);
	if (old_value != value) {
		GFile* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_dir);
		self->priv->_dir = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, folders_sidebar_entry_properties[FOLDERS_SIDEBAR_ENTRY_DIR_PROPERTY]);
	}
}

const gchar*
folders_sidebar_entry_get_collation (FoldersSidebarEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (FOLDERS_IS_SIDEBAR_ENTRY (self), NULL);
	_tmp0_ = self->priv->_collation;
	result = _tmp0_;
	return result;
}

static void
folders_sidebar_entry_set_collation (FoldersSidebarEntry* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (FOLDERS_IS_SIDEBAR_ENTRY (self));
	old_value = folders_sidebar_entry_get_collation (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_collation);
		self->priv->_collation = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, folders_sidebar_entry_properties[FOLDERS_SIDEBAR_ENTRY_COLLATION_PROPERTY]);
	}
}

gint
folders_sidebar_entry_get_count (FoldersSidebarEntry* self)
{
	gint result;
	g_return_val_if_fail (FOLDERS_IS_SIDEBAR_ENTRY (self), -1);
	result = self->priv->_count;
	return result;
}

void
folders_sidebar_entry_set_count (FoldersSidebarEntry* self,
                                 gint value)
{
	gint prev_count = 0;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	g_return_if_fail (FOLDERS_IS_SIDEBAR_ENTRY (self));
	prev_count = self->priv->_count;
	self->priv->_count = value;
	if (prev_count == 0) {
		_tmp1_ = self->priv->_count == 1;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp2_ = FALSE;
		if (prev_count == 1) {
			_tmp2_ = self->priv->_count == 0;
		} else {
			_tmp2_ = FALSE;
		}
		_tmp0_ = _tmp2_;
	}
	if (_tmp0_) {
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = sidebar_simple_page_entry_get_sidebar_icon (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, SidebarSimplePageEntry));
		_tmp4_ = _tmp3_;
		g_signal_emit_by_name (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_ENTRY, SidebarEntry), "sidebar-icon-changed", _tmp4_);
		_g_free0 (_tmp4_);
	}
	g_object_notify_by_pspec ((GObject *) self, folders_sidebar_entry_properties[FOLDERS_SIDEBAR_ENTRY_COUNT_PROPERTY]);
}

static void
folders_sidebar_entry_class_init (FoldersSidebarEntryClass * klass,
                                  gpointer klass_data)
{
	folders_sidebar_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FoldersSidebarEntry_private_offset);
	((SidebarSimplePageEntryClass *) klass)->get_sidebar_name = (gchar* (*) (SidebarSimplePageEntry*)) folders_sidebar_entry_real_get_sidebar_name;
	((SidebarSimplePageEntryClass *) klass)->get_sidebar_icon = (gchar* (*) (SidebarSimplePageEntry*)) folders_sidebar_entry_real_get_sidebar_icon;
	((SidebarSimplePageEntryClass *) klass)->to_string = (gchar* (*) (SidebarSimplePageEntry*)) folders_sidebar_entry_real_to_string;
	((SidebarSimplePageEntryClass *) klass)->create_page = (Page* (*) (SidebarSimplePageEntry*)) folders_sidebar_entry_real_create_page;
	G_OBJECT_CLASS (klass)->get_property = _vala_folders_sidebar_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_folders_sidebar_entry_set_property;
	G_OBJECT_CLASS (klass)->finalize = folders_sidebar_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLDERS_SIDEBAR_ENTRY_DIR_PROPERTY, folders_sidebar_entry_properties[FOLDERS_SIDEBAR_ENTRY_DIR_PROPERTY] = g_param_spec_object ("dir", "dir", "dir", g_file_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLDERS_SIDEBAR_ENTRY_COLLATION_PROPERTY, folders_sidebar_entry_properties[FOLDERS_SIDEBAR_ENTRY_COLLATION_PROPERTY] = g_param_spec_string ("collation", "collation", "collation", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLDERS_SIDEBAR_ENTRY_COUNT_PROPERTY, folders_sidebar_entry_properties[FOLDERS_SIDEBAR_ENTRY_COUNT_PROPERTY] = g_param_spec_int ("count", "count", "count", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
folders_sidebar_entry_sidebar_expandable_entry_interface_init (SidebarExpandableEntryIface * iface,
                                                               gpointer iface_data)
{
	folders_sidebar_entry_sidebar_expandable_entry_parent_iface = g_type_interface_peek_parent (iface);
	iface->expand_on_select = (gboolean (*) (SidebarExpandableEntry*)) folders_sidebar_entry_real_expand_on_select;
}

static void
folders_sidebar_entry_instance_init (FoldersSidebarEntry * self,
                                     gpointer klass)
{
	self->priv = folders_sidebar_entry_get_instance_private (self);
	self->priv->_count = 0;
}

static void
folders_sidebar_entry_finalize (GObject * obj)
{
	FoldersSidebarEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry);
	_g_object_unref0 (self->priv->_dir);
	_g_free0 (self->priv->_collation);
	G_OBJECT_CLASS (folders_sidebar_entry_parent_class)->finalize (obj);
}

static GType
folders_sidebar_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FoldersSidebarEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folders_sidebar_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FoldersSidebarEntry), 0, (GInstanceInitFunc) folders_sidebar_entry_instance_init, NULL };
	static const GInterfaceInfo sidebar_expandable_entry_info = { (GInterfaceInitFunc) folders_sidebar_entry_sidebar_expandable_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType folders_sidebar_entry_type_id;
	folders_sidebar_entry_type_id = g_type_register_static (SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, "FoldersSidebarEntry", &g_define_type_info, 0);
	g_type_add_interface_static (folders_sidebar_entry_type_id, SIDEBAR_TYPE_EXPANDABLE_ENTRY, &sidebar_expandable_entry_info);
	FoldersSidebarEntry_private_offset = g_type_add_instance_private (folders_sidebar_entry_type_id, sizeof (FoldersSidebarEntryPrivate));
	return folders_sidebar_entry_type_id;
}

GType
folders_sidebar_entry_get_type (void)
{
	static volatile gsize folders_sidebar_entry_type_id__once = 0;
	if (g_once_init_enter (&folders_sidebar_entry_type_id__once)) {
		GType folders_sidebar_entry_type_id;
		folders_sidebar_entry_type_id = folders_sidebar_entry_get_type_once ();
		g_once_init_leave (&folders_sidebar_entry_type_id__once, folders_sidebar_entry_type_id);
	}
	return folders_sidebar_entry_type_id__once;
}

static void
_vala_folders_sidebar_entry_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	FoldersSidebarEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry);
	switch (property_id) {
		case FOLDERS_SIDEBAR_ENTRY_DIR_PROPERTY:
		g_value_set_object (value, folders_sidebar_entry_get_dir (self));
		break;
		case FOLDERS_SIDEBAR_ENTRY_COLLATION_PROPERTY:
		g_value_set_string (value, folders_sidebar_entry_get_collation (self));
		break;
		case FOLDERS_SIDEBAR_ENTRY_COUNT_PROPERTY:
		g_value_set_int (value, folders_sidebar_entry_get_count (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_folders_sidebar_entry_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	FoldersSidebarEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLDERS_TYPE_SIDEBAR_ENTRY, FoldersSidebarEntry);
	switch (property_id) {
		case FOLDERS_SIDEBAR_ENTRY_DIR_PROPERTY:
		folders_sidebar_entry_set_dir (self, g_value_get_object (value));
		break;
		case FOLDERS_SIDEBAR_ENTRY_COLLATION_PROPERTY:
		folders_sidebar_entry_set_collation (self, g_value_get_string (value));
		break;
		case FOLDERS_SIDEBAR_ENTRY_COUNT_PROPERTY:
		folders_sidebar_entry_set_count (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

