/* geary-base-object.c generated by valac 0.56.3, the Vala compiler
 * generated from geary-base-object.vala, do not modify */

/*
 * Copyright 2016 Software Freedom Conservancy Inc.
 * Copyright 2018 Michael Gratton <mike@vee.net>
 *
 * 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-engine.h"
#include <stdio.h>
#include <glib.h>
#include <glib-object.h>

enum  {
	GEARY_BASE_OBJECT_0_PROPERTY,
	GEARY_BASE_OBJECT_NUM_PROPERTIES
};
static GParamSpec* geary_base_object_properties[GEARY_BASE_OBJECT_NUM_PROPERTIES];

static gpointer geary_base_object_parent_class = NULL;
static GearyBaseInterfaceIface * geary_base_object_geary_base_interface_parent_iface = NULL;

static GObject * geary_base_object_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
static void geary_base_object_finalize (GObject * obj);
static GType geary_base_object_get_type_once (void);
static GType geary_base_interface_get_type_once (void);

/**
     * Dumps reference counting logs to the given stream.
     *
     * This method prints a list of reference-counted classes, and the
     * number of times each was constructed and destructed along with
     * a flag indicating those that are not equal. If reference
     * tracking was not enabled at compile-time, this is no-op.
     */
void
geary_base_object_dump_refs (FILE* outs)
{
	g_return_if_fail (outs != NULL);
}

GearyBaseObject*
geary_base_object_construct (GType object_type)
{
	GearyBaseObject * self = NULL;
	self = (GearyBaseObject*) g_object_new (object_type, NULL);
	return self;
}

static GObject *
geary_base_object_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GearyBaseObject * self;
	parent_class = G_OBJECT_CLASS (geary_base_object_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEARY_TYPE_BASE_OBJECT, GearyBaseObject);
	return obj;
}

static void
geary_base_object_class_init (GearyBaseObjectClass * klass,
                              gpointer klass_data)
{
	geary_base_object_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = geary_base_object_constructor;
	G_OBJECT_CLASS (klass)->finalize = geary_base_object_finalize;
}

static void
geary_base_object_geary_base_interface_interface_init (GearyBaseInterfaceIface * iface,
                                                       gpointer iface_data)
{
	geary_base_object_geary_base_interface_parent_iface = g_type_interface_peek_parent (iface);
}

static void
geary_base_object_instance_init (GearyBaseObject * self,
                                 gpointer klass)
{
}

static void
geary_base_object_finalize (GObject * obj)
{
	GearyBaseObject * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEARY_TYPE_BASE_OBJECT, GearyBaseObject);
	G_OBJECT_CLASS (geary_base_object_parent_class)->finalize (obj);
}

/**
 * Common parent class for Geary Engine objects.
 *
 * Most Engine classes should be derived from this class to be able to
 * access common functionality.
 *
 * Currently, this class enables automatic application-based reference
 * tracking of objects, which can assist in tracking down memory
 * leaks. To enable this, set the //ref_track// compile time option to
 * true and compile. An application can then call {@link dump_refs} to
 * output a list of objects with both instantiation and destruction
 * counts.
 *
 * This class can only be used for classes that would otherwise derive
 * directly from GLib.Object. If a class must be derived from some
 * other pre-existing class, it is possible to use {@link
 * BaseInterface} as a mixin with a little extra work instead.
 */
 G_GNUC_NO_INLINE static GType
geary_base_object_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyBaseObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_base_object_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyBaseObject), 0, (GInstanceInitFunc) geary_base_object_instance_init, NULL };
	static const GInterfaceInfo geary_base_interface_info = { (GInterfaceInitFunc) geary_base_object_geary_base_interface_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType geary_base_object_type_id;
	geary_base_object_type_id = g_type_register_static (G_TYPE_OBJECT, "GearyBaseObject", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	g_type_add_interface_static (geary_base_object_type_id, GEARY_TYPE_BASE_INTERFACE, &geary_base_interface_info);
	return geary_base_object_type_id;
}

GType
geary_base_object_get_type (void)
{
	static gsize geary_base_object_type_id__once = 0;
	if (g_once_init_enter (&geary_base_object_type_id__once)) {
		GType geary_base_object_type_id;
		geary_base_object_type_id = geary_base_object_get_type_once ();
		g_once_init_leave (&geary_base_object_type_id__once, geary_base_object_type_id);
	}
	return geary_base_object_type_id__once;
}

/**
     * Increments the reference count for the implementing class.
     *
     * Implementing classes should call this as soon as possible after
     * the base class's constructor is called. This method is a no-op
     * if reference tracking is not enabled at compile-time.
     */
void
geary_base_interface_base_ref (GearyBaseInterface* self)
{
}

/**
     * Decrements the reference count for the implementing class.
     *
     * Implementing classes should call this at the end of the class's
     * destructor. This method is a no-op if reference tracking is not
     * enabled at compile-time.
     */
void
geary_base_interface_base_unref (GearyBaseInterface* self)
{
}

static void
geary_base_interface_default_init (GearyBaseInterfaceIface * iface,
                                   gpointer iface_data)
{
}

/**
 * Base mixin interface for Engine objects derived from another.
 *
 * This interface provides an analogue to {@link BaseObject} for
 * objects that must be derived from an existing class, such a GTK
 * widget. Since this is simply a mixin, some additional work is
 * required to use this interface compared to BaseObject.
 *
 * To use this interface, declare it as a parent of your class and
 * call {@link base_ref} immediately after the base constructor is
 * called, and call {@link base_unref} at the end of the destructor:
 *
 *     public class CustomWidget : Gtk.Widget, Geary.BaseInterface {
 *
 *         public CustomWidget() {
 *              base_ref();
 *              ...
 *         }
 *
 *         ~CustomWidget() {
 *              ...
 *              base_unref();
 *         }
 *
 *     }
 *
 * Care must be taken to ensure that if {@link base_unref} is not
 * called for an instance if {@link base_ref} was not called.
 */
 G_GNUC_NO_INLINE static GType
geary_base_interface_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyBaseInterfaceIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_base_interface_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType geary_base_interface_type_id;
	geary_base_interface_type_id = g_type_register_static (G_TYPE_INTERFACE, "GearyBaseInterface", &g_define_type_info, 0);
	return geary_base_interface_type_id;
}

GType
geary_base_interface_get_type (void)
{
	static gsize geary_base_interface_type_id__once = 0;
	if (g_once_init_enter (&geary_base_interface_type_id__once)) {
		GType geary_base_interface_type_id;
		geary_base_interface_type_id = geary_base_interface_get_type_once ();
		g_once_init_leave (&geary_base_interface_type_id__once, geary_base_interface_type_id);
	}
	return geary_base_interface_type_id__once;
}

