/* folder-list-special-grouping.c generated by valac 0.56.3, the Vala compiler
 * generated from folder-list-special-grouping.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.
 */
/* An ordered grouping meant to go alongside special folders in the account*/
/* branch.*/

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

enum  {
	FOLDER_LIST_SPECIAL_GROUPING_0_PROPERTY,
	FOLDER_LIST_SPECIAL_GROUPING_POSITION_PROPERTY,
	FOLDER_LIST_SPECIAL_GROUPING_NUM_PROPERTIES
};
static GParamSpec* folder_list_special_grouping_properties[FOLDER_LIST_SPECIAL_GROUPING_NUM_PROPERTIES];

struct _FolderListSpecialGroupingPrivate {
	gint _position;
};

static gint FolderListSpecialGrouping_private_offset;
static gpointer folder_list_special_grouping_parent_class = NULL;

static void folder_list_special_grouping_set_position (FolderListSpecialGrouping* self,
                                                gint value);
static void folder_list_special_grouping_finalize (GObject * obj);
static GType folder_list_special_grouping_get_type_once (void);
static void _vala_folder_list_special_grouping_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec);
static void _vala_folder_list_special_grouping_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec);

static inline gpointer
folder_list_special_grouping_get_instance_private (FolderListSpecialGrouping* self)
{
	return G_STRUCT_MEMBER_P (self, FolderListSpecialGrouping_private_offset);
}

gint
folder_list_special_grouping_get_position (FolderListSpecialGrouping* self)
{
	gint result;
	g_return_val_if_fail (FOLDER_LIST_IS_SPECIAL_GROUPING (self), 0);
	result = self->priv->_position;
	return result;
}

static void
folder_list_special_grouping_set_position (FolderListSpecialGrouping* self,
                                           gint value)
{
	gint old_value;
	g_return_if_fail (FOLDER_LIST_IS_SPECIAL_GROUPING (self));
	old_value = folder_list_special_grouping_get_position (self);
	if (old_value != value) {
		self->priv->_position = value;
		g_object_notify_by_pspec ((GObject *) self, folder_list_special_grouping_properties[FOLDER_LIST_SPECIAL_GROUPING_POSITION_PROPERTY]);
	}
}

FolderListSpecialGrouping*
folder_list_special_grouping_construct (GType object_type,
                                        gint position,
                                        const gchar* name,
                                        const gchar* icon,
                                        const gchar* tooltip)
{
	FolderListSpecialGrouping * self = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	self = (FolderListSpecialGrouping*) sidebar_grouping_construct (object_type, name, icon, tooltip);
	folder_list_special_grouping_set_position (self, position);
	return self;
}

FolderListSpecialGrouping*
folder_list_special_grouping_new (gint position,
                                  const gchar* name,
                                  const gchar* icon,
                                  const gchar* tooltip)
{
	return folder_list_special_grouping_construct (FOLDER_LIST_TYPE_SPECIAL_GROUPING, position, name, icon, tooltip);
}

static void
folder_list_special_grouping_class_init (FolderListSpecialGroupingClass * klass,
                                         gpointer klass_data)
{
	folder_list_special_grouping_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FolderListSpecialGrouping_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_folder_list_special_grouping_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_folder_list_special_grouping_set_property;
	G_OBJECT_CLASS (klass)->finalize = folder_list_special_grouping_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLDER_LIST_SPECIAL_GROUPING_POSITION_PROPERTY, folder_list_special_grouping_properties[FOLDER_LIST_SPECIAL_GROUPING_POSITION_PROPERTY] = g_param_spec_int ("position", "position", "position", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
folder_list_special_grouping_instance_init (FolderListSpecialGrouping * self,
                                            gpointer klass)
{
	self->priv = folder_list_special_grouping_get_instance_private (self);
}

static void
folder_list_special_grouping_finalize (GObject * obj)
{
	FolderListSpecialGrouping * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLDER_LIST_TYPE_SPECIAL_GROUPING, FolderListSpecialGrouping);
	G_OBJECT_CLASS (folder_list_special_grouping_parent_class)->finalize (obj);
}

static GType
folder_list_special_grouping_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FolderListSpecialGroupingClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folder_list_special_grouping_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolderListSpecialGrouping), 0, (GInstanceInitFunc) folder_list_special_grouping_instance_init, NULL };
	GType folder_list_special_grouping_type_id;
	folder_list_special_grouping_type_id = g_type_register_static (SIDEBAR_TYPE_GROUPING, "FolderListSpecialGrouping", &g_define_type_info, 0);
	FolderListSpecialGrouping_private_offset = g_type_add_instance_private (folder_list_special_grouping_type_id, sizeof (FolderListSpecialGroupingPrivate));
	return folder_list_special_grouping_type_id;
}

GType
folder_list_special_grouping_get_type (void)
{
	static volatile gsize folder_list_special_grouping_type_id__once = 0;
	if (g_once_init_enter (&folder_list_special_grouping_type_id__once)) {
		GType folder_list_special_grouping_type_id;
		folder_list_special_grouping_type_id = folder_list_special_grouping_get_type_once ();
		g_once_init_leave (&folder_list_special_grouping_type_id__once, folder_list_special_grouping_type_id);
	}
	return folder_list_special_grouping_type_id__once;
}

static void
_vala_folder_list_special_grouping_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec)
{
	FolderListSpecialGrouping * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLDER_LIST_TYPE_SPECIAL_GROUPING, FolderListSpecialGrouping);
	switch (property_id) {
		case FOLDER_LIST_SPECIAL_GROUPING_POSITION_PROPERTY:
		g_value_set_int (value, folder_list_special_grouping_get_position (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_folder_list_special_grouping_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec)
{
	FolderListSpecialGrouping * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLDER_LIST_TYPE_SPECIAL_GROUPING, FolderListSpecialGrouping);
	switch (property_id) {
		case FOLDER_LIST_SPECIAL_GROUPING_POSITION_PROPERTY:
		folder_list_special_grouping_set_position (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

