/* bookmarkGroup.c generated by valac 0.56.19, the Vala compiler
 * generated from bookmarkGroup.vala, do not modify */

/*///////////////////////////////////////////////////////////////////////*/
/* Copyright 2011-2021 Simon Schneegans*/
/**/
/* Permission is hereby granted, free of charge, to any person obtaining*/
/* a copy of this software and associated documentation files (the*/
/* "Software"), to deal in the Software without restriction, including*/
/* without limitation the rights to use, copy, modify, merge, publish,*/
/* distribute, sublicense, and/or sell copies of the Software, and to*/
/* permit persons to whom the Software is furnished to do so, subject to*/
/* the following conditions:*/
/* */
/* The above copyright notice and this permission notice shall be*/
/* included in all copies or substantial portions of the Software.*/
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,*/
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF*/
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY*/
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,*/
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE*/
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/
/*///////////////////////////////////////////////////////////////////////*/

#include <glib-object.h>
#include <libxml/xmlwriter.h>
#include <libxml/tree.h>
#include <gio/gio.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define GNOME_PIE_TYPE_ACTION_GROUP (gnome_pie_action_group_get_type ())
#define GNOME_PIE_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_PIE_TYPE_ACTION_GROUP, GnomePieActionGroup))
#define GNOME_PIE_ACTION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_PIE_TYPE_ACTION_GROUP, GnomePieActionGroupClass))
#define GNOME_PIE_IS_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_PIE_TYPE_ACTION_GROUP))
#define GNOME_PIE_IS_ACTION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_PIE_TYPE_ACTION_GROUP))
#define GNOME_PIE_ACTION_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_PIE_TYPE_ACTION_GROUP, GnomePieActionGroupClass))

typedef struct _GnomePieActionGroup GnomePieActionGroup;
typedef struct _GnomePieActionGroupClass GnomePieActionGroupClass;
typedef struct _GnomePieActionGroupPrivate GnomePieActionGroupPrivate;

#define GNOME_PIE_TYPE_BOOKMARK_GROUP (gnome_pie_bookmark_group_get_type ())
#define GNOME_PIE_BOOKMARK_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_PIE_TYPE_BOOKMARK_GROUP, GnomePieBookmarkGroup))
#define GNOME_PIE_BOOKMARK_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_PIE_TYPE_BOOKMARK_GROUP, GnomePieBookmarkGroupClass))
#define GNOME_PIE_IS_BOOKMARK_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_PIE_TYPE_BOOKMARK_GROUP))
#define GNOME_PIE_IS_BOOKMARK_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_PIE_TYPE_BOOKMARK_GROUP))
#define GNOME_PIE_BOOKMARK_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_PIE_TYPE_BOOKMARK_GROUP, GnomePieBookmarkGroupClass))

typedef struct _GnomePieBookmarkGroup GnomePieBookmarkGroup;
typedef struct _GnomePieBookmarkGroupClass GnomePieBookmarkGroupClass;
typedef struct _GnomePieBookmarkGroupPrivate GnomePieBookmarkGroupPrivate;
enum  {
	GNOME_PIE_BOOKMARK_GROUP_0_PROPERTY,
	GNOME_PIE_BOOKMARK_GROUP_NUM_PROPERTIES
};
static GParamSpec* gnome_pie_bookmark_group_properties[GNOME_PIE_BOOKMARK_GROUP_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GNOME_PIE_GROUP_REGISTRY_TYPE_TYPEDESCRIPTION (gnome_pie_group_registry_typedescription_get_type ())
#define GNOME_PIE_GROUP_REGISTRY_TYPEDESCRIPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_PIE_GROUP_REGISTRY_TYPE_TYPEDESCRIPTION, GnomePieGroupRegistryTypeDescription))
#define GNOME_PIE_GROUP_REGISTRY_TYPEDESCRIPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_PIE_GROUP_REGISTRY_TYPE_TYPEDESCRIPTION, GnomePieGroupRegistryTypeDescriptionClass))
#define GNOME_PIE_GROUP_REGISTRY_IS_TYPEDESCRIPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_PIE_GROUP_REGISTRY_TYPE_TYPEDESCRIPTION))
#define GNOME_PIE_GROUP_REGISTRY_IS_TYPEDESCRIPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_PIE_GROUP_REGISTRY_TYPE_TYPEDESCRIPTION))
#define GNOME_PIE_GROUP_REGISTRY_TYPEDESCRIPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_PIE_GROUP_REGISTRY_TYPE_TYPEDESCRIPTION, GnomePieGroupRegistryTypeDescriptionClass))

typedef struct _GnomePieGroupRegistryTypeDescription GnomePieGroupRegistryTypeDescription;
typedef struct _GnomePieGroupRegistryTypeDescriptionClass GnomePieGroupRegistryTypeDescriptionClass;

#define GNOME_PIE_TYPE_ACTION (gnome_pie_action_get_type ())
#define GNOME_PIE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_PIE_TYPE_ACTION, GnomePieAction))
#define GNOME_PIE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_PIE_TYPE_ACTION, GnomePieActionClass))
#define GNOME_PIE_IS_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_PIE_TYPE_ACTION))
#define GNOME_PIE_IS_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_PIE_TYPE_ACTION))
#define GNOME_PIE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_PIE_TYPE_ACTION, GnomePieActionClass))

typedef struct _GnomePieAction GnomePieAction;
typedef struct _GnomePieActionClass GnomePieActionClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _GnomePieActionGroup {
	GObject parent_instance;
	GnomePieActionGroupPrivate * priv;
};

struct _GnomePieActionGroupClass {
	GObjectClass parent_class;
	void (*on_remove) (GnomePieActionGroup* self);
	void (*on_save) (GnomePieActionGroup* self, xmlTextWriter* writer);
	void (*on_load) (GnomePieActionGroup* self, xmlNode* data);
};

struct _GnomePieBookmarkGroup {
	GnomePieActionGroup parent_instance;
	GnomePieBookmarkGroupPrivate * priv;
};

struct _GnomePieBookmarkGroupClass {
	GnomePieActionGroupClass parent_class;
};

struct _GnomePieBookmarkGroupPrivate {
	GFileMonitor* monitor;
};

static gint GnomePieBookmarkGroup_private_offset;
static gpointer gnome_pie_bookmark_group_parent_class = NULL;

VALA_EXTERN GType gnome_pie_action_group_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GnomePieActionGroup, g_object_unref)
VALA_EXTERN GType gnome_pie_bookmark_group_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GnomePieBookmarkGroup, g_object_unref)
VALA_EXTERN gpointer gnome_pie_group_registry_typedescription_ref (gpointer instance);
VALA_EXTERN void gnome_pie_group_registry_typedescription_unref (gpointer instance);
VALA_EXTERN GParamSpec* gnome_pie_group_registry_param_spec_typedescription (const gchar* name,
                                                                 const gchar* nick,
                                                                 const gchar* blurb,
                                                                 GType object_type,
                                                                 GParamFlags flags);
VALA_EXTERN void gnome_pie_group_registry_value_set_typedescription (GValue* value,
                                                         gpointer v_object);
VALA_EXTERN void gnome_pie_group_registry_value_take_typedescription (GValue* value,
                                                          gpointer v_object);
VALA_EXTERN gpointer gnome_pie_group_registry_value_get_typedescription (const GValue* value);
VALA_EXTERN GType gnome_pie_group_registry_typedescription_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GnomePieGroupRegistryTypeDescription, gnome_pie_group_registry_typedescription_unref)
VALA_EXTERN GnomePieGroupRegistryTypeDescription* gnome_pie_bookmark_group_register (void);
VALA_EXTERN GnomePieGroupRegistryTypeDescription* gnome_pie_group_registry_typedescription_new (void);
VALA_EXTERN GnomePieGroupRegistryTypeDescription* gnome_pie_group_registry_typedescription_construct (GType object_type);
VALA_EXTERN void gnome_pie_group_registry_typedescription_set_name (GnomePieGroupRegistryTypeDescription* self,
                                                        const gchar* value);
VALA_EXTERN void gnome_pie_group_registry_typedescription_set_icon (GnomePieGroupRegistryTypeDescription* self,
                                                        const gchar* value);
VALA_EXTERN void gnome_pie_group_registry_typedescription_set_description (GnomePieGroupRegistryTypeDescription* self,
                                                               const gchar* value);
VALA_EXTERN void gnome_pie_group_registry_typedescription_set_id (GnomePieGroupRegistryTypeDescription* self,
                                                      const gchar* value);
VALA_EXTERN GnomePieBookmarkGroup* gnome_pie_bookmark_group_new (const gchar* parent_id);
VALA_EXTERN GnomePieBookmarkGroup* gnome_pie_bookmark_group_construct (GType object_type,
                                                           const gchar* parent_id);
static GFile* gnome_pie_bookmark_group_get_bookmarks_file (GnomePieBookmarkGroup* self);
static void gnome_pie_bookmark_group_load (GnomePieBookmarkGroup* self);
VALA_EXTERN GType gnome_pie_action_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GnomePieAction, g_object_unref)
VALA_EXTERN void gnome_pie_action_group_add_action (GnomePieActionGroup* self,
                                        GnomePieAction* new_action);
VALA_EXTERN GnomePieAction* gnome_pie_action_registry_new_for_uri (const gchar* uri,
                                                       const gchar* name);
static GObject * gnome_pie_bookmark_group_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void _gnome_pie_bookmark_group_____lambda31_ (GnomePieBookmarkGroup* self,
                                              GFile* file,
                                              GFile* other,
                                              GFileMonitorEvent type);
VALA_EXTERN void gnome_pie_action_group_delete_all (GnomePieActionGroup* self);
static void __gnome_pie_bookmark_group_____lambda31__g_file_monitor_changed (GFileMonitor* _sender,
                                                                      GFile* file,
                                                                      GFile* other_file,
                                                                      GFileMonitorEvent event_type,
                                                                      gpointer self);
static void gnome_pie_bookmark_group_finalize (GObject * obj);
static GType gnome_pie_bookmark_group_get_type_once (void);

static inline gpointer
gnome_pie_bookmark_group_get_instance_private (GnomePieBookmarkGroup* self)
{
	return G_STRUCT_MEMBER_P (self, GnomePieBookmarkGroup_private_offset);
}

GnomePieGroupRegistryTypeDescription*
gnome_pie_bookmark_group_register (void)
{
	GnomePieGroupRegistryTypeDescription* description = NULL;
	GnomePieGroupRegistryTypeDescription* _tmp0_;
	GnomePieGroupRegistryTypeDescription* result;
	_tmp0_ = gnome_pie_group_registry_typedescription_new ();
	description = _tmp0_;
	gnome_pie_group_registry_typedescription_set_name (description, _ ("Group: Bookmarks"));
	gnome_pie_group_registry_typedescription_set_icon (description, "user-bookmarks");
	gnome_pie_group_registry_typedescription_set_description (description, _ ("Shows a Slice for each of your directory Bookmarks."));
	gnome_pie_group_registry_typedescription_set_id (description, "bookmarks");
	result = description;
	return result;
}

GnomePieBookmarkGroup*
gnome_pie_bookmark_group_construct (GType object_type,
                                    const gchar* parent_id)
{
	GnomePieBookmarkGroup * self = NULL;
	g_return_val_if_fail (parent_id != NULL, NULL);
	self = (GnomePieBookmarkGroup*) g_object_new (object_type, "parent-id", parent_id, NULL);
	return self;
}

GnomePieBookmarkGroup*
gnome_pie_bookmark_group_new (const gchar* parent_id)
{
	return gnome_pie_bookmark_group_construct (GNOME_PIE_TYPE_BOOKMARK_GROUP, parent_id);
}

static GFile*
gnome_pie_bookmark_group_get_bookmarks_file (GnomePieBookmarkGroup* self)
{
	GFile* bookmarks_file = NULL;
	const gchar* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	GFile* _tmp3_;
	GFile* _tmp4_;
	GFile* _tmp5_;
	const gchar* _tmp6_;
	GFile* _tmp7_;
	GFile* _tmp8_;
	GFile* _tmp9_;
	GFile* _tmp10_;
	GFile* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_get_home_dir ();
	_tmp1_ = g_file_new_for_path (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_file_get_child (_tmp2_, ".gtk-bookmarks");
	_tmp4_ = _tmp3_;
	_g_object_unref0 (_tmp2_);
	bookmarks_file = _tmp4_;
	_tmp5_ = bookmarks_file;
	if (g_file_query_exists (_tmp5_, NULL)) {
		result = bookmarks_file;
		return result;
	}
	_tmp6_ = g_get_home_dir ();
	_tmp7_ = g_file_new_for_path (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_file_get_child (_tmp8_, ".config/gtk-3.0/bookmarks");
	_g_object_unref0 (bookmarks_file);
	bookmarks_file = _tmp9_;
	_g_object_unref0 (_tmp8_);
	_tmp10_ = bookmarks_file;
	if (g_file_query_exists (_tmp10_, NULL)) {
		result = bookmarks_file;
		return result;
	}
	result = NULL;
	_g_object_unref0 (bookmarks_file);
	return result;
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static void
gnome_pie_bookmark_group_load (GnomePieBookmarkGroup* self)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GnomePieAction* _tmp3_;
	GnomePieAction* _tmp4_;
	GFile* bookmarks_file = NULL;
	GFile* _tmp5_;
	GFile* _tmp6_;
	GnomePieAction* _tmp31_;
	GnomePieAction* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	GnomePieAction* _tmp36_;
	GnomePieAction* _tmp37_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_get_home_dir ();
	_tmp1_ = g_strconcat ("file://", _tmp0_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = gnome_pie_action_registry_new_for_uri (_tmp2_, NULL);
	_tmp4_ = _tmp3_;
	gnome_pie_action_group_add_action ((GnomePieActionGroup*) self, _tmp4_);
	_g_object_unref0 (_tmp4_);
	_g_free0 (_tmp2_);
	_tmp5_ = gnome_pie_bookmark_group_get_bookmarks_file (self);
	bookmarks_file = _tmp5_;
	_tmp6_ = bookmarks_file;
	if (_tmp6_ == NULL) {
		g_warning ("bookmarkGroup.vala:122: Failed to find bookmarks file!");
		_g_object_unref0 (bookmarks_file);
		return;
	}
	{
		GFileInputStream* _tmp7_ = NULL;
		GFile* _tmp8_;
		GFileInputStream* _tmp9_;
		GDataInputStream* dis = NULL;
		GDataInputStream* _tmp10_;
		gchar* line = NULL;
		_tmp8_ = bookmarks_file;
		_tmp9_ = g_file_read (_tmp8_, NULL, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp10_ = g_data_input_stream_new ((GInputStream*) _tmp7_);
		dis = _tmp10_;
		while (TRUE) {
			gchar* _tmp11_ = NULL;
			GDataInputStream* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			const gchar* _tmp15_;
			gchar* uri = NULL;
			const gchar* _tmp16_;
			gchar* _tmp17_;
			gchar* name = NULL;
			gint first_space = 0;
			const gchar* _tmp18_;
			const gchar* _tmp26_;
			const gchar* _tmp27_;
			GnomePieAction* _tmp28_;
			GnomePieAction* _tmp29_;
			_tmp12_ = dis;
			_tmp13_ = g_data_input_stream_read_line (_tmp12_, NULL, NULL, &_inner_error0_);
			_tmp11_ = _tmp13_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_free0 (line);
				_g_object_unref0 (dis);
				_g_object_unref0 (_tmp7_);
				goto __catch0_g_error;
			}
			_tmp14_ = _tmp11_;
			_tmp11_ = NULL;
			_g_free0 (line);
			line = _tmp14_;
			_tmp15_ = line;
			if (!(_tmp15_ != NULL)) {
				_g_free0 (_tmp11_);
				break;
			}
			_tmp16_ = line;
			_tmp17_ = g_strdup (_tmp16_);
			uri = _tmp17_;
			name = NULL;
			_tmp18_ = line;
			first_space = string_index_of (_tmp18_, " ", 0);
			if (first_space > 0) {
				const gchar* _tmp19_;
				gchar* _tmp20_;
				const gchar* _tmp21_;
				const gchar* _tmp22_;
				gint _tmp23_;
				gint _tmp24_;
				gchar* _tmp25_;
				_tmp19_ = line;
				_tmp20_ = string_slice (_tmp19_, (glong) 0, (glong) first_space);
				_g_free0 (uri);
				uri = _tmp20_;
				_tmp21_ = line;
				_tmp22_ = line;
				_tmp23_ = strlen (_tmp22_);
				_tmp24_ = _tmp23_;
				_tmp25_ = string_slice (_tmp21_, (glong) (first_space + 1), (glong) _tmp24_);
				_g_free0 (name);
				name = _tmp25_;
			}
			_tmp26_ = uri;
			_tmp27_ = name;
			_tmp28_ = gnome_pie_action_registry_new_for_uri (_tmp26_, _tmp27_);
			_tmp29_ = _tmp28_;
			gnome_pie_action_group_add_action ((GnomePieActionGroup*) self, _tmp29_);
			_g_object_unref0 (_tmp29_);
			_g_free0 (name);
			_g_free0 (uri);
			_g_free0 (_tmp11_);
		}
		_g_free0 (line);
		_g_object_unref0 (dis);
		_g_object_unref0 (_tmp7_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp30_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp30_ = e->message;
		g_error ("bookmarkGroup.vala:143: %s", _tmp30_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (bookmarks_file);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_tmp31_ = gnome_pie_action_registry_new_for_uri ("trash://", NULL);
	_tmp32_ = _tmp31_;
	gnome_pie_action_group_add_action ((GnomePieActionGroup*) self, _tmp32_);
	_g_object_unref0 (_tmp32_);
	_tmp33_ = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
	_tmp34_ = g_strconcat ("file://", _tmp33_, NULL);
	_tmp35_ = _tmp34_;
	_tmp36_ = gnome_pie_action_registry_new_for_uri (_tmp35_, NULL);
	_tmp37_ = _tmp36_;
	gnome_pie_action_group_add_action ((GnomePieActionGroup*) self, _tmp37_);
	_g_object_unref0 (_tmp37_);
	_g_free0 (_tmp35_);
	_g_object_unref0 (bookmarks_file);
}

static void
_gnome_pie_bookmark_group_____lambda31_ (GnomePieBookmarkGroup* self,
                                         GFile* file,
                                         GFile* other,
                                         GFileMonitorEvent type)
{
	g_return_if_fail (file != NULL);
	if (type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT) {
		gnome_pie_action_group_delete_all ((GnomePieActionGroup*) self);
		gnome_pie_bookmark_group_load (self);
	}
}

static void
__gnome_pie_bookmark_group_____lambda31__g_file_monitor_changed (GFileMonitor* _sender,
                                                                 GFile* file,
                                                                 GFile* other_file,
                                                                 GFileMonitorEvent event_type,
                                                                 gpointer self)
{
	_gnome_pie_bookmark_group_____lambda31_ ((GnomePieBookmarkGroup*) self, file, other_file, event_type);
}

static GObject *
gnome_pie_bookmark_group_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GnomePieBookmarkGroup * self;
	GFile* bookmarks_file = NULL;
	GFile* _tmp0_;
	GFile* _tmp1_;
	GError* _inner_error0_ = NULL;
	parent_class = G_OBJECT_CLASS (gnome_pie_bookmark_group_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GNOME_PIE_TYPE_BOOKMARK_GROUP, GnomePieBookmarkGroup);
	gnome_pie_bookmark_group_load (self);
	_tmp0_ = gnome_pie_bookmark_group_get_bookmarks_file (self);
	bookmarks_file = _tmp0_;
	_tmp1_ = bookmarks_file;
	if (_tmp1_ != NULL) {
		{
			GFileMonitor* _tmp2_ = NULL;
			GFile* _tmp3_;
			GFileMonitor* _tmp4_;
			GFileMonitor* _tmp5_;
			GFileMonitor* _tmp6_;
			GFileMonitor* _tmp7_;
			_tmp3_ = bookmarks_file;
			_tmp4_ = g_file_monitor (_tmp3_, G_FILE_MONITOR_NONE, NULL, &_inner_error0_);
			_tmp2_ = _tmp4_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp5_ = _tmp2_;
			_tmp2_ = NULL;
			_g_object_unref0 (self->priv->monitor);
			self->priv->monitor = _tmp5_;
			_tmp6_ = self->priv->monitor;
			g_file_monitor_set_rate_limit (_tmp6_, 500);
			_tmp7_ = self->priv->monitor;
			g_signal_connect_object (_tmp7_, "changed", (GCallback) __gnome_pie_bookmark_group_____lambda31__g_file_monitor_changed, self, 0);
			_g_object_unref0 (_tmp2_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp8_;
			const gchar* _tmp9_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp8_ = e;
			_tmp9_ = _tmp8_->message;
			g_warning ("bookmarkGroup.vala:86: %s", _tmp9_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (bookmarks_file);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
		}
	}
	_g_object_unref0 (bookmarks_file);
	return obj;
}

static void
gnome_pie_bookmark_group_class_init (GnomePieBookmarkGroupClass * klass,
                                     gpointer klass_data)
{
	gnome_pie_bookmark_group_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GnomePieBookmarkGroup_private_offset);
	G_OBJECT_CLASS (klass)->constructor = gnome_pie_bookmark_group_constructor;
	G_OBJECT_CLASS (klass)->finalize = gnome_pie_bookmark_group_finalize;
}

static void
gnome_pie_bookmark_group_instance_init (GnomePieBookmarkGroup * self,
                                        gpointer klass)
{
	self->priv = gnome_pie_bookmark_group_get_instance_private (self);
	self->priv->monitor = NULL;
}

static void
gnome_pie_bookmark_group_finalize (GObject * obj)
{
	GnomePieBookmarkGroup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GNOME_PIE_TYPE_BOOKMARK_GROUP, GnomePieBookmarkGroup);
	_g_object_unref0 (self->priv->monitor);
	G_OBJECT_CLASS (gnome_pie_bookmark_group_parent_class)->finalize (obj);
}

static GType
gnome_pie_bookmark_group_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GnomePieBookmarkGroupClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gnome_pie_bookmark_group_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GnomePieBookmarkGroup), 0, (GInstanceInitFunc) gnome_pie_bookmark_group_instance_init, NULL };
	GType gnome_pie_bookmark_group_type_id;
	gnome_pie_bookmark_group_type_id = g_type_register_static (GNOME_PIE_TYPE_ACTION_GROUP, "GnomePieBookmarkGroup", &g_define_type_info, 0);
	GnomePieBookmarkGroup_private_offset = g_type_add_instance_private (gnome_pie_bookmark_group_type_id, sizeof (GnomePieBookmarkGroupPrivate));
	return gnome_pie_bookmark_group_type_id;
}

GType
gnome_pie_bookmark_group_get_type (void)
{
	static volatile gsize gnome_pie_bookmark_group_type_id__once = 0;
	if (g_once_init_enter (&gnome_pie_bookmark_group_type_id__once)) {
		GType gnome_pie_bookmark_group_type_id;
		gnome_pie_bookmark_group_type_id = gnome_pie_bookmark_group_get_type_once ();
		g_once_init_leave (&gnome_pie_bookmark_group_type_id__once, gnome_pie_bookmark_group_type_id);
	}
	return gnome_pie_bookmark_group_type_id__once;
}

