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

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

#include <glib-object.h>
#include <gee.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.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 SEARCHES_TYPE_BRANCH (searches_branch_get_type ())
#define SEARCHES_BRANCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEARCHES_TYPE_BRANCH, SearchesBranch))
#define SEARCHES_BRANCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEARCHES_TYPE_BRANCH, SearchesBranchClass))
#define SEARCHES_IS_BRANCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEARCHES_TYPE_BRANCH))
#define SEARCHES_IS_BRANCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEARCHES_TYPE_BRANCH))
#define SEARCHES_BRANCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEARCHES_TYPE_BRANCH, SearchesBranchClass))

typedef struct _SearchesBranch SearchesBranch;
typedef struct _SearchesBranchClass SearchesBranchClass;
typedef struct _SearchesBranchPrivate SearchesBranchPrivate;

#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 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_SAVED_SEARCH (saved_search_get_type ())
#define SAVED_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SAVED_SEARCH, SavedSearch))
#define SAVED_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SAVED_SEARCH, SavedSearchClass))
#define IS_SAVED_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SAVED_SEARCH))
#define IS_SAVED_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SAVED_SEARCH))
#define SAVED_SEARCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SAVED_SEARCH, SavedSearchClass))

typedef struct _SavedSearch SavedSearch;
typedef struct _SavedSearchClass SavedSearchClass;

#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 SEARCHES_TYPE_SIDEBAR_ENTRY (searches_sidebar_entry_get_type ())
#define SEARCHES_SIDEBAR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry))
#define SEARCHES_SIDEBAR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntryClass))
#define SEARCHES_IS_SIDEBAR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEARCHES_TYPE_SIDEBAR_ENTRY))
#define SEARCHES_IS_SIDEBAR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEARCHES_TYPE_SIDEBAR_ENTRY))
#define SEARCHES_SIDEBAR_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntryClass))

typedef struct _SearchesSidebarEntry SearchesSidebarEntry;
typedef struct _SearchesSidebarEntryClass SearchesSidebarEntryClass;
enum  {
	SEARCHES_BRANCH_0_PROPERTY,
	SEARCHES_BRANCH_NUM_PROPERTIES
};
static GParamSpec* searches_branch_properties[SEARCHES_BRANCH_NUM_PROPERTIES];

#define TYPE_SAVED_SEARCH_TABLE (saved_search_table_get_type ())
#define SAVED_SEARCH_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SAVED_SEARCH_TABLE, SavedSearchTable))
#define SAVED_SEARCH_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SAVED_SEARCH_TABLE, SavedSearchTableClass))
#define IS_SAVED_SEARCH_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SAVED_SEARCH_TABLE))
#define IS_SAVED_SEARCH_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SAVED_SEARCH_TABLE))
#define SAVED_SEARCH_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SAVED_SEARCH_TABLE, SavedSearchTableClass))

typedef struct _SavedSearchTable SavedSearchTable;
typedef struct _SavedSearchTableClass SavedSearchTableClass;
#define _saved_search_table_unref0(var) ((var == NULL) ? NULL : (var = (saved_search_table_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_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 SEARCHES_TYPE_HEADER (searches_header_get_type ())
#define SEARCHES_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEARCHES_TYPE_HEADER, SearchesHeader))
#define SEARCHES_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEARCHES_TYPE_HEADER, SearchesHeaderClass))
#define SEARCHES_IS_HEADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEARCHES_TYPE_HEADER))
#define SEARCHES_IS_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEARCHES_TYPE_HEADER))
#define SEARCHES_HEADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEARCHES_TYPE_HEADER, SearchesHeaderClass))

typedef struct _SearchesHeader SearchesHeader;
typedef struct _SearchesHeaderClass SearchesHeaderClass;

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

#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 _SearchesHeaderPrivate SearchesHeaderPrivate;
enum  {
	SEARCHES_HEADER_0_PROPERTY,
	SEARCHES_HEADER_NUM_PROPERTIES
};
static GParamSpec* searches_header_properties[SEARCHES_HEADER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_APPLICATION (application_get_type ())
#define APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APPLICATION, Application))
#define APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APPLICATION, ApplicationClass))
#define IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APPLICATION))
#define IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APPLICATION))
#define APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APPLICATION, ApplicationClass))

typedef struct _Application Application;
typedef struct _ApplicationClass ApplicationClass;
#define _application_unref0(var) ((var == NULL) ? NULL : (var = (application_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#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;
typedef struct _SidebarSimplePageEntryPrivate SidebarSimplePageEntryPrivate;

#define SIDEBAR_TYPE_DESTROYABLE_ENTRY (sidebar_destroyable_entry_get_type ())
#define SIDEBAR_DESTROYABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDEBAR_TYPE_DESTROYABLE_ENTRY, SidebarDestroyableEntry))
#define SIDEBAR_IS_DESTROYABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDEBAR_TYPE_DESTROYABLE_ENTRY))
#define SIDEBAR_DESTROYABLE_ENTRY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SIDEBAR_TYPE_DESTROYABLE_ENTRY, SidebarDestroyableEntryIface))

typedef struct _SidebarDestroyableEntry SidebarDestroyableEntry;
typedef struct _SidebarDestroyableEntryIface SidebarDestroyableEntryIface;
typedef struct _SearchesSidebarEntryPrivate SearchesSidebarEntryPrivate;
enum  {
	SEARCHES_SIDEBAR_ENTRY_0_PROPERTY,
	SEARCHES_SIDEBAR_ENTRY_NUM_PROPERTIES
};
static GParamSpec* searches_sidebar_entry_properties[SEARCHES_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 TYPE_SAVED_SEARCH_PAGE (saved_search_page_get_type ())
#define SAVED_SEARCH_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SAVED_SEARCH_PAGE, SavedSearchPage))
#define SAVED_SEARCH_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SAVED_SEARCH_PAGE, SavedSearchPageClass))
#define IS_SAVED_SEARCH_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SAVED_SEARCH_PAGE))
#define IS_SAVED_SEARCH_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SAVED_SEARCH_PAGE))
#define SAVED_SEARCH_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SAVED_SEARCH_PAGE, SavedSearchPageClass))

typedef struct _SavedSearchPage SavedSearchPage;
typedef struct _SavedSearchPageClass SavedSearchPageClass;

#define TYPE_COMMAND_MANAGER (command_manager_get_type ())
#define COMMAND_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMMAND_MANAGER, CommandManager))
#define COMMAND_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMMAND_MANAGER, CommandManagerClass))
#define IS_COMMAND_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMMAND_MANAGER))
#define IS_COMMAND_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMMAND_MANAGER))
#define COMMAND_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COMMAND_MANAGER, CommandManagerClass))

typedef struct _CommandManager CommandManager;
typedef struct _CommandManagerClass CommandManagerClass;

#define TYPE_COMMAND (command_get_type ())
#define COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMMAND, Command))
#define COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMMAND, CommandClass))
#define IS_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMMAND))
#define IS_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMMAND))
#define COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COMMAND, CommandClass))

typedef struct _Command Command;
typedef struct _CommandClass CommandClass;

#define TYPE_PAGE_COMMAND (page_command_get_type ())
#define PAGE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE_COMMAND, PageCommand))
#define PAGE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE_COMMAND, PageCommandClass))
#define IS_PAGE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE_COMMAND))
#define IS_PAGE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE_COMMAND))
#define PAGE_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE_COMMAND, PageCommandClass))

typedef struct _PageCommand PageCommand;
typedef struct _PageCommandClass PageCommandClass;

#define TYPE_SINGLE_DATA_SOURCE_COMMAND (single_data_source_command_get_type ())
#define SINGLE_DATA_SOURCE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SINGLE_DATA_SOURCE_COMMAND, SingleDataSourceCommand))
#define SINGLE_DATA_SOURCE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SINGLE_DATA_SOURCE_COMMAND, SingleDataSourceCommandClass))
#define IS_SINGLE_DATA_SOURCE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SINGLE_DATA_SOURCE_COMMAND))
#define IS_SINGLE_DATA_SOURCE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SINGLE_DATA_SOURCE_COMMAND))
#define SINGLE_DATA_SOURCE_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SINGLE_DATA_SOURCE_COMMAND, SingleDataSourceCommandClass))

typedef struct _SingleDataSourceCommand SingleDataSourceCommand;
typedef struct _SingleDataSourceCommandClass SingleDataSourceCommandClass;

#define TYPE_RENAME_SAVED_SEARCH_COMMAND (rename_saved_search_command_get_type ())
#define RENAME_SAVED_SEARCH_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RENAME_SAVED_SEARCH_COMMAND, RenameSavedSearchCommand))
#define RENAME_SAVED_SEARCH_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RENAME_SAVED_SEARCH_COMMAND, RenameSavedSearchCommandClass))
#define IS_RENAME_SAVED_SEARCH_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RENAME_SAVED_SEARCH_COMMAND))
#define IS_RENAME_SAVED_SEARCH_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RENAME_SAVED_SEARCH_COMMAND))
#define RENAME_SAVED_SEARCH_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RENAME_SAVED_SEARCH_COMMAND, RenameSavedSearchCommandClass))

typedef struct _RenameSavedSearchCommand RenameSavedSearchCommand;
typedef struct _RenameSavedSearchCommandClass RenameSavedSearchCommandClass;
#define _command_manager_unref0(var) ((var == NULL) ? NULL : (var = (command_manager_unref (var), NULL)))

#define TYPE_DELETE_SAVED_SEARCH_COMMAND (delete_saved_search_command_get_type ())
#define DELETE_SAVED_SEARCH_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DELETE_SAVED_SEARCH_COMMAND, DeleteSavedSearchCommand))
#define DELETE_SAVED_SEARCH_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DELETE_SAVED_SEARCH_COMMAND, DeleteSavedSearchCommandClass))
#define IS_DELETE_SAVED_SEARCH_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DELETE_SAVED_SEARCH_COMMAND))
#define IS_DELETE_SAVED_SEARCH_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DELETE_SAVED_SEARCH_COMMAND))
#define DELETE_SAVED_SEARCH_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DELETE_SAVED_SEARCH_COMMAND, DeleteSavedSearchCommandClass))

typedef struct _DeleteSavedSearchCommand DeleteSavedSearchCommand;
typedef struct _DeleteSavedSearchCommandClass DeleteSavedSearchCommandClass;
#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 _SearchesBranch {
	SidebarBranch parent_instance;
	SearchesBranchPrivate * priv;
};

struct _SearchesBranchClass {
	SidebarBranchClass parent_class;
};

struct _SearchesBranchPrivate {
	GeeHashMap* entry_map;
};

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 _SidebarContextableIface {
	GTypeInterface parent_iface;
	GtkMenu* (*get_sidebar_context_menu) (SidebarContextable* self, GdkEventButton* event);
};

struct _SearchesHeader {
	SidebarHeader parent_instance;
	SearchesHeaderPrivate * priv;
};

struct _SearchesHeaderClass {
	SidebarHeaderClass parent_class;
};

struct _SearchesHeaderPrivate {
	GtkBuilder* builder;
	GtkMenu* context_menu;
};

struct _SidebarSelectableEntryIface {
	GTypeInterface parent_iface;
};

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

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 _SidebarDestroyableEntryIface {
	GTypeInterface parent_iface;
	void (*destroy_source) (SidebarDestroyableEntry* self);
};

struct _SearchesSidebarEntry {
	SidebarSimplePageEntry parent_instance;
	SearchesSidebarEntryPrivate * priv;
};

struct _SearchesSidebarEntryClass {
	SidebarSimplePageEntryClass parent_class;
};

struct _SearchesSidebarEntryPrivate {
	SavedSearch* search;
};

static gint SearchesBranch_private_offset;
static gpointer searches_branch_parent_class = NULL;
static gint SearchesHeader_private_offset;
static gpointer searches_header_parent_class = NULL;
static SidebarContextableIface * searches_header_sidebar_contextable_parent_iface = NULL;
static gint SearchesSidebarEntry_private_offset;
static gpointer searches_sidebar_entry_parent_class = NULL;
static gchar* searches_sidebar_entry_single_search_icon;
static gchar* searches_sidebar_entry_single_search_icon = NULL;
static SidebarRenameableEntryIface * searches_sidebar_entry_sidebar_renameable_entry_parent_iface = NULL;
static SidebarDestroyableEntryIface * searches_sidebar_entry_sidebar_destroyable_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 searches_branch_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SearchesBranch, g_object_unref)
VALA_EXTERN GType data_object_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataObject, g_object_unref)
VALA_EXTERN GType data_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataSource, g_object_unref)
VALA_EXTERN GType saved_search_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SavedSearch, 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 searches_sidebar_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SearchesSidebarEntry, g_object_unref)
VALA_EXTERN gpointer saved_search_table_ref (gpointer instance);
VALA_EXTERN void saved_search_table_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_saved_search_table (const gchar* name,
                                           const gchar* nick,
                                           const gchar* blurb,
                                           GType object_type,
                                           GParamFlags flags);
VALA_EXTERN void value_set_saved_search_table (GValue* value,
                                   gpointer v_object);
VALA_EXTERN void value_take_saved_search_table (GValue* value,
                                    gpointer v_object);
VALA_EXTERN gpointer value_get_saved_search_table (const GValue* value);
VALA_EXTERN GType saved_search_table_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SavedSearchTable, saved_search_table_unref)
VALA_EXTERN SavedSearchTable* saved_search_table_get_instance (void);
static void searches_branch_on_saved_search_added (SearchesBranch* self,
                                            SavedSearch* search);
static void _searches_branch_on_saved_search_added_saved_search_table_search_added (SavedSearchTable* _sender,
                                                                             SavedSearch* search,
                                                                             gpointer self);
static void searches_branch_on_saved_search_removed (SearchesBranch* self,
                                              SavedSearch* search);
static void _searches_branch_on_saved_search_removed_saved_search_table_search_removed (SavedSearchTable* _sender,
                                                                                 SavedSearch* search,
                                                                                 gpointer self);
VALA_EXTERN SearchesBranch* searches_branch_new (void);
VALA_EXTERN SearchesBranch* searches_branch_construct (GType object_type);
VALA_EXTERN SearchesHeader* searches_header_new (void);
VALA_EXTERN SearchesHeader* searches_header_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 searches_header_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SearchesHeader, 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 searches_branch_comparator (SidebarEntry* a,
                                 SidebarEntry* b);
static gint _searches_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* saved_search_table_get_all (SavedSearchTable* self);
VALA_EXTERN SearchesSidebarEntry* searches_branch_get_entry_for_saved_search (SearchesBranch* self,
                                                                  SavedSearch* search);
VALA_EXTERN gint saved_search_compare_names (void* a,
                                 void* b);
VALA_EXTERN SavedSearch* searches_sidebar_entry_for_saved_search (SearchesSidebarEntry* self);
VALA_EXTERN SearchesSidebarEntry* searches_sidebar_entry_new (SavedSearch* search);
VALA_EXTERN SearchesSidebarEntry* searches_sidebar_entry_construct (GType object_type,
                                                        SavedSearch* search);
VALA_EXTERN void sidebar_branch_graft (SidebarBranch* self,
                           SidebarEntry* parent,
                           SidebarEntry* entry,
                           GCompareFunc comparator);
VALA_EXTERN SidebarEntry* sidebar_branch_get_root (SidebarBranch* self);
VALA_EXTERN void sidebar_branch_prune (SidebarBranch* self,
                           SidebarEntry* entry);
static void searches_branch_finalize (GObject * obj);
static GType searches_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 GType sidebar_contextable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SidebarContextable, g_object_unref)
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 void searches_header_setup_context_menu (SearchesHeader* self);
VALA_EXTERN gchar* resources_get_ui (const gchar* filename);
VALA_EXTERN void app_window_error_message (const gchar* message,
                               GtkWindow* parent);
VALA_EXTERN gpointer application_ref (gpointer instance);
VALA_EXTERN void application_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_application (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_application (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_application (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_application (const GValue* value);
VALA_EXTERN GType application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Application, application_unref)
VALA_EXTERN Application* application_get_instance (void);
VALA_EXTERN void application_panic (Application* self);
static GtkMenu* searches_header_real_get_sidebar_context_menu (SidebarContextable* base,
                                                        GdkEventButton* event);
VALA_EXTERN GtkMenu* sidebar_contextable_get_sidebar_context_menu (SidebarContextable* self,
                                                       GdkEventButton* event);
static void searches_header_finalize (GObject * obj);
static GType searches_header_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_destroyable_entry_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gchar* sidebar_simple_page_entry_get_sidebar_name (SidebarSimplePageEntry* self);
VALA_EXTERN gchar* sidebar_simple_page_entry_get_sidebar_icon (SidebarSimplePageEntry* self);
VALA_EXTERN Page* sidebar_simple_page_entry_create_page (SidebarSimplePageEntry* self);
VALA_EXTERN SidebarSimplePageEntry* sidebar_simple_page_entry_construct (GType object_type);
VALA_EXTERN void searches_sidebar_entry_init (void);
VALA_EXTERN void searches_sidebar_entry_terminate (void);
static gchar* searches_sidebar_entry_real_get_sidebar_name (SidebarSimplePageEntry* base);
VALA_EXTERN gchar* data_object_get_name (DataObject* self);
static gchar* searches_sidebar_entry_real_get_sidebar_icon (SidebarSimplePageEntry* base);
static Page* searches_sidebar_entry_real_create_page (SidebarSimplePageEntry* base);
VALA_EXTERN SavedSearchPage* saved_search_page_new (SavedSearch* search);
VALA_EXTERN SavedSearchPage* saved_search_page_construct (GType object_type,
                                              SavedSearch* search);
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 saved_search_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SavedSearchPage, g_object_unref)
static gboolean searches_sidebar_entry_real_is_user_renameable (SidebarRenameableEntry* base);
static void searches_sidebar_entry_real_rename (SidebarRenameableEntry* base,
                                         const gchar* new_name);
VALA_EXTERN gboolean saved_search_table_exists (SavedSearchTable* self,
                                    const gchar* search_name);
VALA_EXTERN gpointer command_manager_ref (gpointer instance);
VALA_EXTERN void command_manager_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_command_manager (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_command_manager (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_command_manager (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_command_manager (const GValue* value);
VALA_EXTERN GType command_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CommandManager, command_manager_unref)
VALA_EXTERN CommandManager* app_window_get_command_manager (void);
VALA_EXTERN GType command_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Command, g_object_unref)
VALA_EXTERN void command_manager_execute (CommandManager* self,
                              Command* command);
VALA_EXTERN RenameSavedSearchCommand* rename_saved_search_command_new (SavedSearch* search,
                                                           const gchar* new_name);
VALA_EXTERN RenameSavedSearchCommand* rename_saved_search_command_construct (GType object_type,
                                                                 SavedSearch* search,
                                                                 const gchar* new_name);
VALA_EXTERN GType page_command_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PageCommand, g_object_unref)
VALA_EXTERN GType single_data_source_command_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SingleDataSourceCommand, g_object_unref)
VALA_EXTERN GType rename_saved_search_command_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RenameSavedSearchCommand, g_object_unref)
VALA_EXTERN gchar* resources_rename_search_exists_message (const gchar* name);
static void searches_sidebar_entry_real_destroy_source (SidebarDestroyableEntry* base);
VALA_EXTERN gboolean dialogs_confirm_delete_saved_search (SavedSearch* search);
VALA_EXTERN DeleteSavedSearchCommand* delete_saved_search_command_new (SavedSearch* search);
VALA_EXTERN DeleteSavedSearchCommand* delete_saved_search_command_construct (GType object_type,
                                                                 SavedSearch* search);
VALA_EXTERN GType delete_saved_search_command_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DeleteSavedSearchCommand, g_object_unref)
VALA_EXTERN gboolean sidebar_renameable_entry_is_user_renameable (SidebarRenameableEntry* self);
VALA_EXTERN void sidebar_renameable_entry_rename (SidebarRenameableEntry* self,
                                      const gchar* new_name);
VALA_EXTERN void sidebar_destroyable_entry_destroy_source (SidebarDestroyableEntry* self);
static void searches_sidebar_entry_finalize (GObject * obj);
static GType searches_sidebar_entry_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
searches_branch_get_instance_private (SearchesBranch* self)
{
	return G_STRUCT_MEMBER_P (self, SearchesBranch_private_offset);
}

static void
_searches_branch_on_saved_search_added_saved_search_table_search_added (SavedSearchTable* _sender,
                                                                        SavedSearch* search,
                                                                        gpointer self)
{
	searches_branch_on_saved_search_added ((SearchesBranch*) self, search);
}

static void
_searches_branch_on_saved_search_removed_saved_search_table_search_removed (SavedSearchTable* _sender,
                                                                            SavedSearch* search,
                                                                            gpointer self)
{
	searches_branch_on_saved_search_removed ((SearchesBranch*) self, search);
}

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

SearchesBranch*
searches_branch_construct (GType object_type)
{
	SearchesBranch * self = NULL;
	SearchesHeader* _tmp0_;
	SearchesHeader* _tmp1_;
	SavedSearchTable* _tmp12_;
	SavedSearchTable* _tmp13_;
	SavedSearchTable* _tmp14_;
	SavedSearchTable* _tmp15_;
	_tmp0_ = searches_header_new ();
	_tmp1_ = _tmp0_;
	self = (SearchesBranch*) sidebar_branch_construct (object_type, G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, SIDEBAR_TYPE_ENTRY, SidebarEntry), (SIDEBAR_BRANCH_OPTIONS_HIDE_IF_EMPTY | SIDEBAR_BRANCH_OPTIONS_AUTO_OPEN_ON_NEW_CHILD) | SIDEBAR_BRANCH_OPTIONS_STARTUP_EXPAND_TO_FIRST_CHILD, _searches_branch_comparator_gcompare_func, NULL);
	_g_object_unref0 (_tmp1_);
	{
		GeeIterator* _search_it = NULL;
		SavedSearchTable* _tmp2_;
		SavedSearchTable* _tmp3_;
		GeeCollection* _tmp4_;
		GeeCollection* _tmp5_;
		GeeIterator* _tmp6_;
		GeeIterator* _tmp7_;
		_tmp2_ = saved_search_table_get_instance ();
		_tmp3_ = _tmp2_;
		_tmp4_ = saved_search_table_get_all (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GEE_TYPE_ITERABLE, GeeIterable));
		_tmp7_ = _tmp6_;
		_g_object_unref0 (_tmp5_);
		_saved_search_table_unref0 (_tmp3_);
		_search_it = _tmp7_;
		while (TRUE) {
			GeeIterator* _tmp8_;
			SavedSearch* search = NULL;
			GeeIterator* _tmp9_;
			gpointer _tmp10_;
			SavedSearch* _tmp11_;
			_tmp8_ = _search_it;
			if (!gee_iterator_next (_tmp8_)) {
				break;
			}
			_tmp9_ = _search_it;
			_tmp10_ = gee_iterator_get (_tmp9_);
			search = (SavedSearch*) _tmp10_;
			_tmp11_ = search;
			searches_branch_on_saved_search_added (self, _tmp11_);
			_g_object_unref0 (search);
		}
		_g_object_unref0 (_search_it);
	}
	_tmp12_ = saved_search_table_get_instance ();
	_tmp13_ = _tmp12_;
	g_signal_connect_object (_tmp13_, "search-added", (GCallback) _searches_branch_on_saved_search_added_saved_search_table_search_added, self, 0);
	_saved_search_table_unref0 (_tmp13_);
	_tmp14_ = saved_search_table_get_instance ();
	_tmp15_ = _tmp14_;
	g_signal_connect_object (_tmp15_, "search-removed", (GCallback) _searches_branch_on_saved_search_removed_saved_search_table_search_removed, self, 0);
	_saved_search_table_unref0 (_tmp15_);
	return self;
}

SearchesBranch*
searches_branch_new (void)
{
	return searches_branch_construct (SEARCHES_TYPE_BRANCH);
}

SearchesSidebarEntry*
searches_branch_get_entry_for_saved_search (SearchesBranch* self,
                                            SavedSearch* search)
{
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	SearchesSidebarEntry* result;
	g_return_val_if_fail (SEARCHES_IS_BRANCH (self), NULL);
	g_return_val_if_fail (IS_SAVED_SEARCH (search), NULL);
	_tmp0_ = self->priv->entry_map;
	_tmp1_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), search);
	result = (SearchesSidebarEntry*) _tmp1_;
	return result;
}

static gint
searches_branch_comparator (SidebarEntry* a,
                            SidebarEntry* b)
{
	SavedSearch* _tmp0_;
	SavedSearch* _tmp1_;
	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_ = searches_sidebar_entry_for_saved_search (G_TYPE_CHECK_INSTANCE_CAST (a, SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry));
	_tmp1_ = searches_sidebar_entry_for_saved_search (G_TYPE_CHECK_INSTANCE_CAST (b, SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry));
	result = saved_search_compare_names (_tmp0_, _tmp1_);
	return result;
}

static void
searches_branch_on_saved_search_added (SearchesBranch* self,
                                       SavedSearch* search)
{
	SearchesSidebarEntry* entry = NULL;
	SearchesSidebarEntry* _tmp0_;
	GeeHashMap* _tmp1_;
	SidebarEntry* _tmp2_;
	SidebarEntry* _tmp3_;
	g_return_if_fail (SEARCHES_IS_BRANCH (self));
	g_return_if_fail (IS_SAVED_SEARCH (search));
	g_debug ("SearchesBranch.vala:45: search added");
	_tmp0_ = searches_sidebar_entry_new (search);
	entry = _tmp0_;
	_tmp1_ = self->priv->entry_map;
	gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), search, entry);
	_tmp2_ = sidebar_branch_get_root (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_BRANCH, SidebarBranch));
	_tmp3_ = _tmp2_;
	sidebar_branch_graft (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_BRANCH, SidebarBranch), _tmp3_, G_TYPE_CHECK_INSTANCE_CAST (entry, SIDEBAR_TYPE_ENTRY, SidebarEntry), NULL);
	_g_object_unref0 (_tmp3_);
	_g_object_unref0 (entry);
}

static void
searches_branch_on_saved_search_removed (SearchesBranch* self,
                                         SavedSearch* search)
{
	SearchesSidebarEntry* entry = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	gboolean is_removed = FALSE;
	GeeHashMap* _tmp2_;
	g_return_if_fail (SEARCHES_IS_BRANCH (self));
	g_return_if_fail (IS_SAVED_SEARCH (search));
	g_debug ("SearchesBranch.vala:52: search removed");
	_tmp0_ = self->priv->entry_map;
	_tmp1_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), search);
	entry = (SearchesSidebarEntry*) _tmp1_;
	_vala_assert (entry != NULL, "entry != null");
	_tmp2_ = self->priv->entry_map;
	is_removed = gee_abstract_map_unset (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), search, NULL);
	_vala_assert (is_removed, "is_removed");
	sidebar_branch_prune (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_BRANCH, SidebarBranch), G_TYPE_CHECK_INSTANCE_CAST (entry, SIDEBAR_TYPE_ENTRY, SidebarEntry));
	_g_object_unref0 (entry);
}

static void
searches_branch_class_init (SearchesBranchClass * klass,
                            gpointer klass_data)
{
	searches_branch_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SearchesBranch_private_offset);
	G_OBJECT_CLASS (klass)->finalize = searches_branch_finalize;
}

static void
searches_branch_instance_init (SearchesBranch * self,
                               gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = searches_branch_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (TYPE_SAVED_SEARCH, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, SEARCHES_TYPE_SIDEBAR_ENTRY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->entry_map = _tmp0_;
}

static void
searches_branch_finalize (GObject * obj)
{
	SearchesBranch * self;
	SavedSearchTable* _tmp0_;
	SavedSearchTable* _tmp1_;
	guint _tmp2_;
	SavedSearchTable* _tmp3_;
	SavedSearchTable* _tmp4_;
	guint _tmp5_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEARCHES_TYPE_BRANCH, SearchesBranch);
	_tmp0_ = saved_search_table_get_instance ();
	_tmp1_ = _tmp0_;
	g_signal_parse_name ("search-added", TYPE_SAVED_SEARCH_TABLE, &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _searches_branch_on_saved_search_added_saved_search_table_search_added, self);
	_saved_search_table_unref0 (_tmp1_);
	_tmp3_ = saved_search_table_get_instance ();
	_tmp4_ = _tmp3_;
	g_signal_parse_name ("search-removed", TYPE_SAVED_SEARCH_TABLE, &_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) _searches_branch_on_saved_search_removed_saved_search_table_search_removed, self);
	_saved_search_table_unref0 (_tmp4_);
	_g_object_unref0 (self->priv->entry_map);
	G_OBJECT_CLASS (searches_branch_parent_class)->finalize (obj);
}

static GType
searches_branch_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SearchesBranchClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) searches_branch_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SearchesBranch), 0, (GInstanceInitFunc) searches_branch_instance_init, NULL };
	GType searches_branch_type_id;
	searches_branch_type_id = g_type_register_static (SIDEBAR_TYPE_BRANCH, "SearchesBranch", &g_define_type_info, 0);
	SearchesBranch_private_offset = g_type_add_instance_private (searches_branch_type_id, sizeof (SearchesBranchPrivate));
	return searches_branch_type_id;
}

GType
searches_branch_get_type (void)
{
	static volatile gsize searches_branch_type_id__once = 0;
	if (g_once_init_enter (&searches_branch_type_id__once)) {
		GType searches_branch_type_id;
		searches_branch_type_id = searches_branch_get_type_once ();
		g_once_init_leave (&searches_branch_type_id__once, searches_branch_type_id);
	}
	return searches_branch_type_id__once;
}

static inline gpointer
searches_header_get_instance_private (SearchesHeader* self)
{
	return G_STRUCT_MEMBER_P (self, SearchesHeader_private_offset);
}

SearchesHeader*
searches_header_construct (GType object_type)
{
	SearchesHeader * self = NULL;
	self = (SearchesHeader*) sidebar_header_construct (object_type, _ ("Saved Searches"), _ ("Organize your saved searches"), TRUE);
	searches_header_setup_context_menu (self);
	return self;
}

SearchesHeader*
searches_header_new (void)
{
	return searches_header_construct (SEARCHES_TYPE_HEADER);
}

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

static void
searches_header_setup_context_menu (SearchesHeader* self)
{
	GtkBuilder* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (SEARCHES_IS_HEADER (self));
	_tmp0_ = gtk_builder_new ();
	_g_object_unref0 (self->priv->builder);
	self->priv->builder = _tmp0_;
	{
		GtkBuilder* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		GMenuModel* model = NULL;
		GtkBuilder* _tmp4_;
		GObject* _tmp5_;
		GMenuModel* _tmp6_;
		GMenuModel* _tmp7_;
		GtkMenu* _tmp8_;
		_tmp1_ = self->priv->builder;
		_tmp2_ = resources_get_ui ("search_sidebar_context.ui");
		_tmp3_ = _tmp2_;
		gtk_builder_add_from_resource (_tmp1_, _tmp3_, &_inner_error0_);
		_g_free0 (_tmp3_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp4_ = self->priv->builder;
		_tmp5_ = gtk_builder_get_object (_tmp4_, "popup-menu");
		_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, g_menu_model_get_type ()) ? ((GMenuModel*) _tmp5_) : NULL);
		model = _tmp6_;
		_tmp7_ = model;
		_tmp8_ = (GtkMenu*) gtk_menu_new_from_model (_tmp7_);
		g_object_ref_sink (_tmp8_);
		_g_object_unref0 (self->priv->context_menu);
		self->priv->context_menu = _tmp8_;
		_g_object_unref0 (model);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp9_;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		Application* _tmp13_;
		Application* _tmp14_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp9_ = _error_;
		_tmp10_ = _tmp9_->message;
		_tmp11_ = g_strdup_printf ("Error loading UI resource: %s", _tmp10_);
		_tmp12_ = _tmp11_;
		app_window_error_message (_tmp12_, NULL);
		_g_free0 (_tmp12_);
		_tmp13_ = application_get_instance ();
		_tmp14_ = _tmp13_;
		application_panic (_tmp14_);
		_application_unref0 (_tmp14_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static GtkMenu*
searches_header_real_get_sidebar_context_menu (SidebarContextable* base,
                                               GdkEventButton* event)
{
	SearchesHeader * self;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp1_;
	GtkMenu* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SEARCHES_TYPE_HEADER, SearchesHeader);
	_tmp0_ = self->priv->context_menu;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
searches_header_class_init (SearchesHeaderClass * klass,
                            gpointer klass_data)
{
	searches_header_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SearchesHeader_private_offset);
	G_OBJECT_CLASS (klass)->finalize = searches_header_finalize;
}

static void
searches_header_sidebar_contextable_interface_init (SidebarContextableIface * iface,
                                                    gpointer iface_data)
{
	searches_header_sidebar_contextable_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_sidebar_context_menu = (GtkMenu* (*) (SidebarContextable*, GdkEventButton*)) searches_header_real_get_sidebar_context_menu;
}

static void
searches_header_instance_init (SearchesHeader * self,
                               gpointer klass)
{
	self->priv = searches_header_get_instance_private (self);
	self->priv->context_menu = NULL;
}

static void
searches_header_finalize (GObject * obj)
{
	SearchesHeader * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEARCHES_TYPE_HEADER, SearchesHeader);
	_g_object_unref0 (self->priv->builder);
	_g_object_unref0 (self->priv->context_menu);
	G_OBJECT_CLASS (searches_header_parent_class)->finalize (obj);
}

static GType
searches_header_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SearchesHeaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) searches_header_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SearchesHeader), 0, (GInstanceInitFunc) searches_header_instance_init, NULL };
	static const GInterfaceInfo sidebar_contextable_info = { (GInterfaceInitFunc) searches_header_sidebar_contextable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType searches_header_type_id;
	searches_header_type_id = g_type_register_static (SIDEBAR_TYPE_HEADER, "SearchesHeader", &g_define_type_info, 0);
	g_type_add_interface_static (searches_header_type_id, SIDEBAR_TYPE_CONTEXTABLE, &sidebar_contextable_info);
	SearchesHeader_private_offset = g_type_add_instance_private (searches_header_type_id, sizeof (SearchesHeaderPrivate));
	return searches_header_type_id;
}

GType
searches_header_get_type (void)
{
	static volatile gsize searches_header_type_id__once = 0;
	if (g_once_init_enter (&searches_header_type_id__once)) {
		GType searches_header_type_id;
		searches_header_type_id = searches_header_get_type_once ();
		g_once_init_leave (&searches_header_type_id__once, searches_header_type_id);
	}
	return searches_header_type_id__once;
}

static inline gpointer
searches_sidebar_entry_get_instance_private (SearchesSidebarEntry* self)
{
	return G_STRUCT_MEMBER_P (self, SearchesSidebarEntry_private_offset);
}

SearchesSidebarEntry*
searches_sidebar_entry_construct (GType object_type,
                                  SavedSearch* search)
{
	SearchesSidebarEntry * self = NULL;
	SavedSearch* _tmp0_;
	g_return_val_if_fail (IS_SAVED_SEARCH (search), NULL);
	self = (SearchesSidebarEntry*) sidebar_simple_page_entry_construct (object_type);
	_tmp0_ = _g_object_ref0 (search);
	_g_object_unref0 (self->priv->search);
	self->priv->search = _tmp0_;
	return self;
}

SearchesSidebarEntry*
searches_sidebar_entry_new (SavedSearch* search)
{
	return searches_sidebar_entry_construct (SEARCHES_TYPE_SIDEBAR_ENTRY, search);
}

void
searches_sidebar_entry_init (void)
{
}

void
searches_sidebar_entry_terminate (void)
{
}

SavedSearch*
searches_sidebar_entry_for_saved_search (SearchesSidebarEntry* self)
{
	SavedSearch* _tmp0_;
	SavedSearch* _tmp1_;
	SavedSearch* result;
	g_return_val_if_fail (SEARCHES_IS_SIDEBAR_ENTRY (self), NULL);
	_tmp0_ = self->priv->search;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
searches_sidebar_entry_real_get_sidebar_name (SidebarSimplePageEntry* base)
{
	SearchesSidebarEntry * self;
	SavedSearch* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry);
	_tmp0_ = self->priv->search;
	_tmp1_ = data_object_get_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_DATA_OBJECT, DataObject));
	result = _tmp1_;
	return result;
}

static gchar*
searches_sidebar_entry_real_get_sidebar_icon (SidebarSimplePageEntry* base)
{
	SearchesSidebarEntry * self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry);
	_tmp0_ = searches_sidebar_entry_single_search_icon;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static Page*
searches_sidebar_entry_real_create_page (SidebarSimplePageEntry* base)
{
	SearchesSidebarEntry * self;
	SavedSearch* _tmp0_;
	SavedSearchPage* _tmp1_;
	Page* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry);
	_tmp0_ = self->priv->search;
	_tmp1_ = saved_search_page_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_PAGE, Page);
	return result;
}

static gboolean
searches_sidebar_entry_real_is_user_renameable (SidebarRenameableEntry* base)
{
	SearchesSidebarEntry * self;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry);
	result = TRUE;
	return result;
}

static void
searches_sidebar_entry_real_rename (SidebarRenameableEntry* base,
                                    const gchar* new_name)
{
	SearchesSidebarEntry * self;
	SavedSearchTable* _tmp0_;
	SavedSearchTable* _tmp1_;
	gboolean _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry);
	g_return_if_fail (new_name != NULL);
	_tmp0_ = saved_search_table_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = !saved_search_table_exists (_tmp1_, new_name);
	_saved_search_table_unref0 (_tmp1_);
	if (_tmp2_) {
		CommandManager* _tmp3_;
		CommandManager* _tmp4_;
		SavedSearch* _tmp5_;
		RenameSavedSearchCommand* _tmp6_;
		RenameSavedSearchCommand* _tmp7_;
		_tmp3_ = app_window_get_command_manager ();
		_tmp4_ = _tmp3_;
		_tmp5_ = self->priv->search;
		_tmp6_ = rename_saved_search_command_new (_tmp5_, new_name);
		_tmp7_ = _tmp6_;
		command_manager_execute (_tmp4_, G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, TYPE_COMMAND, Command));
		_g_object_unref0 (_tmp7_);
		_command_manager_unref0 (_tmp4_);
	} else {
		SavedSearch* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gboolean _tmp11_;
		_tmp8_ = self->priv->search;
		_tmp9_ = data_object_get_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, TYPE_DATA_OBJECT, DataObject));
		_tmp10_ = _tmp9_;
		_tmp11_ = g_strcmp0 (new_name, _tmp10_) != 0;
		_g_free0 (_tmp10_);
		if (_tmp11_) {
			gchar* _tmp12_;
			gchar* _tmp13_;
			_tmp12_ = resources_rename_search_exists_message (new_name);
			_tmp13_ = _tmp12_;
			app_window_error_message (_tmp13_, NULL);
			_g_free0 (_tmp13_);
		}
	}
}

static void
searches_sidebar_entry_real_destroy_source (SidebarDestroyableEntry* base)
{
	SearchesSidebarEntry * self;
	SavedSearch* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry);
	_tmp0_ = self->priv->search;
	if (dialogs_confirm_delete_saved_search (_tmp0_)) {
		CommandManager* _tmp1_;
		CommandManager* _tmp2_;
		SavedSearch* _tmp3_;
		DeleteSavedSearchCommand* _tmp4_;
		DeleteSavedSearchCommand* _tmp5_;
		_tmp1_ = app_window_get_command_manager ();
		_tmp2_ = _tmp1_;
		_tmp3_ = self->priv->search;
		_tmp4_ = delete_saved_search_command_new (_tmp3_);
		_tmp5_ = _tmp4_;
		command_manager_execute (_tmp2_, G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, TYPE_COMMAND, Command));
		_g_object_unref0 (_tmp5_);
		_command_manager_unref0 (_tmp2_);
	}
}

static void
searches_sidebar_entry_class_init (SearchesSidebarEntryClass * klass,
                                   gpointer klass_data)
{
	gchar* _tmp0_;
	searches_sidebar_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SearchesSidebarEntry_private_offset);
	((SidebarSimplePageEntryClass *) klass)->get_sidebar_name = (gchar* (*) (SidebarSimplePageEntry*)) searches_sidebar_entry_real_get_sidebar_name;
	((SidebarSimplePageEntryClass *) klass)->get_sidebar_icon = (gchar* (*) (SidebarSimplePageEntry*)) searches_sidebar_entry_real_get_sidebar_icon;
	((SidebarSimplePageEntryClass *) klass)->create_page = (Page* (*) (SidebarSimplePageEntry*)) searches_sidebar_entry_real_create_page;
	G_OBJECT_CLASS (klass)->finalize = searches_sidebar_entry_finalize;
	_tmp0_ = g_strdup ("edit-find-symbolic");
	searches_sidebar_entry_single_search_icon = _tmp0_;
}

static void
searches_sidebar_entry_sidebar_renameable_entry_interface_init (SidebarRenameableEntryIface * iface,
                                                                gpointer iface_data)
{
	searches_sidebar_entry_sidebar_renameable_entry_parent_iface = g_type_interface_peek_parent (iface);
	iface->is_user_renameable = (gboolean (*) (SidebarRenameableEntry*)) searches_sidebar_entry_real_is_user_renameable;
	iface->rename = (void (*) (SidebarRenameableEntry*, const gchar*)) searches_sidebar_entry_real_rename;
}

static void
searches_sidebar_entry_sidebar_destroyable_entry_interface_init (SidebarDestroyableEntryIface * iface,
                                                                 gpointer iface_data)
{
	searches_sidebar_entry_sidebar_destroyable_entry_parent_iface = g_type_interface_peek_parent (iface);
	iface->destroy_source = (void (*) (SidebarDestroyableEntry*)) searches_sidebar_entry_real_destroy_source;
}

static void
searches_sidebar_entry_instance_init (SearchesSidebarEntry * self,
                                      gpointer klass)
{
	self->priv = searches_sidebar_entry_get_instance_private (self);
}

static void
searches_sidebar_entry_finalize (GObject * obj)
{
	SearchesSidebarEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEARCHES_TYPE_SIDEBAR_ENTRY, SearchesSidebarEntry);
	_g_object_unref0 (self->priv->search);
	G_OBJECT_CLASS (searches_sidebar_entry_parent_class)->finalize (obj);
}

static GType
searches_sidebar_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SearchesSidebarEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) searches_sidebar_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SearchesSidebarEntry), 0, (GInstanceInitFunc) searches_sidebar_entry_instance_init, NULL };
	static const GInterfaceInfo sidebar_renameable_entry_info = { (GInterfaceInitFunc) searches_sidebar_entry_sidebar_renameable_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo sidebar_destroyable_entry_info = { (GInterfaceInitFunc) searches_sidebar_entry_sidebar_destroyable_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType searches_sidebar_entry_type_id;
	searches_sidebar_entry_type_id = g_type_register_static (SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, "SearchesSidebarEntry", &g_define_type_info, 0);
	g_type_add_interface_static (searches_sidebar_entry_type_id, SIDEBAR_TYPE_RENAMEABLE_ENTRY, &sidebar_renameable_entry_info);
	g_type_add_interface_static (searches_sidebar_entry_type_id, SIDEBAR_TYPE_DESTROYABLE_ENTRY, &sidebar_destroyable_entry_info);
	SearchesSidebarEntry_private_offset = g_type_add_instance_private (searches_sidebar_entry_type_id, sizeof (SearchesSidebarEntryPrivate));
	return searches_sidebar_entry_type_id;
}

GType
searches_sidebar_entry_get_type (void)
{
	static volatile gsize searches_sidebar_entry_type_id__once = 0;
	if (g_once_init_enter (&searches_sidebar_entry_type_id__once)) {
		GType searches_sidebar_entry_type_id;
		searches_sidebar_entry_type_id = searches_sidebar_entry_get_type_once ();
		g_once_init_leave (&searches_sidebar_entry_type_id__once, searches_sidebar_entry_type_id);
	}
	return searches_sidebar_entry_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;
}

