/* folder-list-abstract-folder-entry.c generated by valac 0.56.3, the Vala compiler
 * generated from folder-list-abstract-folder-entry.vala, do not modify */

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

#include "geary-client-43.0.h"
#include "geary-engine.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>

enum  {
	FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_0_PROPERTY,
	FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_FOLDER_PROPERTY,
	FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_NUM_PROPERTIES
};
static GParamSpec* folder_list_abstract_folder_entry_properties[FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _FolderListAbstractFolderEntryPrivate {
	GearyFolder* _folder;
};

static gint FolderListAbstractFolderEntry_private_offset;
static gpointer folder_list_abstract_folder_entry_parent_class = NULL;
static SidebarEntryIface * folder_list_abstract_folder_entry_sidebar_entry_parent_iface = NULL;
static SidebarSelectableEntryIface * folder_list_abstract_folder_entry_sidebar_selectable_entry_parent_iface = NULL;

static void folder_list_abstract_folder_entry_set_folder (FolderListAbstractFolderEntry* self,
                                                   GearyFolder* value);
static gchar* folder_list_abstract_folder_entry_real_get_sidebar_name (FolderListAbstractFolderEntry* self);
static gchar* folder_list_abstract_folder_entry_real_get_sidebar_tooltip (FolderListAbstractFolderEntry* self);
static gchar* folder_list_abstract_folder_entry_real_get_sidebar_icon (FolderListAbstractFolderEntry* self);
static gint folder_list_abstract_folder_entry_real_get_count (FolderListAbstractFolderEntry* self);
static gchar* folder_list_abstract_folder_entry_real_to_string (FolderListAbstractFolderEntry* self);
static void folder_list_abstract_folder_entry_finalize (GObject * obj);
static GType folder_list_abstract_folder_entry_get_type_once (void);
static void _vala_folder_list_abstract_folder_entry_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void _vala_folder_list_abstract_folder_entry_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);

static inline gpointer
folder_list_abstract_folder_entry_get_instance_private (FolderListAbstractFolderEntry* self)
{
	return G_STRUCT_MEMBER_P (self, FolderListAbstractFolderEntry_private_offset);
}

GearyFolder*
folder_list_abstract_folder_entry_get_folder (FolderListAbstractFolderEntry* self)
{
	GearyFolder* result;
	GearyFolder* _tmp0_;
	g_return_val_if_fail (FOLDER_LIST_IS_ABSTRACT_FOLDER_ENTRY (self), NULL);
	_tmp0_ = self->priv->_folder;
	result = _tmp0_;
	return result;
}

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

static void
folder_list_abstract_folder_entry_set_folder (FolderListAbstractFolderEntry* self,
                                              GearyFolder* value)
{
	GearyFolder* old_value;
	g_return_if_fail (FOLDER_LIST_IS_ABSTRACT_FOLDER_ENTRY (self));
	old_value = folder_list_abstract_folder_entry_get_folder (self);
	if (old_value != value) {
		GearyFolder* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_folder);
		self->priv->_folder = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, folder_list_abstract_folder_entry_properties[FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_FOLDER_PROPERTY]);
	}
}

FolderListAbstractFolderEntry*
folder_list_abstract_folder_entry_construct (GType object_type,
                                             GearyFolder* folder)
{
	FolderListAbstractFolderEntry * self = NULL;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (folder, GEARY_TYPE_FOLDER), NULL);
	self = (FolderListAbstractFolderEntry*) geary_base_object_construct (object_type);
	folder_list_abstract_folder_entry_set_folder (self, folder);
	return self;
}

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

gchar*
folder_list_abstract_folder_entry_get_sidebar_name (FolderListAbstractFolderEntry* self)
{
	FolderListAbstractFolderEntryClass* _klass_;
	g_return_val_if_fail (FOLDER_LIST_IS_ABSTRACT_FOLDER_ENTRY (self), NULL);
	_klass_ = FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_GET_CLASS (self);
	if (_klass_->get_sidebar_name) {
		return _klass_->get_sidebar_name (self);
	}
	return NULL;
}

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

gchar*
folder_list_abstract_folder_entry_get_sidebar_tooltip (FolderListAbstractFolderEntry* self)
{
	FolderListAbstractFolderEntryClass* _klass_;
	g_return_val_if_fail (FOLDER_LIST_IS_ABSTRACT_FOLDER_ENTRY (self), NULL);
	_klass_ = FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_GET_CLASS (self);
	if (_klass_->get_sidebar_tooltip) {
		return _klass_->get_sidebar_tooltip (self);
	}
	return NULL;
}

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

gchar*
folder_list_abstract_folder_entry_get_sidebar_icon (FolderListAbstractFolderEntry* self)
{
	FolderListAbstractFolderEntryClass* _klass_;
	g_return_val_if_fail (FOLDER_LIST_IS_ABSTRACT_FOLDER_ENTRY (self), NULL);
	_klass_ = FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_GET_CLASS (self);
	if (_klass_->get_sidebar_icon) {
		return _klass_->get_sidebar_icon (self);
	}
	return NULL;
}

static gint
folder_list_abstract_folder_entry_real_get_count (FolderListAbstractFolderEntry* self)
{
	gint _tmp0_ = 0;
	g_critical ("Type `%s' does not implement abstract method `folder_list_abstract_folder_entry_get_count'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return _tmp0_;
}

gint
folder_list_abstract_folder_entry_get_count (FolderListAbstractFolderEntry* self)
{
	FolderListAbstractFolderEntryClass* _klass_;
	g_return_val_if_fail (FOLDER_LIST_IS_ABSTRACT_FOLDER_ENTRY (self), 0);
	_klass_ = FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_GET_CLASS (self);
	if (_klass_->get_count) {
		return _klass_->get_count (self);
	}
	return -1;
}

static gchar*
folder_list_abstract_folder_entry_real_to_string (FolderListAbstractFolderEntry* self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	_tmp0_ = folder_list_abstract_folder_entry_get_sidebar_name (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat ("AbstractFolderEntry: ", _tmp1_, NULL);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

gchar*
folder_list_abstract_folder_entry_to_string (FolderListAbstractFolderEntry* self)
{
	FolderListAbstractFolderEntryClass* _klass_;
	g_return_val_if_fail (FOLDER_LIST_IS_ABSTRACT_FOLDER_ENTRY (self), NULL);
	_klass_ = FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_GET_CLASS (self);
	if (_klass_->to_string) {
		return _klass_->to_string (self);
	}
	return NULL;
}

static void
folder_list_abstract_folder_entry_class_init (FolderListAbstractFolderEntryClass * klass,
                                              gpointer klass_data)
{
	folder_list_abstract_folder_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FolderListAbstractFolderEntry_private_offset);
	((FolderListAbstractFolderEntryClass *) klass)->get_sidebar_name = (gchar* (*) (FolderListAbstractFolderEntry*)) folder_list_abstract_folder_entry_real_get_sidebar_name;
	((FolderListAbstractFolderEntryClass *) klass)->get_sidebar_tooltip = (gchar* (*) (FolderListAbstractFolderEntry*)) folder_list_abstract_folder_entry_real_get_sidebar_tooltip;
	((FolderListAbstractFolderEntryClass *) klass)->get_sidebar_icon = (gchar* (*) (FolderListAbstractFolderEntry*)) folder_list_abstract_folder_entry_real_get_sidebar_icon;
	((FolderListAbstractFolderEntryClass *) klass)->get_count = (gint (*) (FolderListAbstractFolderEntry*)) folder_list_abstract_folder_entry_real_get_count;
	((FolderListAbstractFolderEntryClass *) klass)->to_string = (gchar* (*) (FolderListAbstractFolderEntry*)) folder_list_abstract_folder_entry_real_to_string;
	G_OBJECT_CLASS (klass)->get_property = _vala_folder_list_abstract_folder_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_folder_list_abstract_folder_entry_set_property;
	G_OBJECT_CLASS (klass)->finalize = folder_list_abstract_folder_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_FOLDER_PROPERTY, folder_list_abstract_folder_entry_properties[FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_FOLDER_PROPERTY] = g_param_spec_object ("folder", "folder", "folder", GEARY_TYPE_FOLDER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
folder_list_abstract_folder_entry_sidebar_entry_interface_init (SidebarEntryIface * iface,
                                                                gpointer iface_data)
{
	folder_list_abstract_folder_entry_sidebar_entry_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_sidebar_name = (gchar* (*) (SidebarEntry*)) folder_list_abstract_folder_entry_get_sidebar_name;
	iface->get_sidebar_tooltip = (gchar* (*) (SidebarEntry*)) folder_list_abstract_folder_entry_get_sidebar_tooltip;
	iface->get_sidebar_icon = (gchar* (*) (SidebarEntry*)) folder_list_abstract_folder_entry_get_sidebar_icon;
	iface->get_count = (gint (*) (SidebarEntry*)) folder_list_abstract_folder_entry_get_count;
	iface->to_string = (gchar* (*) (SidebarEntry*)) folder_list_abstract_folder_entry_to_string;
}

static void
folder_list_abstract_folder_entry_sidebar_selectable_entry_interface_init (SidebarSelectableEntryIface * iface,
                                                                           gpointer iface_data)
{
	folder_list_abstract_folder_entry_sidebar_selectable_entry_parent_iface = g_type_interface_peek_parent (iface);
}

static void
folder_list_abstract_folder_entry_instance_init (FolderListAbstractFolderEntry * self,
                                                 gpointer klass)
{
	self->priv = folder_list_abstract_folder_entry_get_instance_private (self);
}

static void
folder_list_abstract_folder_entry_finalize (GObject * obj)
{
	FolderListAbstractFolderEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry);
	_g_object_unref0 (self->priv->_folder);
	G_OBJECT_CLASS (folder_list_abstract_folder_entry_parent_class)->finalize (obj);
}

/**
 * Abstract base class for sidebar entries that represent folders.  This covers only
 * the basics needed for any type of folder, and is intended to work with both local
 * and remote folder types.
 */
static GType
folder_list_abstract_folder_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FolderListAbstractFolderEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folder_list_abstract_folder_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolderListAbstractFolderEntry), 0, (GInstanceInitFunc) folder_list_abstract_folder_entry_instance_init, NULL };
	static const GInterfaceInfo sidebar_entry_info = { (GInterfaceInitFunc) folder_list_abstract_folder_entry_sidebar_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo sidebar_selectable_entry_info = { (GInterfaceInitFunc) folder_list_abstract_folder_entry_sidebar_selectable_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType folder_list_abstract_folder_entry_type_id;
	folder_list_abstract_folder_entry_type_id = g_type_register_static (GEARY_TYPE_BASE_OBJECT, "FolderListAbstractFolderEntry", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	g_type_add_interface_static (folder_list_abstract_folder_entry_type_id, SIDEBAR_TYPE_ENTRY, &sidebar_entry_info);
	g_type_add_interface_static (folder_list_abstract_folder_entry_type_id, SIDEBAR_TYPE_SELECTABLE_ENTRY, &sidebar_selectable_entry_info);
	FolderListAbstractFolderEntry_private_offset = g_type_add_instance_private (folder_list_abstract_folder_entry_type_id, sizeof (FolderListAbstractFolderEntryPrivate));
	return folder_list_abstract_folder_entry_type_id;
}

GType
folder_list_abstract_folder_entry_get_type (void)
{
	static volatile gsize folder_list_abstract_folder_entry_type_id__once = 0;
	if (g_once_init_enter (&folder_list_abstract_folder_entry_type_id__once)) {
		GType folder_list_abstract_folder_entry_type_id;
		folder_list_abstract_folder_entry_type_id = folder_list_abstract_folder_entry_get_type_once ();
		g_once_init_leave (&folder_list_abstract_folder_entry_type_id__once, folder_list_abstract_folder_entry_type_id);
	}
	return folder_list_abstract_folder_entry_type_id__once;
}

static void
_vala_folder_list_abstract_folder_entry_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	FolderListAbstractFolderEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry);
	switch (property_id) {
		case FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_FOLDER_PROPERTY:
		g_value_set_object (value, folder_list_abstract_folder_entry_get_folder (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_folder_list_abstract_folder_entry_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	FolderListAbstractFolderEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry);
	switch (property_id) {
		case FOLDER_LIST_ABSTRACT_FOLDER_ENTRY_FOLDER_PROPERTY:
		folder_list_abstract_folder_entry_set_folder (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

