/* rygel-media-export-recursive-file-monitor.c generated by valac 0.25.1.16-16e7a, the Vala compiler
 * generated from rygel-media-export-recursive-file-monitor.vala, do not modify */

/*
 * Copyright (C) 2009 Jens Georg <mail@jensge.org>.
 *
 * This file is part of Rygel.
 *
 * Rygel 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 of the License, or
 * (at your option) any later version.
 *
 * Rygel 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser 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 <gee.h>
#include <rygel-core.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>


#define RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR (rygel_media_export_recursive_file_monitor_get_type ())
#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitor))
#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitorClass))
#define RYGEL_MEDIA_EXPORT_IS_RECURSIVE_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR))
#define RYGEL_MEDIA_EXPORT_IS_RECURSIVE_FILE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR))
#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitorClass))

typedef struct _RygelMediaExportRecursiveFileMonitor RygelMediaExportRecursiveFileMonitor;
typedef struct _RygelMediaExportRecursiveFileMonitorClass RygelMediaExportRecursiveFileMonitorClass;
typedef struct _RygelMediaExportRecursiveFileMonitorPrivate RygelMediaExportRecursiveFileMonitorPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _RygelMediaExportRecursiveFileMonitorAddData RygelMediaExportRecursiveFileMonitorAddData;

struct _RygelMediaExportRecursiveFileMonitor {
	GObject parent_instance;
	RygelMediaExportRecursiveFileMonitorPrivate * priv;
};

struct _RygelMediaExportRecursiveFileMonitorClass {
	GObjectClass parent_class;
};

struct _RygelMediaExportRecursiveFileMonitorPrivate {
	GCancellable* cancellable;
	GeeHashMap* monitors;
	gboolean monitor_changes;
};

struct _RygelMediaExportRecursiveFileMonitorAddData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelMediaExportRecursiveFileMonitor* self;
	GFile* file;
	GeeHashMap* _tmp0_;
	GFile* _tmp1_;
	gboolean _tmp2_;
	GFileInfo* info;
	GFile* _tmp3_;
	GFileInfo* _tmp4_;
	GFileInfo* _tmp5_;
	GFileType _tmp6_;
	GFileMonitor* file_monitor;
	GFile* _tmp7_;
	GCancellable* _tmp8_;
	GFileMonitor* _tmp9_;
	GeeHashMap* _tmp10_;
	GFile* _tmp11_;
	GFileMonitor* _tmp12_;
	GFileMonitor* _tmp13_;
	GError* err;
	GError* _tmp14_;
	const gchar* _tmp15_;
	GFile* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	GError* _tmp19_;
	const gchar* _tmp20_;
	GFile* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	GError * _inner_error_;
};


static gpointer rygel_media_export_recursive_file_monitor_parent_class = NULL;

GType rygel_media_export_recursive_file_monitor_get_type (void) G_GNUC_CONST;
#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitorPrivate))
enum  {
	RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_DUMMY_PROPERTY
};
RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_new (GCancellable* cancellable);
RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_construct (GType object_type, GCancellable* cancellable);
static void rygel_media_export_recursive_file_monitor_on_config_changed (RygelMediaExportRecursiveFileMonitor* self, RygelConfiguration* config, const gchar* section, const gchar* key);
static void _rygel_media_export_recursive_file_monitor_on_config_changed_rygel_configuration_setting_changed (RygelConfiguration* _sender, const gchar* section, const gchar* key, gpointer self);
#define RYGEL_MEDIA_EXPORT_PLUGIN_NAME "MediaExport"
void rygel_media_export_recursive_file_monitor_cancel (RygelMediaExportRecursiveFileMonitor* self);
static void _rygel_media_export_recursive_file_monitor_cancel_g_cancellable_cancelled (GCancellable* _sender, gpointer self);
void rygel_media_export_recursive_file_monitor_on_monitor_changed (RygelMediaExportRecursiveFileMonitor* self, GFile* file, GFile* other_file, GFileMonitorEvent event_type);
void rygel_media_export_recursive_file_monitor_add (RygelMediaExportRecursiveFileMonitor* self, GFile* file, GAsyncReadyCallback _callback_, gpointer _user_data_);
void rygel_media_export_recursive_file_monitor_add_finish (RygelMediaExportRecursiveFileMonitor* self, GAsyncResult* _res_);
static void _rygel_media_export_recursive_file_monitor_on_monitor_changed_g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self);
static void rygel_media_export_recursive_file_monitor_add_data_free (gpointer _data);
static gboolean rygel_media_export_recursive_file_monitor_add_co (RygelMediaExportRecursiveFileMonitorAddData* _data_);
static void rygel_media_export_recursive_file_monitor_add_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static void rygel_media_export_recursive_file_monitor_finalize (GObject* obj);


static void _rygel_media_export_recursive_file_monitor_on_config_changed_rygel_configuration_setting_changed (RygelConfiguration* _sender, const gchar* section, const gchar* key, gpointer self) {
	rygel_media_export_recursive_file_monitor_on_config_changed ((RygelMediaExportRecursiveFileMonitor*) self, _sender, section, key);
}


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


static void _rygel_media_export_recursive_file_monitor_cancel_g_cancellable_cancelled (GCancellable* _sender, gpointer self) {
	rygel_media_export_recursive_file_monitor_cancel ((RygelMediaExportRecursiveFileMonitor*) self);
}


RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_construct (GType object_type, GCancellable* cancellable) {
	RygelMediaExportRecursiveFileMonitor * self = NULL;
	RygelMetaConfig* config = NULL;
	RygelMetaConfig* _tmp0_ = NULL;
	RygelMetaConfig* _tmp1_ = NULL;
	RygelMetaConfig* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
	GCancellable* _tmp5_ = NULL;
	GCancellable* _tmp6_ = NULL;
	GeeHashMap* _tmp7_ = NULL;
	GCancellable* _tmp8_ = NULL;
	self = (RygelMediaExportRecursiveFileMonitor*) g_object_new (object_type, NULL);
	self->priv->monitor_changes = TRUE;
	_tmp0_ = rygel_meta_config_get_default ();
	config = _tmp0_;
	_tmp1_ = config;
	g_signal_connect_object ((RygelConfiguration*) _tmp1_, "setting-changed", (GCallback) _rygel_media_export_recursive_file_monitor_on_config_changed_rygel_configuration_setting_changed, self, 0);
	_tmp2_ = config;
	rygel_media_export_recursive_file_monitor_on_config_changed (self, (RygelConfiguration*) _tmp2_, RYGEL_MEDIA_EXPORT_PLUGIN_NAME, "monitor-changes");
	_tmp3_ = self->priv->monitor_changes;
	if (!_tmp3_) {
		const gchar* _tmp4_ = NULL;
		_tmp4_ = _ ("Will not monitor file changes");
		g_message ("rygel-media-export-recursive-file-monitor.vala:36: %s", _tmp4_);
	}
	_tmp5_ = cancellable;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (self->priv->cancellable);
	self->priv->cancellable = _tmp6_;
	_tmp7_ = gee_hash_map_new (G_TYPE_FILE, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_file_monitor_get_type (), (GBoxedCopyFunc) g_object_ref, g_object_unref, (GeeHashDataFunc) g_file_hash, NULL, NULL, (GeeEqualDataFunc) g_file_equal, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->monitors);
	self->priv->monitors = _tmp7_;
	_tmp8_ = cancellable;
	if (_tmp8_ != NULL) {
		GCancellable* _tmp9_ = NULL;
		_tmp9_ = cancellable;
		g_signal_connect_object (_tmp9_, "cancelled", (GCallback) _rygel_media_export_recursive_file_monitor_cancel_g_cancellable_cancelled, self, 0);
	}
	_g_object_unref0 (config);
	return self;
}


RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_new (GCancellable* cancellable) {
	return rygel_media_export_recursive_file_monitor_construct (RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, cancellable);
}


static void _rygel_media_export_recursive_file_monitor_on_monitor_changed_g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) {
	rygel_media_export_recursive_file_monitor_on_monitor_changed ((RygelMediaExportRecursiveFileMonitor*) self, file, other_file, event_type);
}


void rygel_media_export_recursive_file_monitor_on_monitor_changed (RygelMediaExportRecursiveFileMonitor* self, GFile* file, GFile* other_file, GFileMonitorEvent event_type) {
	gboolean _tmp0_ = FALSE;
	GFileMonitorEvent _tmp4_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	_tmp0_ = self->priv->monitor_changes;
	if (_tmp0_) {
		GFile* _tmp1_ = NULL;
		GFile* _tmp2_ = NULL;
		GFileMonitorEvent _tmp3_ = 0;
		_tmp1_ = file;
		_tmp2_ = other_file;
		_tmp3_ = event_type;
		g_signal_emit_by_name (self, "changed", _tmp1_, _tmp2_, _tmp3_);
	}
	_tmp4_ = event_type;
	switch (_tmp4_) {
		case G_FILE_MONITOR_EVENT_CREATED:
		{
			GFile* _tmp5_ = NULL;
			_tmp5_ = file;
			rygel_media_export_recursive_file_monitor_add (self, _tmp5_, NULL, NULL);
			break;
		}
		case G_FILE_MONITOR_EVENT_DELETED:
		{
			GFileMonitor* file_monitor = NULL;
			GeeHashMap* _tmp6_ = NULL;
			GFile* _tmp7_ = NULL;
			gpointer _tmp8_ = NULL;
			GFileMonitor* _tmp9_ = NULL;
			_tmp6_ = self->priv->monitors;
			_tmp7_ = file;
			_tmp8_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp6_, _tmp7_);
			file_monitor = (GFileMonitor*) _tmp8_;
			_tmp9_ = file_monitor;
			if (_tmp9_ != NULL) {
				GFile* _tmp10_ = NULL;
				gchar* _tmp11_ = NULL;
				gchar* _tmp12_ = NULL;
				GeeHashMap* _tmp13_ = NULL;
				GFile* _tmp14_ = NULL;
				GFileMonitor* _tmp15_ = NULL;
				GFileMonitor* _tmp16_ = NULL;
				guint _tmp17_ = 0U;
				_tmp10_ = file;
				_tmp11_ = g_file_get_uri (_tmp10_);
				_tmp12_ = _tmp11_;
				g_debug ("rygel-media-export-recursive-file-monitor.vala:62: Folder %s gone; rem" \
"oving watch", _tmp12_);
				_g_free0 (_tmp12_);
				_tmp13_ = self->priv->monitors;
				_tmp14_ = file;
				gee_abstract_map_unset ((GeeAbstractMap*) _tmp13_, _tmp14_, NULL);
				_tmp15_ = file_monitor;
				g_file_monitor_cancel (_tmp15_);
				_tmp16_ = file_monitor;
				g_signal_parse_name ("changed", g_file_monitor_get_type (), &_tmp17_, NULL, FALSE);
				g_signal_handlers_disconnect_matched (_tmp16_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp17_, 0, NULL, (GCallback) _rygel_media_export_recursive_file_monitor_on_monitor_changed_g_file_monitor_changed, self);
			}
			_g_object_unref0 (file_monitor);
			break;
		}
		default:
		{
			break;
		}
	}
}


static void rygel_media_export_recursive_file_monitor_add_data_free (gpointer _data) {
	RygelMediaExportRecursiveFileMonitorAddData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediaExportRecursiveFileMonitorAddData, _data_);
}


void rygel_media_export_recursive_file_monitor_add (RygelMediaExportRecursiveFileMonitor* self, GFile* file, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelMediaExportRecursiveFileMonitorAddData* _data_;
	RygelMediaExportRecursiveFileMonitor* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	GFile* _tmp2_ = NULL;
	_data_ = g_slice_new0 (RygelMediaExportRecursiveFileMonitorAddData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_recursive_file_monitor_add);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_media_export_recursive_file_monitor_add_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = file;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp2_;
	rygel_media_export_recursive_file_monitor_add_co (_data_);
}


void rygel_media_export_recursive_file_monitor_add_finish (RygelMediaExportRecursiveFileMonitor* self, GAsyncResult* _res_) {
	RygelMediaExportRecursiveFileMonitorAddData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void rygel_media_export_recursive_file_monitor_add_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelMediaExportRecursiveFileMonitorAddData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_media_export_recursive_file_monitor_add_co (_data_);
}


static gboolean rygel_media_export_recursive_file_monitor_add_co (RygelMediaExportRecursiveFileMonitorAddData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->self->priv->monitors;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->file;
	_data_->_tmp2_ = FALSE;
	_data_->_tmp2_ = gee_abstract_map_has_key ((GeeAbstractMap*) _data_->_tmp0_, _data_->_tmp1_);
	if (_data_->_tmp2_) {
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _data_->file;
		_data_->_state_ = 1;
		g_file_query_info_async (_data_->_tmp3_, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, rygel_media_export_recursive_file_monitor_add_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = g_file_query_info_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error_);
		_data_->info = _data_->_tmp4_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch57_g_error;
		}
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _data_->info;
		_data_->_tmp6_ = 0;
		_data_->_tmp6_ = g_file_info_get_file_type (_data_->_tmp5_);
		if (_data_->_tmp6_ == G_FILE_TYPE_DIRECTORY) {
			_data_->_tmp7_ = NULL;
			_data_->_tmp7_ = _data_->file;
			_data_->_tmp8_ = NULL;
			_data_->_tmp8_ = _data_->self->priv->cancellable;
			_data_->_tmp9_ = NULL;
			_data_->_tmp9_ = g_file_monitor_directory (_data_->_tmp7_, G_FILE_MONITOR_NONE, _data_->_tmp8_, &_data_->_inner_error_);
			_data_->file_monitor = _data_->_tmp9_;
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_g_object_unref0 (_data_->info);
				goto __catch57_g_error;
			}
			_data_->_tmp10_ = NULL;
			_data_->_tmp10_ = _data_->self->priv->monitors;
			_data_->_tmp11_ = NULL;
			_data_->_tmp11_ = _data_->file;
			_data_->_tmp12_ = NULL;
			_data_->_tmp12_ = _data_->file_monitor;
			gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp10_, _data_->_tmp11_, _data_->_tmp12_);
			_data_->_tmp13_ = NULL;
			_data_->_tmp13_ = _data_->file_monitor;
			g_signal_connect_object (_data_->_tmp13_, "changed", (GCallback) _rygel_media_export_recursive_file_monitor_on_monitor_changed_g_file_monitor_changed, _data_->self, 0);
			_g_object_unref0 (_data_->file_monitor);
		}
		_g_object_unref0 (_data_->info);
	}
	goto __finally57;
	__catch57_g_error:
	{
		_data_->err = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp14_ = NULL;
		_data_->_tmp14_ = _data_->err;
		if (!g_error_matches (_data_->_tmp14_, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
			_data_->_tmp15_ = NULL;
			_data_->_tmp15_ = _ ("Failed to get file info for %s: %s");
			_data_->_tmp16_ = NULL;
			_data_->_tmp16_ = _data_->file;
			_data_->_tmp17_ = NULL;
			_data_->_tmp17_ = g_file_get_uri (_data_->_tmp16_);
			_data_->_tmp18_ = NULL;
			_data_->_tmp18_ = _data_->_tmp17_;
			_data_->_tmp19_ = NULL;
			_data_->_tmp19_ = _data_->err;
			_data_->_tmp20_ = NULL;
			_data_->_tmp20_ = _data_->_tmp19_->message;
			g_warning (_data_->_tmp15_, _data_->_tmp18_, _data_->_tmp20_);
			_g_free0 (_data_->_tmp18_);
		} else {
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = _data_->file;
			_data_->_tmp22_ = NULL;
			_data_->_tmp22_ = g_file_get_uri (_data_->_tmp21_);
			_data_->_tmp23_ = NULL;
			_data_->_tmp23_ = _data_->_tmp22_;
			g_debug ("rygel-media-export-recursive-file-monitor.vala:102: File %s disappeare" \
"d while trying to get information", _data_->_tmp23_);
			_g_free0 (_data_->_tmp23_);
		}
		_g_error_free0 (_data_->err);
	}
	__finally57:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


void rygel_media_export_recursive_file_monitor_cancel (RygelMediaExportRecursiveFileMonitor* self) {
	GeeHashMap* _tmp11_ = NULL;
	g_return_if_fail (self != NULL);
	{
		GeeIterator* _monitor_it = NULL;
		GeeHashMap* _tmp0_ = NULL;
		GeeCollection* _tmp1_ = NULL;
		GeeCollection* _tmp2_ = NULL;
		GeeCollection* _tmp3_ = NULL;
		GeeIterator* _tmp4_ = NULL;
		GeeIterator* _tmp5_ = NULL;
		_tmp0_ = self->priv->monitors;
		_tmp1_ = gee_abstract_map_get_values ((GeeMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_monitor_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_ = NULL;
			gboolean _tmp7_ = FALSE;
			GFileMonitor* monitor = NULL;
			GeeIterator* _tmp8_ = NULL;
			gpointer _tmp9_ = NULL;
			GFileMonitor* _tmp10_ = NULL;
			_tmp6_ = _monitor_it;
			_tmp7_ = gee_iterator_next (_tmp6_);
			if (!_tmp7_) {
				break;
			}
			_tmp8_ = _monitor_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			monitor = (GFileMonitor*) _tmp9_;
			_tmp10_ = monitor;
			g_file_monitor_cancel (_tmp10_);
			_g_object_unref0 (monitor);
		}
		_g_object_unref0 (_monitor_it);
	}
	_tmp11_ = self->priv->monitors;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp11_);
}


static void rygel_media_export_recursive_file_monitor_on_config_changed (RygelMediaExportRecursiveFileMonitor* self, RygelConfiguration* config, const gchar* section, const gchar* key) {
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (config != NULL);
	g_return_if_fail (section != NULL);
	g_return_if_fail (key != NULL);
	_tmp1_ = section;
	if (g_strcmp0 (_tmp1_, RYGEL_MEDIA_EXPORT_PLUGIN_NAME) != 0) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp2_ = NULL;
		_tmp2_ = key;
		_tmp0_ = g_strcmp0 (_tmp2_, "monitor-changes") != 0;
	}
	if (_tmp0_) {
		return;
	}
	{
		gboolean _tmp3_ = FALSE;
		RygelConfiguration* _tmp4_ = NULL;
		gboolean _tmp5_ = FALSE;
		_tmp4_ = config;
		_tmp5_ = rygel_configuration_get_bool (_tmp4_, RYGEL_MEDIA_EXPORT_PLUGIN_NAME, "monitor-changes", &_inner_error_);
		_tmp3_ = _tmp5_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch58_g_error;
		}
		self->priv->monitor_changes = _tmp3_;
	}
	goto __finally58;
	__catch58_g_error:
	{
		GError* _error_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_g_error_free0 (_error_);
	}
	__finally58:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_ENUM) (gpointer data1, gpointer arg_1, gpointer arg_2, gint arg_3, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT_ENUM callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT_ENUM) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), g_value_get_enum (param_values + 3), data2);
}


static void rygel_media_export_recursive_file_monitor_class_init (RygelMediaExportRecursiveFileMonitorClass * klass) {
	rygel_media_export_recursive_file_monitor_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (RygelMediaExportRecursiveFileMonitorPrivate));
	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_recursive_file_monitor_finalize;
	g_signal_new ("changed", RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM, G_TYPE_NONE, 3, G_TYPE_FILE, G_TYPE_FILE, g_file_monitor_event_get_type ());
}


static void rygel_media_export_recursive_file_monitor_instance_init (RygelMediaExportRecursiveFileMonitor * self) {
	self->priv = RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_GET_PRIVATE (self);
}


static void rygel_media_export_recursive_file_monitor_finalize (GObject* obj) {
	RygelMediaExportRecursiveFileMonitor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitor);
	_g_object_unref0 (self->priv->cancellable);
	_g_object_unref0 (self->priv->monitors);
	G_OBJECT_CLASS (rygel_media_export_recursive_file_monitor_parent_class)->finalize (obj);
}


GType rygel_media_export_recursive_file_monitor_get_type (void) {
	static volatile gsize rygel_media_export_recursive_file_monitor_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_media_export_recursive_file_monitor_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportRecursiveFileMonitorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_recursive_file_monitor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportRecursiveFileMonitor), 0, (GInstanceInitFunc) rygel_media_export_recursive_file_monitor_instance_init, NULL };
		GType rygel_media_export_recursive_file_monitor_type_id;
		rygel_media_export_recursive_file_monitor_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelMediaExportRecursiveFileMonitor", &g_define_type_info, 0);
		g_once_init_leave (&rygel_media_export_recursive_file_monitor_type_id__volatile, rygel_media_export_recursive_file_monitor_type_id);
	}
	return rygel_media_export_recursive_file_monitor_type_id__volatile;
}



