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

/*
* Copyright (c) 2011-2013 Yorba Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/* A simple grouping Entry that is only expandable*/

#include "io.elementary.photos.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>

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

enum  {
	SIDEBAR_GROUPING_0_PROPERTY,
	SIDEBAR_GROUPING_NUM_PROPERTIES
};
static GParamSpec* sidebar_grouping_properties[SIDEBAR_GROUPING_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	SIDEBAR_SIMPLE_PAGE_ENTRY_0_PROPERTY,
	SIDEBAR_SIMPLE_PAGE_ENTRY_NUM_PROPERTIES
};
static GParamSpec* sidebar_simple_page_entry_properties[SIDEBAR_SIMPLE_PAGE_ENTRY_NUM_PROPERTIES];
enum  {
	SIDEBAR_ROOT_ONLY_BRANCH_0_PROPERTY,
	SIDEBAR_ROOT_ONLY_BRANCH_NUM_PROPERTIES
};
static GParamSpec* sidebar_root_only_branch_properties[SIDEBAR_ROOT_ONLY_BRANCH_NUM_PROPERTIES];

struct _SidebarGroupingPrivate {
	gchar* name;
	GIcon* open_icon;
	GIcon* closed_icon;
};

struct _SidebarSimplePageEntryPrivate {
	Page* page;
};

static gint SidebarGrouping_private_offset;
static gpointer sidebar_grouping_parent_class = NULL;
static SidebarEntryIface * sidebar_grouping_sidebar_entry_parent_iface = NULL;
static SidebarExpandableEntryIface * sidebar_grouping_sidebar_expandable_entry_parent_iface = NULL;
static gint SidebarSimplePageEntry_private_offset;
static gpointer sidebar_simple_page_entry_parent_class = NULL;
static SidebarEntryIface * sidebar_simple_page_entry_sidebar_entry_parent_iface = NULL;
static SidebarSelectableEntryIface * sidebar_simple_page_entry_sidebar_selectable_entry_parent_iface = NULL;
static SidebarPageRepresentativeIface * sidebar_simple_page_entry_sidebar_page_representative_parent_iface = NULL;
static SidebarContextableIface * sidebar_simple_page_entry_sidebar_contextable_parent_iface = NULL;
static gpointer sidebar_root_only_branch_parent_class = NULL;

static gchar* sidebar_grouping_real_get_sidebar_name (SidebarEntry* base);
static gchar* sidebar_grouping_real_get_sidebar_tooltip (SidebarEntry* base);
static GIcon* sidebar_grouping_real_get_sidebar_icon (SidebarEntry* base);
static GIcon* sidebar_grouping_real_get_sidebar_open_icon (SidebarExpandableEntry* base);
static GIcon* sidebar_grouping_real_get_sidebar_closed_icon (SidebarExpandableEntry* base);
static gchar* sidebar_grouping_real_to_string (SidebarEntry* base);
static gboolean sidebar_grouping_real_expand_on_select (SidebarExpandableEntry* base);
static void sidebar_grouping_finalize (GObject * obj);
static GType sidebar_grouping_get_type_once (void);
static gchar* sidebar_simple_page_entry_real_get_sidebar_name (SidebarSimplePageEntry* self);
static gchar* sidebar_simple_page_entry_real_get_sidebar_tooltip (SidebarSimplePageEntry* self);
static GIcon* sidebar_simple_page_entry_real_get_sidebar_icon (SidebarSimplePageEntry* self);
static gchar* sidebar_simple_page_entry_real_to_string (SidebarSimplePageEntry* self);
static Page* sidebar_simple_page_entry_real_create_page (SidebarSimplePageEntry* self);
static gboolean sidebar_simple_page_entry_real_has_page (SidebarPageRepresentative* base);
static Page* sidebar_simple_page_entry_real_get_page (SidebarPageRepresentative* base);
static void sidebar_simple_page_entry_real_pruned (SidebarEntry* base,
                                            SidebarTree* tree);
static GtkMenu* sidebar_simple_page_entry_real_get_sidebar_context_menu (SidebarContextable* base,
                                                                  GdkEventButton* event);
VALA_EXTERN void sidebar_entry_pruned (SidebarEntry* self,
                           SidebarTree* tree);
static void sidebar_simple_page_entry_finalize (GObject * obj);
static GType sidebar_simple_page_entry_get_type_once (void);
static gint sidebar_root_only_branch_null_comparator (SidebarEntry* a,
                                               SidebarEntry* b);
static gint _sidebar_root_only_branch_null_comparator_gcompare_func (gconstpointer a,
                                                              gconstpointer b);
static GType sidebar_root_only_branch_get_type_once (void);
static GType sidebar_contextable_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
sidebar_grouping_get_instance_private (SidebarGrouping* self)
{
	return G_STRUCT_MEMBER_P (self, SidebarGrouping_private_offset);
}

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

SidebarGrouping*
sidebar_grouping_construct (GType object_type,
                            const gchar* name,
                            GIcon* open_icon,
                            GIcon* closed_icon)
{
	SidebarGrouping * self = NULL;
	gchar* _tmp0_;
	GIcon* _tmp1_;
	GIcon* _tmp2_ = NULL;
	GIcon* _tmp3_;
	g_return_val_if_fail (name != NULL, NULL);
	self = (SidebarGrouping*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (name);
	_g_free0 (self->priv->name);
	self->priv->name = _tmp0_;
	_tmp1_ = _g_object_ref0 (open_icon);
	_g_object_unref0 (self->priv->open_icon);
	self->priv->open_icon = _tmp1_;
	_tmp2_ = closed_icon;
	if (_tmp2_ == NULL) {
		_tmp2_ = open_icon;
	}
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->closed_icon);
	self->priv->closed_icon = _tmp3_;
	return self;
}

SidebarGrouping*
sidebar_grouping_new (const gchar* name,
                      GIcon* open_icon,
                      GIcon* closed_icon)
{
	return sidebar_grouping_construct (SIDEBAR_TYPE_GROUPING, name, open_icon, closed_icon);
}

static gchar*
sidebar_grouping_real_get_sidebar_name (SidebarEntry* base)
{
	SidebarGrouping * self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	self = (SidebarGrouping*) base;
	_tmp0_ = self->priv->name;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
sidebar_grouping_real_get_sidebar_tooltip (SidebarEntry* base)
{
	SidebarGrouping * self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	self = (SidebarGrouping*) base;
	_tmp0_ = self->priv->name;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static GIcon*
sidebar_grouping_real_get_sidebar_icon (SidebarEntry* base)
{
	SidebarGrouping * self;
	GIcon* result;
	self = (SidebarGrouping*) base;
	result = NULL;
	return result;
}

static GIcon*
sidebar_grouping_real_get_sidebar_open_icon (SidebarExpandableEntry* base)
{
	SidebarGrouping * self;
	GIcon* _tmp0_;
	GIcon* _tmp1_;
	GIcon* result;
	self = (SidebarGrouping*) base;
	_tmp0_ = self->priv->open_icon;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static GIcon*
sidebar_grouping_real_get_sidebar_closed_icon (SidebarExpandableEntry* base)
{
	SidebarGrouping * self;
	GIcon* _tmp0_;
	GIcon* _tmp1_;
	GIcon* result;
	self = (SidebarGrouping*) base;
	_tmp0_ = self->priv->closed_icon;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
sidebar_grouping_real_to_string (SidebarEntry* base)
{
	SidebarGrouping * self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	self = (SidebarGrouping*) base;
	_tmp0_ = self->priv->name;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static gboolean
sidebar_grouping_real_expand_on_select (SidebarExpandableEntry* base)
{
	SidebarGrouping * self;
	gboolean result;
	self = (SidebarGrouping*) base;
	result = TRUE;
	return result;
}

static void
sidebar_grouping_class_init (SidebarGroupingClass * klass,
                             gpointer klass_data)
{
	sidebar_grouping_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SidebarGrouping_private_offset);
	G_OBJECT_CLASS (klass)->finalize = sidebar_grouping_finalize;
}

static void
sidebar_grouping_sidebar_entry_interface_init (SidebarEntryIface * iface,
                                               gpointer iface_data)
{
	sidebar_grouping_sidebar_entry_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_sidebar_name = (gchar* (*) (SidebarEntry*)) sidebar_grouping_real_get_sidebar_name;
	iface->get_sidebar_tooltip = (gchar* (*) (SidebarEntry*)) sidebar_grouping_real_get_sidebar_tooltip;
	iface->get_sidebar_icon = (GIcon* (*) (SidebarEntry*)) sidebar_grouping_real_get_sidebar_icon;
	iface->to_string = (gchar* (*) (SidebarEntry*)) sidebar_grouping_real_to_string;
}

static void
sidebar_grouping_sidebar_expandable_entry_interface_init (SidebarExpandableEntryIface * iface,
                                                          gpointer iface_data)
{
	sidebar_grouping_sidebar_expandable_entry_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_sidebar_open_icon = (GIcon* (*) (SidebarExpandableEntry*)) sidebar_grouping_real_get_sidebar_open_icon;
	iface->get_sidebar_closed_icon = (GIcon* (*) (SidebarExpandableEntry*)) sidebar_grouping_real_get_sidebar_closed_icon;
	iface->expand_on_select = (gboolean (*) (SidebarExpandableEntry*)) sidebar_grouping_real_expand_on_select;
}

static void
sidebar_grouping_instance_init (SidebarGrouping * self,
                                gpointer klass)
{
	self->priv = sidebar_grouping_get_instance_private (self);
}

static void
sidebar_grouping_finalize (GObject * obj)
{
	SidebarGrouping * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDEBAR_TYPE_GROUPING, SidebarGrouping);
	_g_free0 (self->priv->name);
	_g_object_unref0 (self->priv->open_icon);
	_g_object_unref0 (self->priv->closed_icon);
	G_OBJECT_CLASS (sidebar_grouping_parent_class)->finalize (obj);
}

static GType
sidebar_grouping_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SidebarGroupingClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sidebar_grouping_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SidebarGrouping), 0, (GInstanceInitFunc) sidebar_grouping_instance_init, NULL };
	static const GInterfaceInfo sidebar_entry_info = { (GInterfaceInitFunc) sidebar_grouping_sidebar_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo sidebar_expandable_entry_info = { (GInterfaceInitFunc) sidebar_grouping_sidebar_expandable_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType sidebar_grouping_type_id;
	sidebar_grouping_type_id = g_type_register_static (G_TYPE_OBJECT, "SidebarGrouping", &g_define_type_info, 0);
	g_type_add_interface_static (sidebar_grouping_type_id, SIDEBAR_TYPE_ENTRY, &sidebar_entry_info);
	g_type_add_interface_static (sidebar_grouping_type_id, SIDEBAR_TYPE_EXPANDABLE_ENTRY, &sidebar_expandable_entry_info);
	SidebarGrouping_private_offset = g_type_add_instance_private (sidebar_grouping_type_id, sizeof (SidebarGroupingPrivate));
	return sidebar_grouping_type_id;
}

GType
sidebar_grouping_get_type (void)
{
	static volatile gsize sidebar_grouping_type_id__once = 0;
	if (g_once_init_enter (&sidebar_grouping_type_id__once)) {
		GType sidebar_grouping_type_id;
		sidebar_grouping_type_id = sidebar_grouping_get_type_once ();
		g_once_init_leave (&sidebar_grouping_type_id__once, sidebar_grouping_type_id);
	}
	return sidebar_grouping_type_id__once;
}

static inline gpointer
sidebar_simple_page_entry_get_instance_private (SidebarSimplePageEntry* self)
{
	return G_STRUCT_MEMBER_P (self, SidebarSimplePageEntry_private_offset);
}

SidebarSimplePageEntry*
sidebar_simple_page_entry_construct (GType object_type)
{
	SidebarSimplePageEntry * self = NULL;
	self = (SidebarSimplePageEntry*) g_object_new (object_type, NULL);
	return self;
}

static gchar*
sidebar_simple_page_entry_real_get_sidebar_name (SidebarSimplePageEntry* self)
{
	g_critical ("Type `%s' does not implement abstract method `sidebar_simple_page_entry_get_sidebar_name'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

gchar*
sidebar_simple_page_entry_get_sidebar_name (SidebarSimplePageEntry* self)
{
	SidebarSimplePageEntryClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = SIDEBAR_SIMPLE_PAGE_ENTRY_GET_CLASS (self);
	if (_klass_->get_sidebar_name) {
		return _klass_->get_sidebar_name (self);
	}
	return NULL;
}

static gchar*
sidebar_simple_page_entry_real_get_sidebar_tooltip (SidebarSimplePageEntry* self)
{
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = sidebar_simple_page_entry_get_sidebar_name (self);
	result = _tmp0_;
	return result;
}

gchar*
sidebar_simple_page_entry_get_sidebar_tooltip (SidebarSimplePageEntry* self)
{
	SidebarSimplePageEntryClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = SIDEBAR_SIMPLE_PAGE_ENTRY_GET_CLASS (self);
	if (_klass_->get_sidebar_tooltip) {
		return _klass_->get_sidebar_tooltip (self);
	}
	return NULL;
}

static GIcon*
sidebar_simple_page_entry_real_get_sidebar_icon (SidebarSimplePageEntry* self)
{
	g_critical ("Type `%s' does not implement abstract method `sidebar_simple_page_entry_get_sidebar_icon'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

GIcon*
sidebar_simple_page_entry_get_sidebar_icon (SidebarSimplePageEntry* self)
{
	SidebarSimplePageEntryClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = SIDEBAR_SIMPLE_PAGE_ENTRY_GET_CLASS (self);
	if (_klass_->get_sidebar_icon) {
		return _klass_->get_sidebar_icon (self);
	}
	return NULL;
}

static gchar*
sidebar_simple_page_entry_real_to_string (SidebarSimplePageEntry* self)
{
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = sidebar_simple_page_entry_get_sidebar_name (self);
	result = _tmp0_;
	return result;
}

gchar*
sidebar_simple_page_entry_to_string (SidebarSimplePageEntry* self)
{
	SidebarSimplePageEntryClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = SIDEBAR_SIMPLE_PAGE_ENTRY_GET_CLASS (self);
	if (_klass_->to_string) {
		return _klass_->to_string (self);
	}
	return NULL;
}

static Page*
sidebar_simple_page_entry_real_create_page (SidebarSimplePageEntry* self)
{
	g_critical ("Type `%s' does not implement abstract method `sidebar_simple_page_entry_create_page'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

Page*
sidebar_simple_page_entry_create_page (SidebarSimplePageEntry* self)
{
	SidebarSimplePageEntryClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = SIDEBAR_SIMPLE_PAGE_ENTRY_GET_CLASS (self);
	if (_klass_->create_page) {
		return _klass_->create_page (self);
	}
	return NULL;
}

static gboolean
sidebar_simple_page_entry_real_has_page (SidebarPageRepresentative* base)
{
	SidebarSimplePageEntry * self;
	Page* _tmp0_;
	gboolean result;
	self = (SidebarSimplePageEntry*) base;
	_tmp0_ = self->priv->page;
	result = _tmp0_ != NULL;
	return result;
}

static Page*
sidebar_simple_page_entry_real_get_page (SidebarPageRepresentative* base)
{
	SidebarSimplePageEntry * self;
	Page* _tmp0_;
	Page* _tmp3_;
	Page* _tmp4_;
	Page* result;
	self = (SidebarSimplePageEntry*) base;
	_tmp0_ = self->priv->page;
	if (_tmp0_ == NULL) {
		Page* _tmp1_;
		Page* _tmp2_;
		_tmp1_ = sidebar_simple_page_entry_create_page (self);
		_g_object_unref0 (self->priv->page);
		self->priv->page = _tmp1_;
		_tmp2_ = self->priv->page;
		g_signal_emit_by_name ((SidebarPageRepresentative*) self, "page-created", _tmp2_);
	}
	_tmp3_ = self->priv->page;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	result = _tmp4_;
	return result;
}

static void
sidebar_simple_page_entry_real_pruned (SidebarEntry* base,
                                       SidebarTree* tree)
{
	SidebarSimplePageEntry * self;
	Page* _tmp0_;
	Page* _tmp1_;
	Page* _tmp2_;
	self = (SidebarSimplePageEntry*) base;
	g_return_if_fail (tree != NULL);
	_tmp0_ = self->priv->page;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->page;
	g_signal_emit_by_name ((SidebarPageRepresentative*) self, "destroying-page", _tmp1_);
	_tmp2_ = self->priv->page;
	gtk_widget_destroy ((GtkWidget*) _tmp2_);
	_g_object_unref0 (self->priv->page);
	self->priv->page = NULL;
}

static GtkMenu*
sidebar_simple_page_entry_real_get_sidebar_context_menu (SidebarContextable* base,
                                                         GdkEventButton* event)
{
	SidebarSimplePageEntry * self;
	Page* _tmp0_;
	Page* _tmp1_;
	GtkMenu* _tmp2_;
	GtkMenu* _tmp3_;
	GtkMenu* result;
	self = (SidebarSimplePageEntry*) base;
	_tmp0_ = sidebar_page_representative_get_page ((SidebarPageRepresentative*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = page_get_page_sidebar_menu (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static void
sidebar_simple_page_entry_class_init (SidebarSimplePageEntryClass * klass,
                                      gpointer klass_data)
{
	sidebar_simple_page_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SidebarSimplePageEntry_private_offset);
	((SidebarSimplePageEntryClass *) klass)->get_sidebar_name = (gchar* (*) (SidebarSimplePageEntry*)) sidebar_simple_page_entry_real_get_sidebar_name;
	((SidebarSimplePageEntryClass *) klass)->get_sidebar_tooltip = (gchar* (*) (SidebarSimplePageEntry*)) sidebar_simple_page_entry_real_get_sidebar_tooltip;
	((SidebarSimplePageEntryClass *) klass)->get_sidebar_icon = (GIcon* (*) (SidebarSimplePageEntry*)) sidebar_simple_page_entry_real_get_sidebar_icon;
	((SidebarSimplePageEntryClass *) klass)->to_string = (gchar* (*) (SidebarSimplePageEntry*)) sidebar_simple_page_entry_real_to_string;
	((SidebarSimplePageEntryClass *) klass)->create_page = (Page* (*) (SidebarSimplePageEntry*)) sidebar_simple_page_entry_real_create_page;
	G_OBJECT_CLASS (klass)->finalize = sidebar_simple_page_entry_finalize;
}

static void
sidebar_simple_page_entry_sidebar_entry_interface_init (SidebarEntryIface * iface,
                                                        gpointer iface_data)
{
	sidebar_simple_page_entry_sidebar_entry_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_sidebar_name = (gchar* (*) (SidebarEntry*)) sidebar_simple_page_entry_get_sidebar_name;
	iface->get_sidebar_tooltip = (gchar* (*) (SidebarEntry*)) sidebar_simple_page_entry_get_sidebar_tooltip;
	iface->get_sidebar_icon = (GIcon* (*) (SidebarEntry*)) sidebar_simple_page_entry_get_sidebar_icon;
	iface->to_string = (gchar* (*) (SidebarEntry*)) sidebar_simple_page_entry_to_string;
	iface->pruned = (void (*) (SidebarEntry*, SidebarTree*)) sidebar_simple_page_entry_real_pruned;
}

static void
sidebar_simple_page_entry_sidebar_selectable_entry_interface_init (SidebarSelectableEntryIface * iface,
                                                                   gpointer iface_data)
{
	sidebar_simple_page_entry_sidebar_selectable_entry_parent_iface = g_type_interface_peek_parent (iface);
}

static void
sidebar_simple_page_entry_sidebar_page_representative_interface_init (SidebarPageRepresentativeIface * iface,
                                                                      gpointer iface_data)
{
	sidebar_simple_page_entry_sidebar_page_representative_parent_iface = g_type_interface_peek_parent (iface);
	iface->has_page = (gboolean (*) (SidebarPageRepresentative*)) sidebar_simple_page_entry_real_has_page;
	iface->get_page = (Page* (*) (SidebarPageRepresentative*)) sidebar_simple_page_entry_real_get_page;
}

static void
sidebar_simple_page_entry_sidebar_contextable_interface_init (SidebarContextableIface * iface,
                                                              gpointer iface_data)
{
	sidebar_simple_page_entry_sidebar_contextable_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_sidebar_context_menu = (GtkMenu* (*) (SidebarContextable*, GdkEventButton*)) sidebar_simple_page_entry_real_get_sidebar_context_menu;
}

static void
sidebar_simple_page_entry_instance_init (SidebarSimplePageEntry * self,
                                         gpointer klass)
{
	self->priv = sidebar_simple_page_entry_get_instance_private (self);
	self->priv->page = NULL;
}

static void
sidebar_simple_page_entry_finalize (GObject * obj)
{
	SidebarSimplePageEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDEBAR_TYPE_SIMPLE_PAGE_ENTRY, SidebarSimplePageEntry);
	_g_object_unref0 (self->priv->page);
	G_OBJECT_CLASS (sidebar_simple_page_entry_parent_class)->finalize (obj);
}

static GType
sidebar_simple_page_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SidebarSimplePageEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sidebar_simple_page_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SidebarSimplePageEntry), 0, (GInstanceInitFunc) sidebar_simple_page_entry_instance_init, NULL };
	static const GInterfaceInfo sidebar_entry_info = { (GInterfaceInitFunc) sidebar_simple_page_entry_sidebar_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo sidebar_selectable_entry_info = { (GInterfaceInitFunc) sidebar_simple_page_entry_sidebar_selectable_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo sidebar_page_representative_info = { (GInterfaceInitFunc) sidebar_simple_page_entry_sidebar_page_representative_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo sidebar_contextable_info = { (GInterfaceInitFunc) sidebar_simple_page_entry_sidebar_contextable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType sidebar_simple_page_entry_type_id;
	sidebar_simple_page_entry_type_id = g_type_register_static (G_TYPE_OBJECT, "SidebarSimplePageEntry", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	g_type_add_interface_static (sidebar_simple_page_entry_type_id, SIDEBAR_TYPE_ENTRY, &sidebar_entry_info);
	g_type_add_interface_static (sidebar_simple_page_entry_type_id, SIDEBAR_TYPE_SELECTABLE_ENTRY, &sidebar_selectable_entry_info);
	g_type_add_interface_static (sidebar_simple_page_entry_type_id, SIDEBAR_TYPE_PAGE_REPRESENTATIVE, &sidebar_page_representative_info);
	g_type_add_interface_static (sidebar_simple_page_entry_type_id, SIDEBAR_TYPE_CONTEXTABLE, &sidebar_contextable_info);
	SidebarSimplePageEntry_private_offset = g_type_add_instance_private (sidebar_simple_page_entry_type_id, sizeof (SidebarSimplePageEntryPrivate));
	return sidebar_simple_page_entry_type_id;
}

GType
sidebar_simple_page_entry_get_type (void)
{
	static volatile gsize sidebar_simple_page_entry_type_id__once = 0;
	if (g_once_init_enter (&sidebar_simple_page_entry_type_id__once)) {
		GType sidebar_simple_page_entry_type_id;
		sidebar_simple_page_entry_type_id = sidebar_simple_page_entry_get_type_once ();
		g_once_init_leave (&sidebar_simple_page_entry_type_id__once, sidebar_simple_page_entry_type_id);
	}
	return sidebar_simple_page_entry_type_id__once;
}

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

SidebarRootOnlyBranch*
sidebar_root_only_branch_construct (GType object_type,
                                    SidebarEntry* root)
{
	SidebarRootOnlyBranch * self = NULL;
	g_return_val_if_fail (root != NULL, NULL);
	self = (SidebarRootOnlyBranch*) sidebar_branch_construct (object_type, root, SIDEBAR_BRANCH_OPTIONS_NONE, _sidebar_root_only_branch_null_comparator_gcompare_func, NULL);
	return self;
}

SidebarRootOnlyBranch*
sidebar_root_only_branch_new (SidebarEntry* root)
{
	return sidebar_root_only_branch_construct (SIDEBAR_TYPE_ROOT_ONLY_BRANCH, root);
}

static gint
sidebar_root_only_branch_null_comparator (SidebarEntry* a,
                                          SidebarEntry* b)
{
	gint _tmp0_ = 0;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	if (a != b) {
		_tmp0_ = -1;
	} else {
		_tmp0_ = 0;
	}
	result = _tmp0_;
	return result;
}

static void
sidebar_root_only_branch_class_init (SidebarRootOnlyBranchClass * klass,
                                     gpointer klass_data)
{
	sidebar_root_only_branch_parent_class = g_type_class_peek_parent (klass);
}

static void
sidebar_root_only_branch_instance_init (SidebarRootOnlyBranch * self,
                                        gpointer klass)
{
}

static GType
sidebar_root_only_branch_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SidebarRootOnlyBranchClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sidebar_root_only_branch_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SidebarRootOnlyBranch), 0, (GInstanceInitFunc) sidebar_root_only_branch_instance_init, NULL };
	GType sidebar_root_only_branch_type_id;
	sidebar_root_only_branch_type_id = g_type_register_static (SIDEBAR_TYPE_BRANCH, "SidebarRootOnlyBranch", &g_define_type_info, 0);
	return sidebar_root_only_branch_type_id;
}

GType
sidebar_root_only_branch_get_type (void)
{
	static volatile gsize sidebar_root_only_branch_type_id__once = 0;
	if (g_once_init_enter (&sidebar_root_only_branch_type_id__once)) {
		GType sidebar_root_only_branch_type_id;
		sidebar_root_only_branch_type_id = sidebar_root_only_branch_get_type_once ();
		g_once_init_leave (&sidebar_root_only_branch_type_id__once, sidebar_root_only_branch_type_id);
	}
	return sidebar_root_only_branch_type_id__once;
}

GtkMenu*
sidebar_contextable_get_sidebar_context_menu (SidebarContextable* self,
                                              GdkEventButton* event)
{
	SidebarContextableIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = SIDEBAR_CONTEXTABLE_GET_INTERFACE (self);
	if (_iface_->get_sidebar_context_menu) {
		return _iface_->get_sidebar_context_menu (self, event);
	}
	return NULL;
}

static void
sidebar_contextable_default_init (SidebarContextableIface * iface,
                                  gpointer iface_data)
{
}

static GType
sidebar_contextable_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SidebarContextableIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sidebar_contextable_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType sidebar_contextable_type_id;
	sidebar_contextable_type_id = g_type_register_static (G_TYPE_INTERFACE, "SidebarContextable", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (sidebar_contextable_type_id, G_TYPE_OBJECT);
	return sidebar_contextable_type_id;
}

GType
sidebar_contextable_get_type (void)
{
	static volatile gsize sidebar_contextable_type_id__once = 0;
	if (g_once_init_enter (&sidebar_contextable_type_id__once)) {
		GType sidebar_contextable_type_id;
		sidebar_contextable_type_id = sidebar_contextable_get_type_once ();
		g_once_init_leave (&sidebar_contextable_type_id__once, sidebar_contextable_type_id);
	}
	return sidebar_contextable_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;
}

