/* baobab-location-monitor.c generated by valac 0.17.1.35-814b, the Vala compiler
 * generated from baobab-location-monitor.vala, do not modify */

/* -*- indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* Baobab - disk usage analyzer
 *
 * Copyright (C) 2012  Stefano Facchini <stefano.facchini@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * 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.
 */

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <gobject/gvaluecollector.h>


#define BAOBAB_TYPE_LOCATION_MONITOR (baobab_location_monitor_get_type ())
#define BAOBAB_LOCATION_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAOBAB_TYPE_LOCATION_MONITOR, BaobabLocationMonitor))
#define BAOBAB_LOCATION_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAOBAB_TYPE_LOCATION_MONITOR, BaobabLocationMonitorClass))
#define BAOBAB_IS_LOCATION_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAOBAB_TYPE_LOCATION_MONITOR))
#define BAOBAB_IS_LOCATION_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAOBAB_TYPE_LOCATION_MONITOR))
#define BAOBAB_LOCATION_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAOBAB_TYPE_LOCATION_MONITOR, BaobabLocationMonitorClass))

typedef struct _BaobabLocationMonitor BaobabLocationMonitor;
typedef struct _BaobabLocationMonitorClass BaobabLocationMonitorClass;
typedef struct _BaobabLocationMonitorPrivate BaobabLocationMonitorPrivate;

#define BAOBAB_TYPE_LOCATION (baobab_location_get_type ())
#define BAOBAB_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAOBAB_TYPE_LOCATION, BaobabLocation))
#define BAOBAB_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAOBAB_TYPE_LOCATION, BaobabLocationClass))
#define BAOBAB_IS_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAOBAB_TYPE_LOCATION))
#define BAOBAB_IS_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAOBAB_TYPE_LOCATION))
#define BAOBAB_LOCATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAOBAB_TYPE_LOCATION, BaobabLocationClass))

typedef struct _BaobabLocation BaobabLocation;
typedef struct _BaobabLocationClass BaobabLocationClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __g_list_free__baobab_location_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__baobab_location_unref0_ (var), NULL)))
#define _baobab_location_monitor_unref0(var) ((var == NULL) ? NULL : (var = (baobab_location_monitor_unref (var), NULL)))
#define _baobab_location_unref0(var) ((var == NULL) ? NULL : (var = (baobab_location_unref (var), NULL)))
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
typedef struct _BaobabParamSpecLocationMonitor BaobabParamSpecLocationMonitor;

struct _BaobabLocationMonitor {
	GTypeInstance parent_instance;
	volatile int ref_count;
	BaobabLocationMonitorPrivate * priv;
};

struct _BaobabLocationMonitorClass {
	GTypeClass parent_class;
	void (*finalize) (BaobabLocationMonitor *self);
};

struct _BaobabLocationMonitorPrivate {
	GVolumeMonitor* monitor;
	GList* locations;
};

struct _BaobabParamSpecLocationMonitor {
	GParamSpec parent_instance;
};


static gpointer baobab_location_monitor_parent_class = NULL;
static BaobabLocationMonitor* baobab_location_monitor_instance;
static BaobabLocationMonitor* baobab_location_monitor_instance = NULL;

gpointer baobab_location_monitor_ref (gpointer instance);
void baobab_location_monitor_unref (gpointer instance);
GParamSpec* baobab_param_spec_location_monitor (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void baobab_value_set_location_monitor (GValue* value, gpointer v_object);
void baobab_value_take_location_monitor (GValue* value, gpointer v_object);
gpointer baobab_value_get_location_monitor (const GValue* value);
GType baobab_location_monitor_get_type (void) G_GNUC_CONST;
gpointer baobab_location_ref (gpointer instance);
void baobab_location_unref (gpointer instance);
GParamSpec* baobab_param_spec_location (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void baobab_value_set_location (GValue* value, gpointer v_object);
void baobab_value_take_location (GValue* value, gpointer v_object);
gpointer baobab_value_get_location (const GValue* value);
GType baobab_location_get_type (void) G_GNUC_CONST;
#define BAOBAB_LOCATION_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BAOBAB_TYPE_LOCATION_MONITOR, BaobabLocationMonitorPrivate))
enum  {
	BAOBAB_LOCATION_MONITOR_DUMMY_PROPERTY
};
static void _baobab_location_unref0_ (gpointer var);
static void _g_list_free__baobab_location_unref0_ (GList* self);
BaobabLocationMonitor* baobab_location_monitor_get (void);
static BaobabLocationMonitor* baobab_location_monitor_new (void);
static BaobabLocationMonitor* baobab_location_monitor_construct (GType object_type);
static void baobab_location_monitor_mount_changed (BaobabLocationMonitor* self, GMount* mount);
static void _baobab_location_monitor_mount_changed_g_volume_monitor_mount_changed (GVolumeMonitor* _sender, GMount* mount, gpointer self);
static void baobab_location_monitor_mount_removed (BaobabLocationMonitor* self, GMount* mount);
static void _baobab_location_monitor_mount_removed_g_volume_monitor_mount_removed (GVolumeMonitor* _sender, GMount* mount, gpointer self);
static void baobab_location_monitor_mount_added (BaobabLocationMonitor* self, GMount* mount);
static void _baobab_location_monitor_mount_added_g_volume_monitor_mount_added (GVolumeMonitor* _sender, GMount* mount, gpointer self);
static void baobab_location_monitor_volume_changed (BaobabLocationMonitor* self, GVolume* volume);
static void _baobab_location_monitor_volume_changed_g_volume_monitor_volume_changed (GVolumeMonitor* _sender, GVolume* volume, gpointer self);
static void baobab_location_monitor_volume_removed (BaobabLocationMonitor* self, GVolume* volume);
static void _baobab_location_monitor_volume_removed_g_volume_monitor_volume_removed (GVolumeMonitor* _sender, GVolume* volume, gpointer self);
static void baobab_location_monitor_volume_added (BaobabLocationMonitor* self, GVolume* volume);
static void _baobab_location_monitor_volume_added_g_volume_monitor_volume_added (GVolumeMonitor* _sender, GVolume* volume, gpointer self);
static void baobab_location_monitor_initial_fill (BaobabLocationMonitor* self);
GList* baobab_location_monitor_get_locations (BaobabLocationMonitor* self);
GVolume* baobab_location_get_volume (BaobabLocation* self);
BaobabLocation* baobab_location_new_from_volume (GVolume* volume_);
BaobabLocation* baobab_location_construct_from_volume (GType object_type, GVolume* volume_);
GMount* baobab_location_get_mount (BaobabLocation* self);
BaobabLocation* baobab_location_new_from_mount (GMount* mount_);
BaobabLocation* baobab_location_construct_from_mount (GType object_type, GMount* mount_);
BaobabLocation* baobab_location_new_for_main_volume (void);
BaobabLocation* baobab_location_construct_for_main_volume (GType object_type);
static void _g_object_unref0_ (gpointer var);
static void _g_list_free__g_object_unref0_ (GList* self);
BaobabLocation* baobab_location_get_home_location (void);
BaobabLocation* baobab_location_new_for_home_folder (void);
BaobabLocation* baobab_location_construct_for_home_folder (GType object_type);
static void baobab_location_monitor_finalize (BaobabLocationMonitor* obj);


static void _baobab_location_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (baobab_location_unref (var), NULL));
}


static void _g_list_free__baobab_location_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _baobab_location_unref0_, NULL);
	g_list_free (self);
}


static gpointer _baobab_location_monitor_ref0 (gpointer self) {
	return self ? baobab_location_monitor_ref (self) : NULL;
}


BaobabLocationMonitor* baobab_location_monitor_get (void) {
	BaobabLocationMonitor* result = NULL;
	BaobabLocationMonitor* _tmp0_;
	BaobabLocationMonitor* _tmp2_;
	BaobabLocationMonitor* _tmp3_;
	_tmp0_ = baobab_location_monitor_instance;
	if (_tmp0_ == NULL) {
		BaobabLocationMonitor* _tmp1_;
		_tmp1_ = baobab_location_monitor_new ();
		_baobab_location_monitor_unref0 (baobab_location_monitor_instance);
		baobab_location_monitor_instance = _tmp1_;
	}
	_tmp2_ = baobab_location_monitor_instance;
	_tmp3_ = _baobab_location_monitor_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}


static void _baobab_location_monitor_mount_changed_g_volume_monitor_mount_changed (GVolumeMonitor* _sender, GMount* mount, gpointer self) {
	baobab_location_monitor_mount_changed (self, mount);
}


static void _baobab_location_monitor_mount_removed_g_volume_monitor_mount_removed (GVolumeMonitor* _sender, GMount* mount, gpointer self) {
	baobab_location_monitor_mount_removed (self, mount);
}


static void _baobab_location_monitor_mount_added_g_volume_monitor_mount_added (GVolumeMonitor* _sender, GMount* mount, gpointer self) {
	baobab_location_monitor_mount_added (self, mount);
}


static void _baobab_location_monitor_volume_changed_g_volume_monitor_volume_changed (GVolumeMonitor* _sender, GVolume* volume, gpointer self) {
	baobab_location_monitor_volume_changed (self, volume);
}


static void _baobab_location_monitor_volume_removed_g_volume_monitor_volume_removed (GVolumeMonitor* _sender, GVolume* volume, gpointer self) {
	baobab_location_monitor_volume_removed (self, volume);
}


static void _baobab_location_monitor_volume_added_g_volume_monitor_volume_added (GVolumeMonitor* _sender, GVolume* volume, gpointer self) {
	baobab_location_monitor_volume_added (self, volume);
}


static BaobabLocationMonitor* baobab_location_monitor_construct (GType object_type) {
	BaobabLocationMonitor* self = NULL;
	GVolumeMonitor* _tmp0_ = NULL;
	GVolumeMonitor* _tmp1_;
	GVolumeMonitor* _tmp2_;
	GVolumeMonitor* _tmp3_;
	GVolumeMonitor* _tmp4_;
	GVolumeMonitor* _tmp5_;
	GVolumeMonitor* _tmp6_;
	self = (BaobabLocationMonitor*) g_type_create_instance (object_type);
	_tmp0_ = g_volume_monitor_get ();
	_g_object_unref0 (self->priv->monitor);
	self->priv->monitor = _tmp0_;
	_tmp1_ = self->priv->monitor;
	g_signal_connect (_tmp1_, "mount-changed", (GCallback) _baobab_location_monitor_mount_changed_g_volume_monitor_mount_changed, self);
	_tmp2_ = self->priv->monitor;
	g_signal_connect (_tmp2_, "mount-removed", (GCallback) _baobab_location_monitor_mount_removed_g_volume_monitor_mount_removed, self);
	_tmp3_ = self->priv->monitor;
	g_signal_connect (_tmp3_, "mount-added", (GCallback) _baobab_location_monitor_mount_added_g_volume_monitor_mount_added, self);
	_tmp4_ = self->priv->monitor;
	g_signal_connect (_tmp4_, "volume-changed", (GCallback) _baobab_location_monitor_volume_changed_g_volume_monitor_volume_changed, self);
	_tmp5_ = self->priv->monitor;
	g_signal_connect (_tmp5_, "volume-removed", (GCallback) _baobab_location_monitor_volume_removed_g_volume_monitor_volume_removed, self);
	_tmp6_ = self->priv->monitor;
	g_signal_connect (_tmp6_, "volume-added", (GCallback) _baobab_location_monitor_volume_added_g_volume_monitor_volume_added, self);
	baobab_location_monitor_initial_fill (self);
	return self;
}


static BaobabLocationMonitor* baobab_location_monitor_new (void) {
	return baobab_location_monitor_construct (BAOBAB_TYPE_LOCATION_MONITOR);
}


GList* baobab_location_monitor_get_locations (BaobabLocationMonitor* self) {
	GList* result = NULL;
	GList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->locations;
	result = _tmp0_;
	return result;
}


static void baobab_location_monitor_volume_changed (BaobabLocationMonitor* self, GVolume* volume) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (volume != NULL);
	g_signal_emit_by_name (self, "changed");
}


static gpointer _baobab_location_ref0 (gpointer self) {
	return self ? baobab_location_ref (self) : NULL;
}


static void baobab_location_monitor_volume_removed (BaobabLocationMonitor* self, GVolume* volume) {
	GList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (volume != NULL);
	_tmp0_ = self->priv->locations;
	{
		GList* location_collection = NULL;
		GList* location_it = NULL;
		location_collection = _tmp0_;
		for (location_it = location_collection; location_it != NULL; location_it = location_it->next) {
			BaobabLocation* _tmp1_;
			BaobabLocation* location = NULL;
			_tmp1_ = _baobab_location_ref0 ((BaobabLocation*) location_it->data);
			location = _tmp1_;
			{
				BaobabLocation* _tmp2_;
				GVolume* _tmp3_;
				GVolume* _tmp4_;
				GVolume* _tmp5_;
				_tmp2_ = location;
				_tmp3_ = baobab_location_get_volume (_tmp2_);
				_tmp4_ = _tmp3_;
				_tmp5_ = volume;
				if (_tmp4_ == _tmp5_) {
					BaobabLocation* _tmp6_;
					_tmp6_ = location;
					self->priv->locations = g_list_remove (self->priv->locations, _tmp6_);
					_baobab_location_unref0 (location);
					break;
				}
				_baobab_location_unref0 (location);
			}
		}
	}
	g_signal_emit_by_name (self, "changed");
}


static void baobab_location_monitor_volume_added (BaobabLocationMonitor* self, GVolume* volume) {
	GVolume* _tmp0_;
	BaobabLocation* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (volume != NULL);
	_tmp0_ = volume;
	_tmp1_ = baobab_location_new_from_volume (_tmp0_);
	self->priv->locations = g_list_append (self->priv->locations, _tmp1_);
	g_signal_emit_by_name (self, "changed");
}


static void baobab_location_monitor_mount_changed (BaobabLocationMonitor* self, GMount* mount) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (mount != NULL);
}


static void baobab_location_monitor_mount_removed (BaobabLocationMonitor* self, GMount* mount) {
	GList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (mount != NULL);
	_tmp0_ = self->priv->locations;
	{
		GList* location_collection = NULL;
		GList* location_it = NULL;
		location_collection = _tmp0_;
		for (location_it = location_collection; location_it != NULL; location_it = location_it->next) {
			BaobabLocation* _tmp1_;
			BaobabLocation* location = NULL;
			_tmp1_ = _baobab_location_ref0 ((BaobabLocation*) location_it->data);
			location = _tmp1_;
			{
				BaobabLocation* _tmp2_;
				GMount* _tmp3_;
				GMount* _tmp4_;
				GMount* _tmp5_;
				_tmp2_ = location;
				_tmp3_ = baobab_location_get_mount (_tmp2_);
				_tmp4_ = _tmp3_;
				_tmp5_ = mount;
				if (_tmp4_ == _tmp5_) {
					BaobabLocation* _tmp6_;
					_tmp6_ = location;
					self->priv->locations = g_list_remove (self->priv->locations, _tmp6_);
					_baobab_location_unref0 (location);
					break;
				}
				_baobab_location_unref0 (location);
			}
		}
	}
	g_signal_emit_by_name (self, "changed");
}


static void baobab_location_monitor_mount_added (BaobabLocationMonitor* self, GMount* mount) {
	GMount* _tmp0_;
	GVolume* _tmp1_ = NULL;
	GVolume* _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (mount != NULL);
	_tmp0_ = mount;
	_tmp1_ = g_mount_get_volume (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ == NULL;
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		GMount* _tmp4_;
		BaobabLocation* _tmp5_;
		_tmp4_ = mount;
		_tmp5_ = baobab_location_new_from_mount (_tmp4_);
		self->priv->locations = g_list_append (self->priv->locations, _tmp5_);
	}
	g_signal_emit_by_name (self, "changed");
}


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


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static void _g_list_free__g_object_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
	g_list_free (self);
}


static void baobab_location_monitor_initial_fill (BaobabLocationMonitor* self) {
	BaobabLocation* _tmp0_;
	GVolumeMonitor* _tmp1_;
	GList* _tmp2_ = NULL;
	GVolumeMonitor* _tmp6_;
	GList* _tmp7_ = NULL;
	BaobabLocation* _tmp15_ = NULL;
	BaobabLocation* _tmp16_;
	gboolean _tmp17_;
	g_return_if_fail (self != NULL);
	_tmp0_ = baobab_location_new_for_main_volume ();
	self->priv->locations = g_list_append (self->priv->locations, _tmp0_);
	_tmp1_ = self->priv->monitor;
	_tmp2_ = g_volume_monitor_get_volumes (_tmp1_);
	{
		GList* volume_collection = NULL;
		GList* volume_it = NULL;
		volume_collection = _tmp2_;
		for (volume_it = volume_collection; volume_it != NULL; volume_it = volume_it->next) {
			GVolume* _tmp3_;
			GVolume* volume = NULL;
			_tmp3_ = _g_object_ref0 ((GVolume*) volume_it->data);
			volume = _tmp3_;
			{
				GVolume* _tmp4_;
				BaobabLocation* _tmp5_;
				_tmp4_ = volume;
				_tmp5_ = baobab_location_new_from_volume (_tmp4_);
				self->priv->locations = g_list_append (self->priv->locations, _tmp5_);
				_g_object_unref0 (volume);
			}
		}
		__g_list_free__g_object_unref0_0 (volume_collection);
	}
	_tmp6_ = self->priv->monitor;
	_tmp7_ = g_volume_monitor_get_mounts (_tmp6_);
	{
		GList* mount_collection = NULL;
		GList* mount_it = NULL;
		mount_collection = _tmp7_;
		for (mount_it = mount_collection; mount_it != NULL; mount_it = mount_it->next) {
			GMount* _tmp8_;
			GMount* mount = NULL;
			_tmp8_ = _g_object_ref0 ((GMount*) mount_it->data);
			mount = _tmp8_;
			{
				GMount* _tmp9_;
				GVolume* _tmp10_ = NULL;
				GVolume* _tmp11_;
				gboolean _tmp12_;
				_tmp9_ = mount;
				_tmp10_ = g_mount_get_volume (_tmp9_);
				_tmp11_ = _tmp10_;
				_tmp12_ = _tmp11_ == NULL;
				_g_object_unref0 (_tmp11_);
				if (_tmp12_) {
					GMount* _tmp13_;
					BaobabLocation* _tmp14_;
					_tmp13_ = mount;
					_tmp14_ = baobab_location_new_from_mount (_tmp13_);
					self->priv->locations = g_list_append (self->priv->locations, _tmp14_);
				} else {
				}
				_g_object_unref0 (mount);
			}
		}
		__g_list_free__g_object_unref0_0 (mount_collection);
	}
	_tmp15_ = baobab_location_get_home_location ();
	_tmp16_ = _tmp15_;
	_tmp17_ = _tmp16_ == NULL;
	_baobab_location_unref0 (_tmp16_);
	if (_tmp17_) {
		BaobabLocation* _tmp18_;
		_tmp18_ = baobab_location_new_for_home_folder ();
		self->priv->locations = g_list_append (self->priv->locations, _tmp18_);
	}
	g_signal_emit_by_name (self, "changed");
}


static void baobab_value_location_monitor_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void baobab_value_location_monitor_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		baobab_location_monitor_unref (value->data[0].v_pointer);
	}
}


static void baobab_value_location_monitor_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = baobab_location_monitor_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer baobab_value_location_monitor_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* baobab_value_location_monitor_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		BaobabLocationMonitor* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = baobab_location_monitor_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* baobab_value_location_monitor_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	BaobabLocationMonitor** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = baobab_location_monitor_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* baobab_param_spec_location_monitor (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	BaobabParamSpecLocationMonitor* spec;
	g_return_val_if_fail (g_type_is_a (object_type, BAOBAB_TYPE_LOCATION_MONITOR), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer baobab_value_get_location_monitor (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAOBAB_TYPE_LOCATION_MONITOR), NULL);
	return value->data[0].v_pointer;
}


void baobab_value_set_location_monitor (GValue* value, gpointer v_object) {
	BaobabLocationMonitor* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAOBAB_TYPE_LOCATION_MONITOR));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAOBAB_TYPE_LOCATION_MONITOR));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		baobab_location_monitor_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		baobab_location_monitor_unref (old);
	}
}


void baobab_value_take_location_monitor (GValue* value, gpointer v_object) {
	BaobabLocationMonitor* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAOBAB_TYPE_LOCATION_MONITOR));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAOBAB_TYPE_LOCATION_MONITOR));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		baobab_location_monitor_unref (old);
	}
}


static void baobab_location_monitor_class_init (BaobabLocationMonitorClass * klass) {
	baobab_location_monitor_parent_class = g_type_class_peek_parent (klass);
	BAOBAB_LOCATION_MONITOR_CLASS (klass)->finalize = baobab_location_monitor_finalize;
	g_type_class_add_private (klass, sizeof (BaobabLocationMonitorPrivate));
	g_signal_new ("changed", BAOBAB_TYPE_LOCATION_MONITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}


static void baobab_location_monitor_instance_init (BaobabLocationMonitor * self) {
	self->priv = BAOBAB_LOCATION_MONITOR_GET_PRIVATE (self);
	self->priv->locations = NULL;
	self->ref_count = 1;
}


static void baobab_location_monitor_finalize (BaobabLocationMonitor* obj) {
	BaobabLocationMonitor * self;
	self = BAOBAB_LOCATION_MONITOR (obj);
	_g_object_unref0 (self->priv->monitor);
	__g_list_free__baobab_location_unref0_0 (self->priv->locations);
}


GType baobab_location_monitor_get_type (void) {
	static volatile gsize baobab_location_monitor_type_id__volatile = 0;
	if (g_once_init_enter (&baobab_location_monitor_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { baobab_value_location_monitor_init, baobab_value_location_monitor_free_value, baobab_value_location_monitor_copy_value, baobab_value_location_monitor_peek_pointer, "p", baobab_value_location_monitor_collect_value, "p", baobab_value_location_monitor_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (BaobabLocationMonitorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) baobab_location_monitor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BaobabLocationMonitor), 0, (GInstanceInitFunc) baobab_location_monitor_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType baobab_location_monitor_type_id;
		baobab_location_monitor_type_id = g_type_register_fundamental (g_type_fundamental_next (), "BaobabLocationMonitor", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&baobab_location_monitor_type_id__volatile, baobab_location_monitor_type_id);
	}
	return baobab_location_monitor_type_id__volatile;
}


gpointer baobab_location_monitor_ref (gpointer instance) {
	BaobabLocationMonitor* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void baobab_location_monitor_unref (gpointer instance) {
	BaobabLocationMonitor* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		BAOBAB_LOCATION_MONITOR_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



