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

/*-
 * Copyright (c) 2017-2018 elementary LLC. (https://elementary.io),
 *               2013 Julien Spautz <spautz.julien@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * as published by the Free Software Foundation, either version 3 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 warranties of
 * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Julien Spautz <spautz.julien@gmail.com>, Andrei-Costin Zisu <matzipan@gmail.com>
 */

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gee.h>
#include <glib/gi18n-lib.h>

#define SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_RENAME_AFTER_NEW_DELAY_MSEC ((guint) 500)
#define SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_MAX_TEMPLATES 2048
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_GROUP "file-view"
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_PREFIX SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_GROUP "."
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_RENAME_FOLDER "rename-folder"
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_DELETE "delete"
#define SCRATCH_MAIN_WINDOW_ACTION_GROUP "win"
#define SCRATCH_MAIN_WINDOW_ACTION_PREFIX SCRATCH_MAIN_WINDOW_ACTION_GROUP "."
#define SCRATCH_MAIN_WINDOW_ACTION_FIND_GLOBAL "action-find-global"
#define SCRATCH_MAIN_WINDOW_ACTION_OPEN_IN_TERMINAL "action-open-in-terminal"
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_SHOW_APP_CHOOSER "show-app-chooser"
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_NEW_FOLDER "new-folder"
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_NEW_FILE "new-file"
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_NEW_FROM_TEMPLATE "new-from-template"
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_RENAME_FILE "rename-file"
#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 CODE_WIDGETS_SOURCE_LIST_TYPE_ITEM (code_widgets_source_list_item_get_type ())
#define CODE_WIDGETS_SOURCE_LIST_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CODE_WIDGETS_SOURCE_LIST_TYPE_ITEM, CodeWidgetsSourceListItem))
#define CODE_WIDGETS_SOURCE_LIST_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CODE_WIDGETS_SOURCE_LIST_TYPE_ITEM, CodeWidgetsSourceListItemClass))
#define CODE_WIDGETS_SOURCE_LIST_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CODE_WIDGETS_SOURCE_LIST_TYPE_ITEM))
#define CODE_WIDGETS_SOURCE_LIST_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CODE_WIDGETS_SOURCE_LIST_TYPE_ITEM))
#define CODE_WIDGETS_SOURCE_LIST_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CODE_WIDGETS_SOURCE_LIST_TYPE_ITEM, CodeWidgetsSourceListItemClass))

typedef struct _CodeWidgetsSourceListItem CodeWidgetsSourceListItem;
typedef struct _CodeWidgetsSourceListItemClass CodeWidgetsSourceListItemClass;
typedef struct _CodeWidgetsSourceListItemPrivate CodeWidgetsSourceListItemPrivate;

#define CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM (code_widgets_source_list_expandable_item_get_type ())
#define CODE_WIDGETS_SOURCE_LIST_EXPANDABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, CodeWidgetsSourceListExpandableItem))
#define CODE_WIDGETS_SOURCE_LIST_EXPANDABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, CodeWidgetsSourceListExpandableItemClass))
#define CODE_WIDGETS_SOURCE_LIST_IS_EXPANDABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM))
#define CODE_WIDGETS_SOURCE_LIST_IS_EXPANDABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM))
#define CODE_WIDGETS_SOURCE_LIST_EXPANDABLE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, CodeWidgetsSourceListExpandableItemClass))

typedef struct _CodeWidgetsSourceListExpandableItem CodeWidgetsSourceListExpandableItem;
typedef struct _CodeWidgetsSourceListExpandableItemClass CodeWidgetsSourceListExpandableItemClass;
typedef struct _CodeWidgetsSourceListExpandableItemPrivate CodeWidgetsSourceListExpandableItemPrivate;

#define CODE_WIDGETS_TYPE_SOURCE_LIST_SORTABLE (code_widgets_source_list_sortable_get_type ())
#define CODE_WIDGETS_SOURCE_LIST_SORTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CODE_WIDGETS_TYPE_SOURCE_LIST_SORTABLE, CodeWidgetsSourceListSortable))
#define CODE_WIDGETS_IS_SOURCE_LIST_SORTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CODE_WIDGETS_TYPE_SOURCE_LIST_SORTABLE))
#define CODE_WIDGETS_SOURCE_LIST_SORTABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CODE_WIDGETS_TYPE_SOURCE_LIST_SORTABLE, CodeWidgetsSourceListSortableIface))

typedef struct _CodeWidgetsSourceListSortable CodeWidgetsSourceListSortable;
typedef struct _CodeWidgetsSourceListSortableIface CodeWidgetsSourceListSortableIface;

#define SCRATCH_FOLDER_MANAGER_TYPE_ITEM (scratch_folder_manager_item_get_type ())
#define SCRATCH_FOLDER_MANAGER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_FOLDER_MANAGER_TYPE_ITEM, ScratchFolderManagerItem))
#define SCRATCH_FOLDER_MANAGER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_FOLDER_MANAGER_TYPE_ITEM, ScratchFolderManagerItemClass))
#define SCRATCH_FOLDER_MANAGER_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_FOLDER_MANAGER_TYPE_ITEM))
#define SCRATCH_FOLDER_MANAGER_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_FOLDER_MANAGER_TYPE_ITEM))
#define SCRATCH_FOLDER_MANAGER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_FOLDER_MANAGER_TYPE_ITEM, ScratchFolderManagerItemClass))

typedef struct _ScratchFolderManagerItem ScratchFolderManagerItem;
typedef struct _ScratchFolderManagerItemClass ScratchFolderManagerItemClass;
typedef struct _ScratchFolderManagerItemPrivate ScratchFolderManagerItemPrivate;

#define SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM (scratch_folder_manager_folder_item_get_type ())
#define SCRATCH_FOLDER_MANAGER_FOLDER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, ScratchFolderManagerFolderItem))
#define SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, ScratchFolderManagerFolderItemClass))
#define SCRATCH_FOLDER_MANAGER_IS_FOLDER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM))
#define SCRATCH_FOLDER_MANAGER_IS_FOLDER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM))
#define SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, ScratchFolderManagerFolderItemClass))

typedef struct _ScratchFolderManagerFolderItem ScratchFolderManagerFolderItem;
typedef struct _ScratchFolderManagerFolderItemClass ScratchFolderManagerFolderItemClass;
typedef struct _ScratchFolderManagerFolderItemPrivate ScratchFolderManagerFolderItemPrivate;
enum  {
	SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_0_PROPERTY,
	SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_LOADING_REQUIRED_PROPERTY,
	SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_NUM_PROPERTIES
};
static GParamSpec* scratch_folder_manager_folder_item_properties[SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define SCRATCH_FOLDER_MANAGER_TYPE_FILE (scratch_folder_manager_file_get_type ())
#define SCRATCH_FOLDER_MANAGER_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FILE, ScratchFolderManagerFile))
#define SCRATCH_FOLDER_MANAGER_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_FOLDER_MANAGER_TYPE_FILE, ScratchFolderManagerFileClass))
#define SCRATCH_FOLDER_MANAGER_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FILE))
#define SCRATCH_FOLDER_MANAGER_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_FOLDER_MANAGER_TYPE_FILE))
#define SCRATCH_FOLDER_MANAGER_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FILE, ScratchFolderManagerFileClass))

typedef struct _ScratchFolderManagerFile ScratchFolderManagerFile;
typedef struct _ScratchFolderManagerFileClass ScratchFolderManagerFileClass;

#define CODE_WIDGETS_TYPE_SOURCE_LIST (code_widgets_source_list_get_type ())
#define CODE_WIDGETS_SOURCE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CODE_WIDGETS_TYPE_SOURCE_LIST, CodeWidgetsSourceList))
#define CODE_WIDGETS_SOURCE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CODE_WIDGETS_TYPE_SOURCE_LIST, CodeWidgetsSourceListClass))
#define CODE_WIDGETS_IS_SOURCE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CODE_WIDGETS_TYPE_SOURCE_LIST))
#define CODE_WIDGETS_IS_SOURCE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CODE_WIDGETS_TYPE_SOURCE_LIST))
#define CODE_WIDGETS_SOURCE_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CODE_WIDGETS_TYPE_SOURCE_LIST, CodeWidgetsSourceListClass))

typedef struct _CodeWidgetsSourceList CodeWidgetsSourceList;
typedef struct _CodeWidgetsSourceListClass CodeWidgetsSourceListClass;

#define SCRATCH_FOLDER_MANAGER_TYPE_FILE_VIEW (scratch_folder_manager_file_view_get_type ())
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FILE_VIEW, ScratchFolderManagerFileView))
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_FOLDER_MANAGER_TYPE_FILE_VIEW, ScratchFolderManagerFileViewClass))
#define SCRATCH_FOLDER_MANAGER_IS_FILE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FILE_VIEW))
#define SCRATCH_FOLDER_MANAGER_IS_FILE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_FOLDER_MANAGER_TYPE_FILE_VIEW))
#define SCRATCH_FOLDER_MANAGER_FILE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FILE_VIEW, ScratchFolderManagerFileViewClass))

typedef struct _ScratchFolderManagerFileView ScratchFolderManagerFileView;
typedef struct _ScratchFolderManagerFileViewClass ScratchFolderManagerFileViewClass;
typedef struct _Block19Data Block19Data;
typedef struct _Block20Data Block20Data;
typedef struct _ScratchFolderManagerFolderItemLoadChildrenAsyncData ScratchFolderManagerFolderItemLoadChildrenAsyncData;

#define SCRATCH_FOLDER_MANAGER_TYPE_FILE_ITEM (scratch_folder_manager_file_item_get_type ())
#define SCRATCH_FOLDER_MANAGER_FILE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FILE_ITEM, ScratchFolderManagerFileItem))
#define SCRATCH_FOLDER_MANAGER_FILE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_FOLDER_MANAGER_TYPE_FILE_ITEM, ScratchFolderManagerFileItemClass))
#define SCRATCH_FOLDER_MANAGER_IS_FILE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FILE_ITEM))
#define SCRATCH_FOLDER_MANAGER_IS_FILE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_FOLDER_MANAGER_TYPE_FILE_ITEM))
#define SCRATCH_FOLDER_MANAGER_FILE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_FOLDER_MANAGER_TYPE_FILE_ITEM, ScratchFolderManagerFileItemClass))

typedef struct _ScratchFolderManagerFileItem ScratchFolderManagerFileItem;
typedef struct _ScratchFolderManagerFileItemClass ScratchFolderManagerFileItemClass;

#define SCRATCH_FOLDER_MANAGER_TYPE_PROJECT_FOLDER_ITEM (scratch_folder_manager_project_folder_item_get_type ())
#define SCRATCH_FOLDER_MANAGER_PROJECT_FOLDER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_FOLDER_MANAGER_TYPE_PROJECT_FOLDER_ITEM, ScratchFolderManagerProjectFolderItem))
#define SCRATCH_FOLDER_MANAGER_PROJECT_FOLDER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_FOLDER_MANAGER_TYPE_PROJECT_FOLDER_ITEM, ScratchFolderManagerProjectFolderItemClass))
#define SCRATCH_FOLDER_MANAGER_IS_PROJECT_FOLDER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_FOLDER_MANAGER_TYPE_PROJECT_FOLDER_ITEM))
#define SCRATCH_FOLDER_MANAGER_IS_PROJECT_FOLDER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_FOLDER_MANAGER_TYPE_PROJECT_FOLDER_ITEM))
#define SCRATCH_FOLDER_MANAGER_PROJECT_FOLDER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_FOLDER_MANAGER_TYPE_PROJECT_FOLDER_ITEM, ScratchFolderManagerProjectFolderItemClass))

typedef struct _ScratchFolderManagerProjectFolderItem ScratchFolderManagerProjectFolderItem;
typedef struct _ScratchFolderManagerProjectFolderItemClass ScratchFolderManagerProjectFolderItemClass;

#define SCRATCH_SERVICES_TYPE_MONITORED_REPOSITORY (scratch_services_monitored_repository_get_type ())
#define SCRATCH_SERVICES_MONITORED_REPOSITORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_SERVICES_TYPE_MONITORED_REPOSITORY, ScratchServicesMonitoredRepository))
#define SCRATCH_SERVICES_MONITORED_REPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_SERVICES_TYPE_MONITORED_REPOSITORY, ScratchServicesMonitoredRepositoryClass))
#define SCRATCH_SERVICES_IS_MONITORED_REPOSITORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_SERVICES_TYPE_MONITORED_REPOSITORY))
#define SCRATCH_SERVICES_IS_MONITORED_REPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_SERVICES_TYPE_MONITORED_REPOSITORY))
#define SCRATCH_SERVICES_MONITORED_REPOSITORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_SERVICES_TYPE_MONITORED_REPOSITORY, ScratchServicesMonitoredRepositoryClass))

typedef struct _ScratchServicesMonitoredRepository ScratchServicesMonitoredRepository;
typedef struct _ScratchServicesMonitoredRepositoryClass ScratchServicesMonitoredRepositoryClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _Block21Data Block21Data;
typedef struct _Block22Data Block22Data;
typedef struct _Block23Data Block23Data;
typedef struct _Block24Data Block24Data;
typedef struct _Block25Data Block25Data;
typedef struct _Block26Data Block26Data;
typedef struct _Block27Data Block27Data;

#define SCRATCH_FOLDER_MANAGER_ITEM_TYPE_RENAME_ITEM (scratch_folder_manager_item_rename_item_get_type ())
#define SCRATCH_FOLDER_MANAGER_ITEM_RENAME_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_FOLDER_MANAGER_ITEM_TYPE_RENAME_ITEM, ScratchFolderManagerItemRenameItem))
#define SCRATCH_FOLDER_MANAGER_ITEM_RENAME_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_FOLDER_MANAGER_ITEM_TYPE_RENAME_ITEM, ScratchFolderManagerItemRenameItemClass))
#define SCRATCH_FOLDER_MANAGER_ITEM_IS_RENAME_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_FOLDER_MANAGER_ITEM_TYPE_RENAME_ITEM))
#define SCRATCH_FOLDER_MANAGER_ITEM_IS_RENAME_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_FOLDER_MANAGER_ITEM_TYPE_RENAME_ITEM))
#define SCRATCH_FOLDER_MANAGER_ITEM_RENAME_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_FOLDER_MANAGER_ITEM_TYPE_RENAME_ITEM, ScratchFolderManagerItemRenameItemClass))

typedef struct _ScratchFolderManagerItemRenameItem ScratchFolderManagerItemRenameItem;
typedef struct _ScratchFolderManagerItemRenameItemClass ScratchFolderManagerItemRenameItemClass;
typedef struct _Block28Data Block28Data;
typedef struct _Block29Data Block29Data;
enum  {
	SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_CHILDREN_FINISHED_LOADING_SIGNAL,
	SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_NUM_SIGNALS
};
static guint scratch_folder_manager_folder_item_signals[SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _CodeWidgetsSourceListItem {
	GObject parent_instance;
	CodeWidgetsSourceListItemPrivate * priv;
};

struct _CodeWidgetsSourceListItemClass {
	GObjectClass parent_class;
	GMenu* (*get_context_menu) (CodeWidgetsSourceListItem* self);
	void (*edited) (CodeWidgetsSourceListItem* self, const gchar* new_name);
	void (*action_activated) (CodeWidgetsSourceListItem* self);
	void (*activated) (CodeWidgetsSourceListItem* self);
};

struct _CodeWidgetsSourceListExpandableItem {
	CodeWidgetsSourceListItem parent_instance;
	CodeWidgetsSourceListExpandableItemPrivate * priv;
};

struct _CodeWidgetsSourceListExpandableItemClass {
	CodeWidgetsSourceListItemClass parent_class;
	void (*toggled) (CodeWidgetsSourceListExpandableItem* self);
};

struct _CodeWidgetsSourceListSortableIface {
	GTypeInterface parent_iface;
	gboolean (*allow_dnd_sorting) (CodeWidgetsSourceListSortable* self);
	gint (*compare) (CodeWidgetsSourceListSortable* self, CodeWidgetsSourceListItem* a, CodeWidgetsSourceListItem* b);
};

struct _ScratchFolderManagerItem {
	CodeWidgetsSourceListExpandableItem parent_instance;
	ScratchFolderManagerItemPrivate * priv;
};

struct _ScratchFolderManagerItemClass {
	CodeWidgetsSourceListExpandableItemClass parent_class;
};

struct _ScratchFolderManagerFolderItem {
	ScratchFolderManagerItem parent_instance;
	ScratchFolderManagerFolderItemPrivate * priv;
};

struct _ScratchFolderManagerFolderItemClass {
	ScratchFolderManagerItemClass parent_class;
	void (*on_changed) (ScratchFolderManagerFolderItem* self, GFile* source, GFile* dest, GFileMonitorEvent event);
};

struct _ScratchFolderManagerFolderItemPrivate {
	GFileMonitor* monitor;
	gboolean children_loaded;
	gboolean has_dummy;
	CodeWidgetsSourceListItem* dummy;
};

struct _Block19Data {
	int _ref_count_;
	ScratchFolderManagerFolderItem* self;
	gpointer _async_data_;
};

struct _Block20Data {
	int _ref_count_;
	Block19Data * _data19_;
	ScratchFolderManagerFile* child;
};

struct _ScratchFolderManagerFolderItemLoadChildrenAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ScratchFolderManagerFolderItem* self;
	Block19Data* _data19_;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GeeIterator* _child_it;
	ScratchFolderManagerFile* _tmp2_;
	ScratchFolderManagerFile* _tmp3_;
	GeeCollection* _tmp4_;
	GeeCollection* _tmp5_;
	GeeCollection* _tmp6_;
	GeeIterator* _tmp7_;
	GeeIterator* _tmp8_;
	Block20Data* _data20_;
	GeeIterator* _tmp9_;
	GeeIterator* _tmp10_;
	gpointer _tmp11_;
};

struct _Block21Data {
	int _ref_count_;
	ScratchFolderManagerFolderItem* self;
	GMenu* template_submenu;
};

struct _Block22Data {
	int _ref_count_;
	ScratchFolderManagerFolderItem* self;
	gchar* template_path;
};

struct _Block23Data {
	int _ref_count_;
	Block22Data * _data22_;
	gulong once;
};

struct _Block24Data {
	int _ref_count_;
	ScratchFolderManagerFolderItem* self;
	GFile* new_file;
	gulong once;
};

struct _Block25Data {
	int _ref_count_;
	Block24Data * _data24_;
	gchar* path;
};

struct _Block26Data {
	int _ref_count_;
	ScratchFolderManagerFolderItem* self;
	gchar* name;
	gboolean is_folder;
};

struct _Block27Data {
	int _ref_count_;
	Block26Data * _data26_;
	gulong once;
};

struct _Block28Data {
	int _ref_count_;
	ScratchFolderManagerFolderItem* self;
	ScratchFolderManagerItemRenameItem* rename_item;
};

struct _Block29Data {
	int _ref_count_;
	Block28Data * _data28_;
	gulong once;
};

static gint ScratchFolderManagerFolderItem_private_offset;
static gpointer scratch_folder_manager_folder_item_parent_class = NULL;

VALA_EXTERN GType code_widgets_source_list_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CodeWidgetsSourceListItem, g_object_unref)
VALA_EXTERN GType code_widgets_source_list_expandable_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CodeWidgetsSourceListExpandableItem, g_object_unref)
VALA_EXTERN GType code_widgets_source_list_sortable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CodeWidgetsSourceListSortable, g_object_unref)
VALA_EXTERN GType scratch_folder_manager_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchFolderManagerItem, g_object_unref)
VALA_EXTERN GType scratch_folder_manager_folder_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchFolderManagerFolderItem, g_object_unref)
VALA_EXTERN GMenu* code_widgets_source_list_item_get_context_menu (CodeWidgetsSourceListItem* self);
VALA_EXTERN void scratch_folder_manager_folder_item_on_changed (ScratchFolderManagerFolderItem* self,
                                                    GFile* source,
                                                    GFile* dest,
                                                    GFileMonitorEvent event);
VALA_EXTERN GType scratch_folder_manager_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchFolderManagerFile, g_object_unref)
VALA_EXTERN GType code_widgets_source_list_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CodeWidgetsSourceList, g_object_unref)
VALA_EXTERN GType scratch_folder_manager_file_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchFolderManagerFileView, g_object_unref)
VALA_EXTERN ScratchFolderManagerFolderItem* scratch_folder_manager_folder_item_new (ScratchFolderManagerFile* file,
                                                                        ScratchFolderManagerFileView* view);
VALA_EXTERN ScratchFolderManagerFolderItem* scratch_folder_manager_folder_item_construct (GType object_type,
                                                                              ScratchFolderManagerFile* file,
                                                                              ScratchFolderManagerFileView* view);
VALA_EXTERN void scratch_folder_manager_folder_item_load_children (ScratchFolderManagerFolderItem* self);
VALA_EXTERN gboolean scratch_folder_manager_folder_item_get_loading_required (ScratchFolderManagerFolderItem* self);
VALA_EXTERN ScratchFolderManagerFile* scratch_folder_manager_item_get_file (ScratchFolderManagerItem* self);
VALA_EXTERN GeeCollection* scratch_folder_manager_file_get_children (ScratchFolderManagerFile* self);
static void scratch_folder_manager_folder_item_add_child (ScratchFolderManagerFolderItem* self,
                                                   ScratchFolderManagerFile* child);
static void scratch_folder_manager_folder_item_after_children_loaded (ScratchFolderManagerFolderItem* self);
static void scratch_folder_manager_folder_item_load_children_async_data_free (gpointer _data);
static void scratch_folder_manager_folder_item_load_children_async (ScratchFolderManagerFolderItem* self,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static void scratch_folder_manager_folder_item_load_children_finish (ScratchFolderManagerFolderItem* self,
                                                              GAsyncResult* _res_);
static gboolean scratch_folder_manager_folder_item_load_children_async_co (ScratchFolderManagerFolderItemLoadChildrenAsyncData* _data_);
static Block19Data* block19_data_ref (Block19Data* _data19_);
static void block19_data_unref (void * _userdata_);
static Block20Data* block20_data_ref (Block20Data* _data20_);
static void block20_data_unref (void * _userdata_);
static gboolean _____lambda119_ (Block20Data* _data20_);
static gboolean ______lambda119__gsource_func (gpointer self);
VALA_EXTERN gboolean scratch_folder_manager_file_get_is_valid_directory (ScratchFolderManagerFile* self);
VALA_EXTERN ScratchFolderManagerFileView* scratch_folder_manager_item_get_view (ScratchFolderManagerItem* self);
VALA_EXTERN gboolean scratch_folder_manager_file_get_is_valid_textfile (ScratchFolderManagerFile* self);
VALA_EXTERN ScratchFolderManagerFileItem* scratch_folder_manager_file_item_new (ScratchFolderManagerFile* file,
                                                                    ScratchFolderManagerFileView* view);
VALA_EXTERN ScratchFolderManagerFileItem* scratch_folder_manager_file_item_construct (GType object_type,
                                                                          ScratchFolderManagerFile* file,
                                                                          ScratchFolderManagerFileView* view);
VALA_EXTERN GType scratch_folder_manager_file_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchFolderManagerFileItem, g_object_unref)
VALA_EXTERN void scratch_folder_manager_folder_item_add (ScratchFolderManagerFolderItem* self,
                                             CodeWidgetsSourceListItem* item);
VALA_EXTERN GType scratch_folder_manager_project_folder_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchFolderManagerProjectFolderItem, g_object_unref)
VALA_EXTERN ScratchFolderManagerProjectFolderItem* scratch_folder_manager_item_get_root_folder (ScratchFolderManagerItem* self,
                                                                                    CodeWidgetsSourceListExpandableItem* start);
VALA_EXTERN void scratch_folder_manager_project_folder_item_child_folder_loaded (ScratchFolderManagerProjectFolderItem* self,
                                                                     ScratchFolderManagerFolderItem* folder);
static void scratch_folder_manager_folder_item_on_toggled (ScratchFolderManagerFolderItem* self);
VALA_EXTERN gboolean code_widgets_source_list_expandable_item_get_expanded (CodeWidgetsSourceListExpandableItem* self);
VALA_EXTERN GType scratch_services_monitored_repository_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchServicesMonitoredRepository, g_object_unref)
VALA_EXTERN ScratchServicesMonitoredRepository* scratch_folder_manager_project_folder_item_get_monitored_repo (ScratchFolderManagerProjectFolderItem* self);
VALA_EXTERN void scratch_folder_manager_project_folder_item_update_item_status (ScratchFolderManagerProjectFolderItem* self,
                                                                    ScratchFolderManagerFolderItem* start_folder);
static GMenu* scratch_folder_manager_folder_item_real_get_context_menu (CodeWidgetsSourceListItem* base);
VALA_EXTERN GFile* scratch_folder_manager_file_get_file (ScratchFolderManagerFile* self);
VALA_EXTERN GMenu* scratch_utils_create_contract_items_for_file (GFile* file);
VALA_EXTERN gchar* scratch_folder_manager_file_get_path (ScratchFolderManagerFile* self);
VALA_EXTERN GMenuItem* scratch_folder_manager_folder_item_create_submenu_for_open_in (ScratchFolderManagerFolderItem* self,
                                                                          const gchar* file_type);
VALA_EXTERN GMenuItem* scratch_folder_manager_folder_item_create_submenu_for_new (ScratchFolderManagerFolderItem* self);
static GVariant* _variant_new17 (gchar* value);
VALA_EXTERN GMenu* scratch_utils_create_executable_app_items_for_file (GFile* file,
                                                           const gchar* file_type);
static guint scratch_folder_manager_folder_item_load_templates_from_folder (ScratchFolderManagerFolderItem* self,
                                                                     GFile* template_folder,
                                                                     GMenu* template_submenu);
static Block21Data* block21_data_ref (Block21Data* _data21_);
static void block21_data_unref (void * _userdata_);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static gint __lambda120_ (GFile* a,
                   GFile* b);
static gint ___lambda120__gcompare_func (gconstpointer a,
                                  gconstpointer b);
static gint __lambda121_ (GFile* a,
                   GFile* b);
static gint ___lambda121__gcompare_func (gconstpointer a,
                                  gconstpointer b);
static void __lambda122_ (Block21Data* _data21_,
                   GFile* template);
VALA_EXTERN gchar* scratch_folder_manager_item_get_path (ScratchFolderManagerItem* self);
static void ___lambda122__gfunc (gconstpointer data,
                          gpointer self);
VALA_EXTERN void scratch_folder_manager_folder_item_remove_all_badges (ScratchFolderManagerFolderItem* self);
VALA_EXTERN GeeCollection* code_widgets_source_list_expandable_item_get_children (CodeWidgetsSourceListExpandableItem* self);
static void scratch_folder_manager_folder_item_remove_badge (ScratchFolderManagerFolderItem* self,
                                                      CodeWidgetsSourceListItem* item);
VALA_EXTERN void code_widgets_source_list_item_set_badge (CodeWidgetsSourceListItem* self,
                                              const gchar* value);
VALA_EXTERN guint code_widgets_source_list_expandable_item_get_n_children (CodeWidgetsSourceListExpandableItem* self);
VALA_EXTERN void code_widgets_source_list_expandable_item_remove (CodeWidgetsSourceListExpandableItem* self,
                                                      CodeWidgetsSourceListItem* item);
VALA_EXTERN void code_widgets_source_list_expandable_item_add (CodeWidgetsSourceListExpandableItem* self,
                                                   CodeWidgetsSourceListItem* item);
VALA_EXTERN void scratch_folder_manager_folder_item_remove (ScratchFolderManagerFolderItem* self,
                                                CodeWidgetsSourceListItem* item);
VALA_EXTERN void scratch_folder_manager_folder_item_clear (ScratchFolderManagerFolderItem* self);
VALA_EXTERN void code_widgets_source_list_expandable_item_clear (CodeWidgetsSourceListExpandableItem* self);
static void scratch_folder_manager_folder_item_real_on_changed (ScratchFolderManagerFolderItem* self,
                                                         GFile* source,
                                                         GFile* dest,
                                                         GFileMonitorEvent event);
VALA_EXTERN void scratch_folder_manager_file_view_folder_item_update_hook (ScratchFolderManagerFileView* self,
                                                               GFile* source,
                                                               GFile* dest,
                                                               GFileMonitorEvent event);
VALA_EXTERN void scratch_folder_manager_file_invalidate_cache (ScratchFolderManagerFile* self);
static ScratchFolderManagerItem* scratch_folder_manager_folder_item_find_item_for_path (ScratchFolderManagerFolderItem* self,
                                                                                 const gchar* path);
VALA_EXTERN ScratchFolderManagerFile* scratch_folder_manager_file_new (const gchar* path);
VALA_EXTERN ScratchFolderManagerFile* scratch_folder_manager_file_construct (GType object_type,
                                                                 const gchar* path);
VALA_EXTERN void scratch_folder_manager_project_folder_item_child_folder_changed (ScratchFolderManagerProjectFolderItem* self,
                                                                      ScratchFolderManagerFolderItem* folder);
VALA_EXTERN void scratch_folder_manager_folder_item_on_add_template (ScratchFolderManagerFolderItem* self,
                                                         const gchar* template_path);
static Block22Data* block22_data_ref (Block22Data* _data22_);
static void block22_data_unref (void * _userdata_);
static Block23Data* block23_data_ref (Block23Data* _data23_);
static void block23_data_unref (void * _userdata_);
VALA_EXTERN void code_widgets_source_list_expandable_item_set_expanded (CodeWidgetsSourceListExpandableItem* self,
                                                            gboolean value);
static void ___lambda95_ (Block23Data* _data23_);
static void scratch_folder_manager_folder_item_copy_template (ScratchFolderManagerFolderItem* self,
                                                       const gchar* template_path);
static void ____lambda95__scratch_folder_manager_folder_item_children_finished_loading (ScratchFolderManagerFolderItem* _sender,
                                                                                 gpointer self);
static Block24Data* block24_data_ref (Block24Data* _data24_);
static void block24_data_unref (void * _userdata_);
VALA_EXTERN gboolean scratch_folder_manager_file_get_is_executable (ScratchFolderManagerFile* self);
VALA_EXTERN void code_widgets_source_list_item_set_name (CodeWidgetsSourceListItem* self,
                                             const gchar* value);
VALA_EXTERN const gchar* code_widgets_source_list_item_get_name (CodeWidgetsSourceListItem* self);
static void __lambda96_ (Block24Data* _data24_);
static Block25Data* block25_data_ref (Block25Data* _data25_);
static void block25_data_unref (void * _userdata_);
static gboolean __lambda97_ (Block25Data* _data25_);
VALA_EXTERN GSimpleAction* scratch_utils_action_from_group (const gchar* action_name,
                                                GSimpleActionGroup* action_group);
VALA_EXTERN GSimpleActionGroup* scratch_folder_manager_file_view_get_actions (ScratchFolderManagerFileView* self);
static GVariant* _variant_new18 (const gchar* value);
static gboolean ___lambda97__gsource_func (gpointer self);
static void ___lambda96__code_widgets_source_list_expandable_item_child_added (CodeWidgetsSourceListExpandableItem* _sender,
                                                                        CodeWidgetsSourceListItem* item,
                                                                        gpointer self);
VALA_EXTERN void scratch_folder_manager_folder_item_on_add_new (ScratchFolderManagerFolderItem* self,
                                                    gboolean is_folder);
static Block26Data* block26_data_ref (Block26Data* _data26_);
static void block26_data_unref (void * _userdata_);
static Block27Data* block27_data_ref (Block27Data* _data27_);
static void block27_data_unref (void * _userdata_);
static void ___lambda91_ (Block27Data* _data27_);
static void scratch_folder_manager_folder_item_rename_new (ScratchFolderManagerFolderItem* self,
                                                    const gchar* name,
                                                    gboolean is_folder);
static void ____lambda91__scratch_folder_manager_folder_item_children_finished_loading (ScratchFolderManagerFolderItem* _sender,
                                                                                 gpointer self);
VALA_EXTERN gboolean code_widgets_source_list_get_editing (CodeWidgetsSourceList* self);
VALA_EXTERN GType scratch_folder_manager_item_rename_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchFolderManagerItemRenameItem, g_object_unref)
static Block28Data* block28_data_ref (Block28Data* _data28_);
static void block28_data_unref (void * _userdata_);
VALA_EXTERN ScratchFolderManagerItemRenameItem* scratch_folder_manager_item_rename_item_new (const gchar* name,
                                                                                 gboolean is_folder);
VALA_EXTERN ScratchFolderManagerItemRenameItem* scratch_folder_manager_item_rename_item_construct (GType object_type,
                                                                                       const gchar* name,
                                                                                       gboolean is_folder);
static gboolean __lambda92_ (Block28Data* _data28_);
VALA_EXTERN gboolean code_widgets_source_list_start_editing_item (CodeWidgetsSourceList* self,
                                                      CodeWidgetsSourceListItem* item);
static Block29Data* block29_data_ref (Block29Data* _data29_);
static void block29_data_unref (void * _userdata_);
static void ___lambda93_ (Block29Data* _data29_);
VALA_EXTERN gboolean scratch_folder_manager_item_rename_item_get_is_folder (ScratchFolderManagerItemRenameItem* self);
static void ____lambda93__code_widgets_source_list_item_edited (CodeWidgetsSourceListItem* _sender,
                                                         const gchar* new_name,
                                                         gpointer self);
static gboolean ___lambda94_ (Block29Data* _data29_);
static gboolean ____lambda94__gsource_func (gpointer self);
static gboolean ___lambda92__gsource_func (gpointer self);
static GObject * scratch_folder_manager_folder_item_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties);
VALA_EXTERN void code_widgets_source_list_item_set_selectable (CodeWidgetsSourceListItem* self,
                                                   gboolean value);
VALA_EXTERN CodeWidgetsSourceListItem* code_widgets_source_list_item_new (const gchar* name);
VALA_EXTERN CodeWidgetsSourceListItem* code_widgets_source_list_item_construct (GType object_type,
                                                                    const gchar* name);
static void _scratch_folder_manager_folder_item_on_toggled_code_widgets_source_list_expandable_item_toggled (CodeWidgetsSourceListExpandableItem* _sender,
                                                                                                      gpointer self);
static void _scratch_folder_manager_folder_item_on_changed_g_file_monitor_changed (GFileMonitor* _sender,
                                                                            GFile* file,
                                                                            GFile* other_file,
                                                                            GFileMonitorEvent event_type,
                                                                            gpointer self);
static void scratch_folder_manager_folder_item_finalize (GObject * obj);
static GType scratch_folder_manager_folder_item_get_type_once (void);
static void _vala_scratch_folder_manager_folder_item_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);

static inline gpointer
scratch_folder_manager_folder_item_get_instance_private (ScratchFolderManagerFolderItem* self)
{
	return G_STRUCT_MEMBER_P (self, ScratchFolderManagerFolderItem_private_offset);
}

ScratchFolderManagerFolderItem*
scratch_folder_manager_folder_item_construct (GType object_type,
                                              ScratchFolderManagerFile* file,
                                              ScratchFolderManagerFileView* view)
{
	ScratchFolderManagerFolderItem * self = NULL;
	g_return_val_if_fail (file != NULL, NULL);
	g_return_val_if_fail (view != NULL, NULL);
	self = (ScratchFolderManagerFolderItem*) g_object_new (object_type, "file", file, "view", view, NULL);
	return self;
}

ScratchFolderManagerFolderItem*
scratch_folder_manager_folder_item_new (ScratchFolderManagerFile* file,
                                        ScratchFolderManagerFileView* view)
{
	return scratch_folder_manager_folder_item_construct (SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, file, view);
}

void
scratch_folder_manager_folder_item_load_children (ScratchFolderManagerFolderItem* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = scratch_folder_manager_folder_item_get_loading_required (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		{
			GeeIterator* _child_it = NULL;
			ScratchFolderManagerFile* _tmp2_;
			ScratchFolderManagerFile* _tmp3_;
			GeeCollection* _tmp4_;
			GeeCollection* _tmp5_;
			GeeCollection* _tmp6_;
			GeeIterator* _tmp7_;
			GeeIterator* _tmp8_;
			_tmp2_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
			_tmp3_ = _tmp2_;
			_tmp4_ = scratch_folder_manager_file_get_children (_tmp3_);
			_tmp5_ = _tmp4_;
			_tmp6_ = _tmp5_;
			_tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
			_tmp8_ = _tmp7_;
			_g_object_unref0 (_tmp6_);
			_child_it = _tmp8_;
			while (TRUE) {
				GeeIterator* _tmp9_;
				ScratchFolderManagerFile* child = NULL;
				GeeIterator* _tmp10_;
				gpointer _tmp11_;
				ScratchFolderManagerFile* _tmp12_;
				_tmp9_ = _child_it;
				if (!gee_iterator_next (_tmp9_)) {
					break;
				}
				_tmp10_ = _child_it;
				_tmp11_ = gee_iterator_get (_tmp10_);
				child = (ScratchFolderManagerFile*) _tmp11_;
				_tmp12_ = child;
				scratch_folder_manager_folder_item_add_child (self, _tmp12_);
				_g_object_unref0 (child);
			}
			_g_object_unref0 (_child_it);
		}
		scratch_folder_manager_folder_item_after_children_loaded (self);
	}
}

static void
scratch_folder_manager_folder_item_load_children_async_data_free (gpointer _data)
{
	ScratchFolderManagerFolderItemLoadChildrenAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ScratchFolderManagerFolderItemLoadChildrenAsyncData, _data_);
}

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

static void
scratch_folder_manager_folder_item_load_children_async (ScratchFolderManagerFolderItem* self,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	ScratchFolderManagerFolderItemLoadChildrenAsyncData* _data_;
	ScratchFolderManagerFolderItem* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ScratchFolderManagerFolderItemLoadChildrenAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, scratch_folder_manager_folder_item_load_children_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	scratch_folder_manager_folder_item_load_children_async_co (_data_);
}

static void
scratch_folder_manager_folder_item_load_children_finish (ScratchFolderManagerFolderItem* self,
                                                         GAsyncResult* _res_)
{
	ScratchFolderManagerFolderItemLoadChildrenAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block19Data*
block19_data_ref (Block19Data* _data19_)
{
	g_atomic_int_inc (&_data19_->_ref_count_);
	return _data19_;
}

static void
block19_data_unref (void * _userdata_)
{
	Block19Data* _data19_;
	_data19_ = (Block19Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data19_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data19_->self;
		_g_object_unref0 (self);
		g_slice_free (Block19Data, _data19_);
	}
}

static Block20Data*
block20_data_ref (Block20Data* _data20_)
{
	g_atomic_int_inc (&_data20_->_ref_count_);
	return _data20_;
}

static void
block20_data_unref (void * _userdata_)
{
	Block20Data* _data20_;
	_data20_ = (Block20Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data20_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data20_->_data19_->self;
		_g_object_unref0 (_data20_->child);
		block19_data_unref (_data20_->_data19_);
		_data20_->_data19_ = NULL;
		g_slice_free (Block20Data, _data20_);
	}
}

static gboolean
_____lambda119_ (Block20Data* _data20_)
{
	Block19Data* _data19_;
	ScratchFolderManagerFolderItem* self;
	ScratchFolderManagerFile* _tmp0_;
	gboolean result;
	_data19_ = _data20_->_data19_;
	self = _data19_->self;
	_tmp0_ = _data20_->child;
	scratch_folder_manager_folder_item_add_child (self, _tmp0_);
	scratch_folder_manager_folder_item_load_children_async_co (_data19_->_async_data_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
______lambda119__gsource_func (gpointer self)
{
	gboolean result;
	result = _____lambda119_ (self);
	return result;
}

static gboolean
scratch_folder_manager_folder_item_load_children_async_co (ScratchFolderManagerFolderItemLoadChildrenAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data19_ = g_slice_new0 (Block19Data);
	_data_->_data19_->_ref_count_ = 1;
	_data_->_data19_->self = g_object_ref (_data_->self);
	_data_->_data19_->_async_data_ = _data_;
	_data_->_tmp0_ = scratch_folder_manager_folder_item_get_loading_required (_data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_) {
		{
			_data_->_tmp2_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) _data_->self);
			_data_->_tmp3_ = _data_->_tmp2_;
			_data_->_tmp4_ = scratch_folder_manager_file_get_children (_data_->_tmp3_);
			_data_->_tmp5_ = _data_->_tmp4_;
			_data_->_tmp6_ = _data_->_tmp5_;
			_data_->_tmp7_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp6_);
			_data_->_tmp8_ = _data_->_tmp7_;
			_g_object_unref0 (_data_->_tmp6_);
			_data_->_child_it = _data_->_tmp8_;
			while (TRUE) {
				_data_->_data20_ = g_slice_new0 (Block20Data);
				_data_->_data20_->_ref_count_ = 1;
				_data_->_data20_->_data19_ = block19_data_ref (_data_->_data19_);
				_data_->_tmp9_ = _data_->_child_it;
				if (!gee_iterator_next (_data_->_tmp9_)) {
					block20_data_unref (_data_->_data20_);
					_data_->_data20_ = NULL;
					break;
				}
				_data_->_tmp10_ = _data_->_child_it;
				_data_->_tmp11_ = gee_iterator_get (_data_->_tmp10_);
				_data_->_data20_->child = (ScratchFolderManagerFile*) _data_->_tmp11_;
				g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ______lambda119__gsource_func, block20_data_ref (_data_->_data20_), block20_data_unref);
				_data_->_state_ = 1;
				return FALSE;
				_state_1:
				;
				block20_data_unref (_data_->_data20_);
				_data_->_data20_ = NULL;
			}
			_g_object_unref0 (_data_->_child_it);
		}
	}
	scratch_folder_manager_folder_item_after_children_loaded (_data_->self);
	block19_data_unref (_data_->_data19_);
	_data_->_data19_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
scratch_folder_manager_folder_item_add_child (ScratchFolderManagerFolderItem* self,
                                              ScratchFolderManagerFile* child)
{
	CodeWidgetsSourceListItem* item = NULL;
	gboolean _tmp0_;
	gboolean _tmp1_;
	CodeWidgetsSourceListItem* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	item = NULL;
	_tmp0_ = scratch_folder_manager_file_get_is_valid_directory (child);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		ScratchFolderManagerFileView* _tmp2_;
		ScratchFolderManagerFileView* _tmp3_;
		ScratchFolderManagerFolderItem* _tmp4_;
		_tmp2_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
		_tmp3_ = _tmp2_;
		_tmp4_ = scratch_folder_manager_folder_item_new (child, _tmp3_);
		_g_object_unref0 (item);
		item = (CodeWidgetsSourceListItem*) _tmp4_;
	} else {
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp5_ = scratch_folder_manager_file_get_is_valid_textfile (child);
		_tmp6_ = _tmp5_;
		if (_tmp6_) {
			ScratchFolderManagerFileView* _tmp7_;
			ScratchFolderManagerFileView* _tmp8_;
			ScratchFolderManagerFileItem* _tmp9_;
			_tmp7_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
			_tmp8_ = _tmp7_;
			_tmp9_ = scratch_folder_manager_file_item_new (child, _tmp8_);
			_g_object_unref0 (item);
			item = (CodeWidgetsSourceListItem*) _tmp9_;
		}
	}
	_tmp10_ = item;
	if (_tmp10_ != NULL) {
		CodeWidgetsSourceListItem* _tmp11_;
		_tmp11_ = item;
		scratch_folder_manager_folder_item_add (self, _tmp11_);
	}
	_g_object_unref0 (item);
}

static void
scratch_folder_manager_folder_item_after_children_loaded (ScratchFolderManagerFolderItem* self)
{
	ScratchFolderManagerProjectFolderItem* root = NULL;
	ScratchFolderManagerProjectFolderItem* _tmp0_;
	ScratchFolderManagerProjectFolderItem* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->children_loaded = TRUE;
	_tmp0_ = scratch_folder_manager_item_get_root_folder ((ScratchFolderManagerItem*) self, NULL);
	root = _tmp0_;
	_tmp1_ = root;
	if (_tmp1_ != NULL) {
		ScratchFolderManagerProjectFolderItem* _tmp2_;
		_tmp2_ = root;
		scratch_folder_manager_project_folder_item_child_folder_loaded (_tmp2_, self);
	}
	g_signal_emit (self, scratch_folder_manager_folder_item_signals[SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_CHILDREN_FINISHED_LOADING_SIGNAL], 0);
	_g_object_unref0 (root);
}

static void
scratch_folder_manager_folder_item_on_toggled (ScratchFolderManagerFolderItem* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = code_widgets_source_list_expandable_item_get_expanded ((CodeWidgetsSourceListExpandableItem*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		scratch_folder_manager_folder_item_load_children_async (self, NULL, NULL);
		return;
	} else {
		ScratchFolderManagerProjectFolderItem* root = NULL;
		ScratchFolderManagerProjectFolderItem* _tmp2_;
		gboolean _tmp3_ = FALSE;
		ScratchFolderManagerProjectFolderItem* _tmp4_;
		_tmp2_ = scratch_folder_manager_item_get_root_folder ((ScratchFolderManagerItem*) self, NULL);
		root = _tmp2_;
		_tmp4_ = root;
		if (_tmp4_ != NULL) {
			ScratchFolderManagerProjectFolderItem* _tmp5_;
			ScratchServicesMonitoredRepository* _tmp6_;
			ScratchServicesMonitoredRepository* _tmp7_;
			_tmp5_ = root;
			_tmp6_ = scratch_folder_manager_project_folder_item_get_monitored_repo (_tmp5_);
			_tmp7_ = _tmp6_;
			_tmp3_ = _tmp7_ != NULL;
		} else {
			_tmp3_ = FALSE;
		}
		if (_tmp3_) {
			ScratchFolderManagerProjectFolderItem* _tmp8_;
			_tmp8_ = root;
			scratch_folder_manager_project_folder_item_update_item_status (_tmp8_, self);
		}
		_g_object_unref0 (root);
	}
}

static GMenu*
scratch_folder_manager_folder_item_real_get_context_menu (CodeWidgetsSourceListItem* base)
{
	ScratchFolderManagerFolderItem * self;
	GFileInfo* info = NULL;
	gchar* file_type = NULL;
	GFileInfo* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	GMenu* contractor_items = NULL;
	ScratchFolderManagerFile* _tmp12_;
	ScratchFolderManagerFile* _tmp13_;
	GFile* _tmp14_;
	GFile* _tmp15_;
	GMenu* _tmp16_;
	GMenuItem* rename_menu_item = NULL;
	ScratchFolderManagerFile* _tmp17_;
	ScratchFolderManagerFile* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GVariant* _tmp22_;
	GVariant* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	GMenuItem* _tmp26_;
	GMenuItem* _tmp27_;
	GMenuItem* delete_item = NULL;
	ScratchFolderManagerFile* _tmp28_;
	ScratchFolderManagerFile* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	GVariant* _tmp33_;
	GVariant* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	GMenuItem* _tmp37_;
	GMenuItem* _tmp38_;
	GMenuItem* search_item = NULL;
	ScratchFolderManagerFile* _tmp39_;
	ScratchFolderManagerFile* _tmp40_;
	GFile* _tmp41_;
	GFile* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	GVariant* _tmp45_;
	GVariant* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	GMenuItem* _tmp49_;
	GMenuItem* _tmp50_;
	GMenu* external_actions_section = NULL;
	GMenu* _tmp51_;
	GMenu* _tmp52_;
	const gchar* _tmp53_;
	GMenuItem* _tmp54_;
	GMenuItem* _tmp55_;
	GMenu* _tmp56_;
	GMenu* direct_actions_section = NULL;
	GMenu* _tmp59_;
	GMenuItem* _tmp60_;
	GMenuItem* _tmp61_;
	GMenuItem* _tmp62_;
	GMenuItem* _tmp63_;
	GMenu* search_section = NULL;
	GMenu* _tmp64_;
	GMenuItem* _tmp65_;
	GMenu* menu_model = NULL;
	GMenu* _tmp66_;
	GMenu* _tmp67_;
	GError* _inner_error0_ = NULL;
	GMenu* result;
	self = (ScratchFolderManagerFolderItem*) base;
	info = NULL;
	{
		GFileInfo* _tmp0_ = NULL;
		ScratchFolderManagerFile* _tmp1_;
		ScratchFolderManagerFile* _tmp2_;
		GFile* _tmp3_;
		GFile* _tmp4_;
		GFileInfo* _tmp5_;
		GFileInfo* _tmp6_;
		_tmp1_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
		_tmp2_ = _tmp1_;
		_tmp3_ = scratch_folder_manager_file_get_file (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_file_query_info (_tmp4_, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, &_inner_error0_);
		_tmp0_ = _tmp5_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp6_ = _tmp0_;
		_tmp0_ = NULL;
		_g_object_unref0 (info);
		info = _tmp6_;
		_g_object_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp7_;
		const gchar* _tmp8_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		g_warning ("FolderItem.vala:136: %s", _tmp8_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (info);
		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 NULL;
	}
	_tmp9_ = info;
	_tmp10_ = g_file_info_get_content_type (_tmp9_);
	_tmp11_ = g_strdup (_tmp10_);
	file_type = _tmp11_;
	_tmp12_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp13_ = _tmp12_;
	_tmp14_ = scratch_folder_manager_file_get_file (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = scratch_utils_create_contract_items_for_file (_tmp15_);
	contractor_items = _tmp16_;
	_tmp17_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp18_ = _tmp17_;
	_tmp19_ = scratch_folder_manager_file_get_path (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = _tmp20_;
	_tmp22_ = g_variant_new_string (_tmp21_);
	g_variant_ref_sink (_tmp22_);
	_tmp23_ = _tmp22_;
	_tmp24_ = g_action_print_detailed_name (SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_PREFIX SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_RENAME_FOLDER, _tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_menu_item_new (_ ("Rename"), _tmp25_);
	_tmp27_ = _tmp26_;
	_g_free0 (_tmp25_);
	_g_variant_unref0 (_tmp23_);
	_g_free0 (_tmp21_);
	rename_menu_item = _tmp27_;
	_tmp28_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp29_ = _tmp28_;
	_tmp30_ = scratch_folder_manager_file_get_path (_tmp29_);
	_tmp31_ = _tmp30_;
	_tmp32_ = _tmp31_;
	_tmp33_ = g_variant_new_string (_tmp32_);
	g_variant_ref_sink (_tmp33_);
	_tmp34_ = _tmp33_;
	_tmp35_ = g_action_print_detailed_name (SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_PREFIX SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_DELETE, _tmp34_);
	_tmp36_ = _tmp35_;
	_tmp37_ = g_menu_item_new (_ ("Move to Trash"), _tmp36_);
	_tmp38_ = _tmp37_;
	_g_free0 (_tmp36_);
	_g_variant_unref0 (_tmp34_);
	_g_free0 (_tmp32_);
	delete_item = _tmp38_;
	_tmp39_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp40_ = _tmp39_;
	_tmp41_ = scratch_folder_manager_file_get_file (_tmp40_);
	_tmp42_ = _tmp41_;
	_tmp43_ = g_file_get_path (_tmp42_);
	_tmp44_ = _tmp43_;
	_tmp45_ = g_variant_new_string (_tmp44_);
	g_variant_ref_sink (_tmp45_);
	_tmp46_ = _tmp45_;
	_tmp47_ = g_action_print_detailed_name (SCRATCH_MAIN_WINDOW_ACTION_PREFIX SCRATCH_MAIN_WINDOW_ACTION_FIND_GLOBAL, _tmp46_);
	_tmp48_ = _tmp47_;
	_tmp49_ = g_menu_item_new (_ ("Find in Folder…"), _tmp48_);
	_tmp50_ = _tmp49_;
	_g_free0 (_tmp48_);
	_g_variant_unref0 (_tmp46_);
	_g_free0 (_tmp44_);
	search_item = _tmp50_;
	_tmp51_ = g_menu_new ();
	external_actions_section = _tmp51_;
	_tmp52_ = external_actions_section;
	_tmp53_ = file_type;
	_tmp54_ = scratch_folder_manager_folder_item_create_submenu_for_open_in (self, _tmp53_);
	_tmp55_ = _tmp54_;
	g_menu_append_item (_tmp52_, _tmp55_);
	_g_object_unref0 (_tmp55_);
	_tmp56_ = contractor_items;
	if (g_menu_model_get_n_items ((GMenuModel*) _tmp56_) > 0) {
		GMenu* _tmp57_;
		GMenu* _tmp58_;
		_tmp57_ = external_actions_section;
		_tmp58_ = contractor_items;
		g_menu_append_submenu (_tmp57_, _ ("Other Actions"), (GMenuModel*) _tmp58_);
	}
	_tmp59_ = g_menu_new ();
	direct_actions_section = _tmp59_;
	_tmp60_ = scratch_folder_manager_folder_item_create_submenu_for_new (self);
	_tmp61_ = _tmp60_;
	g_menu_append_item (direct_actions_section, _tmp61_);
	_g_object_unref0 (_tmp61_);
	_tmp62_ = rename_menu_item;
	g_menu_append_item (direct_actions_section, _tmp62_);
	_tmp63_ = delete_item;
	g_menu_append_item (direct_actions_section, _tmp63_);
	_tmp64_ = g_menu_new ();
	search_section = _tmp64_;
	_tmp65_ = search_item;
	g_menu_append_item (search_section, _tmp65_);
	_tmp66_ = g_menu_new ();
	menu_model = _tmp66_;
	_tmp67_ = external_actions_section;
	g_menu_append_section (menu_model, NULL, (GMenuModel*) _tmp67_);
	g_menu_append_section (menu_model, NULL, (GMenuModel*) direct_actions_section);
	g_menu_append_section (menu_model, NULL, (GMenuModel*) search_section);
	result = menu_model;
	_g_object_unref0 (search_section);
	_g_object_unref0 (direct_actions_section);
	_g_object_unref0 (external_actions_section);
	_g_object_unref0 (search_item);
	_g_object_unref0 (delete_item);
	_g_object_unref0 (rename_menu_item);
	_g_object_unref0 (contractor_items);
	_g_free0 (file_type);
	_g_object_unref0 (info);
	return result;
}

static GVariant*
_variant_new17 (gchar* value)
{
	return g_variant_ref_sink (g_variant_new_string (value));
}

GMenuItem*
scratch_folder_manager_folder_item_create_submenu_for_open_in (ScratchFolderManagerFolderItem* self,
                                                               const gchar* file_type)
{
	GMenuItem* open_in_terminal_pane_item = NULL;
	ScratchFolderManagerFile* _tmp0_;
	ScratchFolderManagerFile* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GVariant* _tmp5_;
	GVariant* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GMenuItem* _tmp9_;
	GMenuItem* _tmp10_;
	GMenuItem* _tmp11_;
	GThemedIcon* _tmp12_;
	GThemedIcon* _tmp13_;
	GMenuItem* other_menu_item = NULL;
	ScratchFolderManagerFile* _tmp14_;
	ScratchFolderManagerFile* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	GVariant* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GMenuItem* _tmp22_;
	GMenuItem* _tmp23_;
	GMenu* extra_section = NULL;
	GMenu* _tmp24_;
	GMenu* _tmp25_;
	GMenuItem* _tmp26_;
	GMenu* terminal_pane_section = NULL;
	GMenu* _tmp27_;
	GMenu* _tmp28_;
	GMenuItem* _tmp29_;
	const gchar* _tmp30_ = NULL;
	GMenu* open_in_menu = NULL;
	GMenu* _tmp31_;
	GMenu* _tmp32_;
	ScratchFolderManagerFile* _tmp33_;
	ScratchFolderManagerFile* _tmp34_;
	GFile* _tmp35_;
	GFile* _tmp36_;
	GMenu* _tmp37_;
	GMenu* _tmp38_;
	GMenu* _tmp39_;
	GMenuItem* open_in_menu_item = NULL;
	GMenuItem* _tmp40_;
	GMenuItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = scratch_folder_manager_file_get_path (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp5_ = g_variant_new_string (_tmp4_);
	g_variant_ref_sink (_tmp5_);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_action_print_detailed_name (SCRATCH_MAIN_WINDOW_ACTION_PREFIX SCRATCH_MAIN_WINDOW_ACTION_OPEN_IN_TERMINAL, _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_menu_item_new (_ ("Terminal Pane"), _tmp8_);
	_tmp10_ = _tmp9_;
	_g_free0 (_tmp8_);
	_g_variant_unref0 (_tmp6_);
	_g_free0 (_tmp4_);
	open_in_terminal_pane_item = _tmp10_;
	_tmp11_ = open_in_terminal_pane_item;
	_tmp12_ = (GThemedIcon*) g_themed_icon_new ("panel-bottom-symbolic");
	_tmp13_ = _tmp12_;
	g_menu_item_set_icon (_tmp11_, (GIcon*) _tmp13_);
	_g_object_unref0 (_tmp13_);
	_tmp14_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp15_ = _tmp14_;
	_tmp16_ = scratch_folder_manager_file_get_path (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = _tmp17_;
	_tmp19_ = _variant_new17 (_tmp18_);
	_tmp20_ = g_action_print_detailed_name (SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_PREFIX SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_SHOW_APP_CHOOSER, _tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = g_menu_item_new (_ ("Other Application…"), _tmp21_);
	_tmp23_ = _tmp22_;
	_g_free0 (_tmp21_);
	_g_variant_unref0 (_tmp19_);
	_g_free0 (_tmp18_);
	other_menu_item = _tmp23_;
	_tmp24_ = g_menu_new ();
	extra_section = _tmp24_;
	_tmp25_ = extra_section;
	_tmp26_ = other_menu_item;
	g_menu_append_item (_tmp25_, _tmp26_);
	_tmp27_ = g_menu_new ();
	terminal_pane_section = _tmp27_;
	_tmp28_ = terminal_pane_section;
	_tmp29_ = open_in_terminal_pane_item;
	g_menu_append_item (_tmp28_, _tmp29_);
	_tmp30_ = file_type;
	if (_tmp30_ == NULL) {
		_tmp30_ = "inode/directory";
	}
	file_type = _tmp30_;
	_tmp31_ = g_menu_new ();
	open_in_menu = _tmp31_;
	_tmp32_ = terminal_pane_section;
	g_menu_append_section (open_in_menu, NULL, (GMenuModel*) _tmp32_);
	_tmp33_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp34_ = _tmp33_;
	_tmp35_ = scratch_folder_manager_file_get_file (_tmp34_);
	_tmp36_ = _tmp35_;
	_tmp37_ = scratch_utils_create_executable_app_items_for_file (_tmp36_, file_type);
	_tmp38_ = _tmp37_;
	g_menu_append_section (open_in_menu, NULL, (GMenuModel*) _tmp38_);
	_g_object_unref0 (_tmp38_);
	_tmp39_ = extra_section;
	g_menu_append_section (open_in_menu, NULL, (GMenuModel*) _tmp39_);
	_tmp40_ = g_menu_item_new_submenu (_ ("Open In"), (GMenuModel*) open_in_menu);
	open_in_menu_item = _tmp40_;
	result = open_in_menu_item;
	_g_object_unref0 (open_in_menu);
	_g_object_unref0 (terminal_pane_section);
	_g_object_unref0 (extra_section);
	_g_object_unref0 (other_menu_item);
	_g_object_unref0 (open_in_terminal_pane_item);
	return result;
}

GMenuItem*
scratch_folder_manager_folder_item_create_submenu_for_new (ScratchFolderManagerFolderItem* self)
{
	GMenuItem* new_folder_item = NULL;
	ScratchFolderManagerFile* _tmp0_;
	ScratchFolderManagerFile* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GVariant* _tmp5_;
	GVariant* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GMenuItem* _tmp9_;
	GMenuItem* _tmp10_;
	GMenuItem* new_file_item = NULL;
	ScratchFolderManagerFile* _tmp11_;
	ScratchFolderManagerFile* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	GVariant* _tmp16_;
	GVariant* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	GMenuItem* _tmp20_;
	GMenuItem* _tmp21_;
	GMenu* new_menu = NULL;
	GMenu* _tmp22_;
	GMenu* _tmp23_;
	GMenuItem* _tmp24_;
	GMenu* _tmp25_;
	GMenuItem* _tmp26_;
	const gchar* template_path = NULL;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	GMenuItem* new_item = NULL;
	GMenu* _tmp40_;
	GMenuItem* _tmp41_;
	GMenu* _tmp42_;
	GMenuItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = scratch_folder_manager_file_get_path (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp5_ = g_variant_new_string (_tmp4_);
	g_variant_ref_sink (_tmp5_);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_action_print_detailed_name (SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_PREFIX SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_NEW_FOLDER, _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_menu_item_new (_ ("Folder"), _tmp8_);
	_tmp10_ = _tmp9_;
	_g_free0 (_tmp8_);
	_g_variant_unref0 (_tmp6_);
	_g_free0 (_tmp4_);
	new_folder_item = _tmp10_;
	_tmp11_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp12_ = _tmp11_;
	_tmp13_ = scratch_folder_manager_file_get_path (_tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = _tmp14_;
	_tmp16_ = g_variant_new_string (_tmp15_);
	g_variant_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_action_print_detailed_name (SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_PREFIX SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_NEW_FILE, _tmp17_);
	_tmp19_ = _tmp18_;
	_tmp20_ = g_menu_item_new (_ ("Empty File"), _tmp19_);
	_tmp21_ = _tmp20_;
	_g_free0 (_tmp19_);
	_g_variant_unref0 (_tmp17_);
	_g_free0 (_tmp15_);
	new_file_item = _tmp21_;
	_tmp22_ = g_menu_new ();
	new_menu = _tmp22_;
	_tmp23_ = new_menu;
	_tmp24_ = new_folder_item;
	g_menu_append_item (_tmp23_, _tmp24_);
	_tmp25_ = new_menu;
	_tmp26_ = new_file_item;
	g_menu_append_item (_tmp25_, _tmp26_);
	_tmp27_ = g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES);
	template_path = _tmp27_;
	_tmp28_ = template_path;
	if (_tmp28_ != NULL) {
		GMenu* template_submenu = NULL;
		GMenu* _tmp29_;
		guint template_count = 0U;
		const gchar* _tmp30_;
		GFile* _tmp31_;
		GFile* _tmp32_;
		GMenu* _tmp33_;
		guint _tmp34_;
		_tmp29_ = g_menu_new ();
		template_submenu = _tmp29_;
		_tmp30_ = template_path;
		_tmp31_ = g_file_new_for_path (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = template_submenu;
		_tmp34_ = scratch_folder_manager_folder_item_load_templates_from_folder (self, _tmp32_, _tmp33_);
		_g_object_unref0 (_tmp32_);
		template_count = _tmp34_;
		if (template_count > ((guint) 0)) {
			GMenu* _tmp38_;
			GMenu* _tmp39_;
			if (template_count > ((guint) SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_MAX_TEMPLATES)) {
				GMenu* _tmp35_;
				GMenuItem* _tmp36_;
				GMenuItem* _tmp37_;
				_tmp35_ = template_submenu;
				_tmp36_ = g_menu_item_new (_ ("…too many templates"), NULL);
				_tmp37_ = _tmp36_;
				g_menu_append_item (_tmp35_, _tmp37_);
				_g_object_unref0 (_tmp37_);
			}
			_tmp38_ = new_menu;
			_tmp39_ = template_submenu;
			g_menu_append_submenu (_tmp38_, _ ("Templates"), (GMenuModel*) _tmp39_);
		}
		_g_object_unref0 (template_submenu);
	}
	_tmp40_ = new_menu;
	_tmp41_ = g_menu_item_new_submenu (_ ("New"), (GMenuModel*) _tmp40_);
	new_item = _tmp41_;
	_tmp42_ = new_menu;
	g_menu_item_set_submenu (new_item, (GMenuModel*) _tmp42_);
	result = new_item;
	_g_object_unref0 (new_menu);
	_g_object_unref0 (new_file_item);
	_g_object_unref0 (new_folder_item);
	return result;
}

static Block21Data*
block21_data_ref (Block21Data* _data21_)
{
	g_atomic_int_inc (&_data21_->_ref_count_);
	return _data21_;
}

static void
block21_data_unref (void * _userdata_)
{
	Block21Data* _data21_;
	_data21_ = (Block21Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data21_->self;
		_g_object_unref0 (_data21_->template_submenu);
		_g_object_unref0 (self);
		g_slice_free (Block21Data, _data21_);
	}
}

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

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static gint
__lambda120_ (GFile* a,
              GFile* b)
{
	GCompareFunc _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gint _tmp9_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = ((GCompareFunc) g_strcmp0);
	_tmp1_ = g_file_get_basename (a);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_utf8_strdown (_tmp2_, (gssize) -1);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_file_get_basename (b);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_utf8_strdown (_tmp6_, (gssize) -1);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp0_ (_tmp4_, _tmp8_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
	result = _tmp9_;
	return result;
}

static gint
___lambda120__gcompare_func (gconstpointer a,
                             gconstpointer b)
{
	gint result;
	result = __lambda120_ ((GFile*) a, (GFile*) b);
	return result;
}

static gint
__lambda121_ (GFile* a,
              GFile* b)
{
	GCompareFunc _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gint _tmp9_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = ((GCompareFunc) g_strcmp0);
	_tmp1_ = g_file_get_basename (a);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_utf8_strdown (_tmp2_, (gssize) -1);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_file_get_basename (b);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_utf8_strdown (_tmp6_, (gssize) -1);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp0_ (_tmp4_, _tmp8_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
	result = _tmp9_;
	return result;
}

static gint
___lambda121__gcompare_func (gconstpointer a,
                             gconstpointer b)
{
	gint result;
	result = __lambda121_ ((GFile*) a, (GFile*) b);
	return result;
}

static void
__lambda122_ (Block21Data* _data21_,
              GFile* template)
{
	ScratchFolderManagerFolderItem* self;
	GMenuItem* template_menuitem = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GVariant* _tmp7_;
	GVariant* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GMenuItem* _tmp11_;
	GMenuItem* _tmp12_;
	self = _data21_->self;
	g_return_if_fail (template != NULL);
	_tmp0_ = g_file_get_basename (template);
	_tmp1_ = _tmp0_;
	_tmp2_ = scratch_folder_manager_item_get_path ((ScratchFolderManagerItem*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp5_ = g_file_get_path (template);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_variant_new ("(ss)", _tmp4_, _tmp6_, NULL);
	g_variant_ref_sink (_tmp7_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_action_print_detailed_name (SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_PREFIX SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_NEW_FROM_TEMPLATE, _tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_menu_item_new (_tmp1_, _tmp10_);
	_tmp12_ = _tmp11_;
	_g_free0 (_tmp10_);
	_g_variant_unref0 (_tmp8_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp1_);
	template_menuitem = _tmp12_;
	g_menu_append_item (_data21_->template_submenu, template_menuitem);
	_g_object_unref0 (template_menuitem);
}

static void
___lambda122__gfunc (gconstpointer data,
                     gpointer self)
{
	__lambda122_ (self, (GFile*) data);
}

static guint
scratch_folder_manager_folder_item_load_templates_from_folder (ScratchFolderManagerFolderItem* self,
                                                               GFile* template_folder,
                                                               GMenu* template_submenu)
{
	Block21Data* _data21_;
	GMenu* _tmp0_;
	GList* template_list = NULL;
	GList* folder_list = NULL;
	GFileEnumerator* enumerator = NULL;
	GFileQueryInfoFlags flags = 0U;
	guint count = 0U;
	GList* fl = NULL;
	GList* _tmp23_;
	GList* _tmp41_;
	GError* _inner_error0_ = NULL;
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	g_return_val_if_fail (template_folder != NULL, 0U);
	g_return_val_if_fail (template_submenu != NULL, 0U);
	_data21_ = g_slice_new0 (Block21Data);
	_data21_->_ref_count_ = 1;
	_data21_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (template_submenu);
	_g_object_unref0 (_data21_->template_submenu);
	_data21_->template_submenu = _tmp0_;
	template_list = NULL;
	folder_list = NULL;
	flags = G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
	count = (guint) 0;
	{
		GFileEnumerator* _tmp1_ = NULL;
		GFileEnumerator* _tmp2_;
		GFileEnumerator* _tmp3_;
		GFile* location = NULL;
		GFileInfo* info = NULL;
		GFileEnumerator* _tmp4_;
		GFileInfo* _tmp5_;
		_tmp2_ = g_file_enumerate_children (template_folder, "standard::*", flags, NULL, &_inner_error0_);
		_tmp1_ = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = _tmp1_;
		_tmp1_ = NULL;
		_g_object_unref0 (enumerator);
		enumerator = _tmp3_;
		_tmp4_ = enumerator;
		_tmp5_ = g_file_enumerator_next_file (_tmp4_, NULL, &_inner_error0_);
		info = _tmp5_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (location);
			_g_object_unref0 (_tmp1_);
			goto __catch0_g_error;
		}
		while (TRUE) {
			gboolean _tmp6_ = FALSE;
			GFileInfo* _tmp8_;
			GFileInfo* _tmp18_ = NULL;
			GFileEnumerator* _tmp19_;
			GFileInfo* _tmp20_;
			GFileInfo* _tmp21_;
			if (count < ((guint) SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_MAX_TEMPLATES)) {
				GFileInfo* _tmp7_;
				_tmp7_ = info;
				_tmp6_ = _tmp7_ != NULL;
			} else {
				_tmp6_ = FALSE;
			}
			if (!_tmp6_) {
				break;
			}
			_tmp8_ = info;
			if (!g_file_info_get_attribute_boolean (_tmp8_, G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP)) {
				GFileInfo* _tmp9_;
				const gchar* _tmp10_;
				GFile* _tmp11_;
				GFileInfo* _tmp12_;
				guint _tmp17_;
				_tmp9_ = info;
				_tmp10_ = g_file_info_get_name (_tmp9_);
				_tmp11_ = g_file_get_child (template_folder, _tmp10_);
				_g_object_unref0 (location);
				location = _tmp11_;
				_tmp12_ = info;
				if (g_file_info_get_file_type (_tmp12_) == G_FILE_TYPE_DIRECTORY) {
					GFile* _tmp13_;
					GFile* _tmp14_;
					_tmp13_ = location;
					_tmp14_ = _g_object_ref0 (_tmp13_);
					folder_list = g_list_prepend (folder_list, _tmp14_);
				} else {
					GFile* _tmp15_;
					GFile* _tmp16_;
					_tmp15_ = location;
					_tmp16_ = _g_object_ref0 (_tmp15_);
					template_list = g_list_prepend (template_list, _tmp16_);
				}
				_tmp17_ = count;
				count = _tmp17_ + 1;
			}
			_tmp19_ = enumerator;
			_tmp20_ = g_file_enumerator_next_file (_tmp19_, NULL, &_inner_error0_);
			_tmp18_ = _tmp20_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (info);
				_g_object_unref0 (location);
				_g_object_unref0 (_tmp1_);
				goto __catch0_g_error;
			}
			_tmp21_ = _tmp18_;
			_tmp18_ = NULL;
			_g_object_unref0 (info);
			info = _tmp21_;
			_g_object_unref0 (_tmp18_);
		}
		_g_object_unref0 (info);
		_g_object_unref0 (location);
		_g_object_unref0 (_tmp1_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		result = (guint) 0;
		_g_object_unref0 (enumerator);
		(folder_list == NULL) ? NULL : (folder_list = (_g_list_free__g_object_unref0_ (folder_list), NULL));
		(template_list == NULL) ? NULL : (template_list = (_g_list_free__g_object_unref0_ (template_list), NULL));
		block21_data_unref (_data21_);
		_data21_ = NULL;
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		guint _tmp22_ = 0U;
		_g_object_unref0 (enumerator);
		(folder_list == NULL) ? NULL : (folder_list = (_g_list_free__g_object_unref0_ (folder_list), NULL));
		(template_list == NULL) ? NULL : (template_list = (_g_list_free__g_object_unref0_ (template_list), NULL));
		block21_data_unref (_data21_);
		_data21_ = NULL;
		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 _tmp22_;
	}
	folder_list = g_list_sort (folder_list, ___lambda120__gcompare_func);
	_tmp23_ = folder_list;
	fl = _tmp23_;
	while (TRUE) {
		gboolean _tmp24_ = FALSE;
		GList* _tmp25_;
		GFile* folder = NULL;
		GList* _tmp26_;
		gconstpointer _tmp27_;
		GFile* _tmp28_;
		GMenu* folder_submenu = NULL;
		GMenu* _tmp29_;
		GMenuItem* folder_submenuitem = NULL;
		GFile* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
		GMenu* _tmp33_;
		GMenuItem* _tmp34_;
		GMenuItem* _tmp35_;
		guint sub_count = 0U;
		GFile* _tmp36_;
		GMenu* _tmp37_;
		GList* _tmp39_;
		GList* _tmp40_;
		_tmp25_ = fl;
		if (_tmp25_ != NULL) {
			_tmp24_ = count < ((guint) SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_MAX_TEMPLATES);
		} else {
			_tmp24_ = FALSE;
		}
		if (!_tmp24_) {
			break;
		}
		_tmp26_ = fl;
		_tmp27_ = _tmp26_->data;
		_tmp28_ = _g_object_ref0 ((GFile*) _tmp27_);
		folder = _tmp28_;
		_tmp29_ = g_menu_new ();
		folder_submenu = _tmp29_;
		_tmp30_ = folder;
		_tmp31_ = g_file_get_basename (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = folder_submenu;
		_tmp34_ = g_menu_item_new_submenu (_tmp32_, (GMenuModel*) _tmp33_);
		_tmp35_ = _tmp34_;
		_g_free0 (_tmp32_);
		folder_submenuitem = _tmp35_;
		_tmp36_ = folder;
		_tmp37_ = folder_submenu;
		sub_count = scratch_folder_manager_folder_item_load_templates_from_folder (self, _tmp36_, _tmp37_);
		if (sub_count > ((guint) 0)) {
			GMenuItem* _tmp38_;
			_tmp38_ = folder_submenuitem;
			g_menu_append_item (_data21_->template_submenu, _tmp38_);
			count += sub_count;
		} else {
			count -= (guint) 1;
		}
		_tmp39_ = fl;
		_tmp40_ = _tmp39_->next;
		fl = _tmp40_;
		_g_object_unref0 (folder_submenuitem);
		_g_object_unref0 (folder_submenu);
		_g_object_unref0 (folder);
	}
	if (count > ((guint) SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_MAX_TEMPLATES)) {
		g_warning ("FolderItem.vala:322: too many templates! %u", count);
		result = count;
		_g_object_unref0 (enumerator);
		(folder_list == NULL) ? NULL : (folder_list = (_g_list_free__g_object_unref0_ (folder_list), NULL));
		(template_list == NULL) ? NULL : (template_list = (_g_list_free__g_object_unref0_ (template_list), NULL));
		block21_data_unref (_data21_);
		_data21_ = NULL;
		return result;
	}
	template_list = g_list_sort (template_list, ___lambda121__gcompare_func);
	_tmp41_ = template_list;
	g_list_foreach (_tmp41_, ___lambda122__gfunc, _data21_);
	result = count;
	_g_object_unref0 (enumerator);
	(folder_list == NULL) ? NULL : (folder_list = (_g_list_free__g_object_unref0_ (folder_list), NULL));
	(template_list == NULL) ? NULL : (template_list = (_g_list_free__g_object_unref0_ (template_list), NULL));
	block21_data_unref (_data21_);
	_data21_ = NULL;
	return result;
}

void
scratch_folder_manager_folder_item_remove_all_badges (ScratchFolderManagerFolderItem* self)
{
	g_return_if_fail (self != NULL);
	{
		GeeIterator* _child_it = NULL;
		GeeCollection* _tmp0_;
		GeeCollection* _tmp1_;
		GeeCollection* _tmp2_;
		GeeIterator* _tmp3_;
		GeeIterator* _tmp4_;
		_tmp0_ = code_widgets_source_list_expandable_item_get_children ((CodeWidgetsSourceListExpandableItem*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_child_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			CodeWidgetsSourceListItem* child = NULL;
			GeeIterator* _tmp6_;
			gpointer _tmp7_;
			CodeWidgetsSourceListItem* _tmp8_;
			_tmp5_ = _child_it;
			if (!gee_iterator_next (_tmp5_)) {
				break;
			}
			_tmp6_ = _child_it;
			_tmp7_ = gee_iterator_get (_tmp6_);
			child = (CodeWidgetsSourceListItem*) _tmp7_;
			_tmp8_ = child;
			scratch_folder_manager_folder_item_remove_badge (self, _tmp8_);
			_g_object_unref0 (child);
		}
		_g_object_unref0 (_child_it);
	}
}

static void
scratch_folder_manager_folder_item_remove_badge (ScratchFolderManagerFolderItem* self,
                                                 CodeWidgetsSourceListItem* item)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	if (SCRATCH_FOLDER_MANAGER_IS_FOLDER_ITEM (item)) {
		scratch_folder_manager_folder_item_remove_all_badges (G_TYPE_CHECK_INSTANCE_CAST (item, SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, ScratchFolderManagerFolderItem));
	}
	code_widgets_source_list_item_set_badge (item, "");
}

void
scratch_folder_manager_folder_item_add (ScratchFolderManagerFolderItem* self,
                                        CodeWidgetsSourceListItem* item)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	if (self->priv->has_dummy) {
		guint _tmp1_;
		guint _tmp2_;
		_tmp1_ = code_widgets_source_list_expandable_item_get_n_children ((CodeWidgetsSourceListExpandableItem*) self);
		_tmp2_ = _tmp1_;
		_tmp0_ = _tmp2_ == ((guint) 1);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		CodeWidgetsSourceListItem* _tmp3_;
		_tmp3_ = self->priv->dummy;
		code_widgets_source_list_expandable_item_remove (G_TYPE_CHECK_INSTANCE_CAST (self, CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, CodeWidgetsSourceListExpandableItem), _tmp3_);
		self->priv->has_dummy = FALSE;
	}
	code_widgets_source_list_expandable_item_add ((CodeWidgetsSourceListExpandableItem*) G_TYPE_CHECK_INSTANCE_CAST (self, SCRATCH_FOLDER_MANAGER_TYPE_ITEM, ScratchFolderManagerItem), item);
}

void
scratch_folder_manager_folder_item_remove (ScratchFolderManagerFolderItem* self,
                                           CodeWidgetsSourceListItem* item)
{
	gboolean _tmp12_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	if (SCRATCH_FOLDER_MANAGER_IS_FOLDER_ITEM (item)) {
		ScratchFolderManagerFolderItem* folder = NULL;
		ScratchFolderManagerFolderItem* _tmp0_;
		_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (item, SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, ScratchFolderManagerFolderItem));
		folder = _tmp0_;
		{
			GeeIterator* _child_it = NULL;
			ScratchFolderManagerFolderItem* _tmp1_;
			GeeCollection* _tmp2_;
			GeeCollection* _tmp3_;
			GeeCollection* _tmp4_;
			GeeIterator* _tmp5_;
			GeeIterator* _tmp6_;
			_tmp1_ = folder;
			_tmp2_ = code_widgets_source_list_expandable_item_get_children ((CodeWidgetsSourceListExpandableItem*) _tmp1_);
			_tmp3_ = _tmp2_;
			_tmp4_ = _tmp3_;
			_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
			_tmp6_ = _tmp5_;
			_g_object_unref0 (_tmp4_);
			_child_it = _tmp6_;
			while (TRUE) {
				GeeIterator* _tmp7_;
				CodeWidgetsSourceListItem* child = NULL;
				GeeIterator* _tmp8_;
				gpointer _tmp9_;
				ScratchFolderManagerFolderItem* _tmp10_;
				CodeWidgetsSourceListItem* _tmp11_;
				_tmp7_ = _child_it;
				if (!gee_iterator_next (_tmp7_)) {
					break;
				}
				_tmp8_ = _child_it;
				_tmp9_ = gee_iterator_get (_tmp8_);
				child = (CodeWidgetsSourceListItem*) _tmp9_;
				_tmp10_ = folder;
				_tmp11_ = child;
				scratch_folder_manager_folder_item_remove (_tmp10_, _tmp11_);
				_g_object_unref0 (child);
			}
			_g_object_unref0 (_child_it);
		}
		_g_object_unref0 (folder);
	}
	code_widgets_source_list_expandable_item_remove (G_TYPE_CHECK_INSTANCE_CAST (self, CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, CodeWidgetsSourceListExpandableItem), item);
	if (self->priv->has_dummy) {
		_tmp12_ = TRUE;
	} else {
		guint _tmp13_;
		guint _tmp14_;
		_tmp13_ = code_widgets_source_list_expandable_item_get_n_children ((CodeWidgetsSourceListExpandableItem*) self);
		_tmp14_ = _tmp13_;
		_tmp12_ = _tmp14_ > ((guint) 0);
	}
	if (!_tmp12_) {
		CodeWidgetsSourceListItem* _tmp15_;
		_tmp15_ = self->priv->dummy;
		code_widgets_source_list_expandable_item_add (G_TYPE_CHECK_INSTANCE_CAST (self, CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, CodeWidgetsSourceListExpandableItem), _tmp15_);
		self->priv->has_dummy = TRUE;
	}
}

void
scratch_folder_manager_folder_item_clear (ScratchFolderManagerFolderItem* self)
{
	g_return_if_fail (self != NULL);
	code_widgets_source_list_expandable_item_clear (G_TYPE_CHECK_INSTANCE_CAST (self, CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, CodeWidgetsSourceListExpandableItem));
	self->priv->has_dummy = FALSE;
}

static void
scratch_folder_manager_folder_item_real_on_changed (ScratchFolderManagerFolderItem* self,
                                                    GFile* source,
                                                    GFile* dest,
                                                    GFileMonitorEvent event)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	ScratchFolderManagerFileView* _tmp3_;
	ScratchFolderManagerFileView* _tmp4_;
	g_return_if_fail (source != NULL);
	_tmp0_ = g_file_get_basename (source);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_str_has_prefix (_tmp1_, ".goutputstream");
	_g_free0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
	_tmp4_ = _tmp3_;
	scratch_folder_manager_file_view_folder_item_update_hook (_tmp4_, source, dest, event);
	if (!self->priv->children_loaded) {
		switch (event) {
			case G_FILE_MONITOR_EVENT_DELETED:
			{
				ScratchFolderManagerFile* _tmp5_;
				ScratchFolderManagerFile* _tmp6_;
				gboolean _tmp7_;
				gboolean _tmp8_;
				_tmp5_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
				_tmp6_ = _tmp5_;
				scratch_folder_manager_file_invalidate_cache (_tmp6_);
				_tmp7_ = code_widgets_source_list_expandable_item_get_expanded ((CodeWidgetsSourceListExpandableItem*) self);
				_tmp8_ = _tmp7_;
				if (_tmp8_) {
					g_signal_emit_by_name ((CodeWidgetsSourceListExpandableItem*) self, "toggled");
				}
				break;
			}
			case G_FILE_MONITOR_EVENT_CREATED:
			{
				ScratchFolderManagerFile* _tmp9_;
				ScratchFolderManagerFile* _tmp10_;
				gboolean _tmp11_;
				gboolean _tmp12_;
				_tmp9_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
				_tmp10_ = _tmp9_;
				scratch_folder_manager_file_invalidate_cache (_tmp10_);
				_tmp11_ = code_widgets_source_list_expandable_item_get_expanded ((CodeWidgetsSourceListExpandableItem*) self);
				_tmp12_ = _tmp11_;
				if (_tmp12_) {
					g_signal_emit_by_name ((CodeWidgetsSourceListExpandableItem*) self, "toggled");
				}
				break;
			}
			case G_FILE_MONITOR_EVENT_RENAMED:
			case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
			case G_FILE_MONITOR_EVENT_UNMOUNTED:
			case G_FILE_MONITOR_EVENT_CHANGED:
			case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
			case G_FILE_MONITOR_EVENT_MOVED:
			case G_FILE_MONITOR_EVENT_MOVED_IN:
			case G_FILE_MONITOR_EVENT_MOVED_OUT:
			case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
			{
				break;
			}
			default:
			break;
		}
	} else {
		switch (event) {
			case G_FILE_MONITOR_EVENT_DELETED:
			{
				ScratchFolderManagerItem* path_item = NULL;
				gchar* _tmp13_;
				gchar* _tmp14_;
				ScratchFolderManagerItem* _tmp15_;
				ScratchFolderManagerItem* _tmp16_;
				ScratchFolderManagerItem* _tmp17_;
				_tmp13_ = g_file_get_path (source);
				_tmp14_ = _tmp13_;
				_tmp15_ = scratch_folder_manager_folder_item_find_item_for_path (self, _tmp14_);
				_tmp16_ = _tmp15_;
				_g_free0 (_tmp14_);
				path_item = _tmp16_;
				_tmp17_ = path_item;
				if (_tmp17_ != NULL) {
					ScratchFolderManagerItem* _tmp18_;
					_tmp18_ = path_item;
					scratch_folder_manager_folder_item_remove (self, (CodeWidgetsSourceListItem*) _tmp18_);
				}
				_g_object_unref0 (path_item);
				break;
			}
			case G_FILE_MONITOR_EVENT_CREATED:
			{
				ScratchFolderManagerItem* path_item = NULL;
				gchar* _tmp19_;
				gchar* _tmp20_;
				ScratchFolderManagerItem* _tmp21_;
				ScratchFolderManagerItem* _tmp22_;
				ScratchFolderManagerItem* _tmp23_;
				if (g_file_query_exists (source, NULL) == FALSE) {
					return;
				}
				_tmp19_ = g_file_get_path (source);
				_tmp20_ = _tmp19_;
				_tmp21_ = scratch_folder_manager_folder_item_find_item_for_path (self, _tmp20_);
				_tmp22_ = _tmp21_;
				_g_free0 (_tmp20_);
				path_item = _tmp22_;
				_tmp23_ = path_item;
				if (_tmp23_ == NULL) {
					ScratchFolderManagerFile* file = NULL;
					gchar* _tmp24_;
					gchar* _tmp25_;
					ScratchFolderManagerFile* _tmp26_;
					ScratchFolderManagerFile* _tmp27_;
					ScratchFolderManagerFile* _tmp28_;
					gboolean _tmp29_;
					gboolean _tmp30_;
					ScratchFolderManagerItem* _tmp42_;
					_tmp24_ = g_file_get_path (source);
					_tmp25_ = _tmp24_;
					_tmp26_ = scratch_folder_manager_file_new (_tmp25_);
					_tmp27_ = _tmp26_;
					_g_free0 (_tmp25_);
					file = _tmp27_;
					_tmp28_ = file;
					_tmp29_ = scratch_folder_manager_file_get_is_valid_directory (_tmp28_);
					_tmp30_ = _tmp29_;
					if (_tmp30_) {
						ScratchFolderManagerFile* _tmp31_;
						ScratchFolderManagerFileView* _tmp32_;
						ScratchFolderManagerFileView* _tmp33_;
						ScratchFolderManagerFolderItem* _tmp34_;
						_tmp31_ = file;
						_tmp32_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
						_tmp33_ = _tmp32_;
						_tmp34_ = scratch_folder_manager_folder_item_new (_tmp31_, _tmp33_);
						_g_object_unref0 (path_item);
						path_item = (ScratchFolderManagerItem*) _tmp34_;
					} else {
						ScratchFolderManagerFile* _tmp35_;
						gboolean _tmp36_;
						gboolean _tmp37_;
						_tmp35_ = file;
						_tmp36_ = scratch_folder_manager_file_get_is_valid_textfile (_tmp35_);
						_tmp37_ = _tmp36_;
						if (_tmp37_) {
							ScratchFolderManagerFile* _tmp38_;
							ScratchFolderManagerFileView* _tmp39_;
							ScratchFolderManagerFileView* _tmp40_;
							ScratchFolderManagerFileItem* _tmp41_;
							_tmp38_ = file;
							_tmp39_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
							_tmp40_ = _tmp39_;
							_tmp41_ = scratch_folder_manager_file_item_new (_tmp38_, _tmp40_);
							_g_object_unref0 (path_item);
							path_item = (ScratchFolderManagerItem*) _tmp41_;
						}
					}
					_tmp42_ = path_item;
					scratch_folder_manager_folder_item_add (self, (CodeWidgetsSourceListItem*) _tmp42_);
					_g_object_unref0 (file);
				}
				_g_object_unref0 (path_item);
				break;
			}
			case G_FILE_MONITOR_EVENT_RENAMED:
			case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
			case G_FILE_MONITOR_EVENT_UNMOUNTED:
			case G_FILE_MONITOR_EVENT_CHANGED:
			case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
			case G_FILE_MONITOR_EVENT_MOVED:
			case G_FILE_MONITOR_EVENT_MOVED_IN:
			case G_FILE_MONITOR_EVENT_MOVED_OUT:
			case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
			{
				break;
			}
			default:
			break;
		}
	}
	if (event == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT) {
		ScratchFolderManagerProjectFolderItem* root = NULL;
		ScratchFolderManagerProjectFolderItem* _tmp43_;
		ScratchFolderManagerProjectFolderItem* _tmp44_;
		_tmp43_ = scratch_folder_manager_item_get_root_folder ((ScratchFolderManagerItem*) self, (CodeWidgetsSourceListExpandableItem*) self);
		root = _tmp43_;
		_tmp44_ = root;
		if (_tmp44_ != NULL) {
			ScratchFolderManagerProjectFolderItem* _tmp45_;
			_tmp45_ = root;
			scratch_folder_manager_project_folder_item_child_folder_changed (_tmp45_, self);
		}
		_g_object_unref0 (root);
	}
}

void
scratch_folder_manager_folder_item_on_changed (ScratchFolderManagerFolderItem* self,
                                               GFile* source,
                                               GFile* dest,
                                               GFileMonitorEvent event)
{
	ScratchFolderManagerFolderItemClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_GET_CLASS (self);
	if (_klass_->on_changed) {
		_klass_->on_changed (self, source, dest, event);
	}
}

static ScratchFolderManagerItem*
scratch_folder_manager_folder_item_find_item_for_path (ScratchFolderManagerFolderItem* self,
                                                       const gchar* path)
{
	ScratchFolderManagerItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (path != NULL, NULL);
	{
		GeeIterator* _item_it = NULL;
		GeeCollection* _tmp0_;
		GeeCollection* _tmp1_;
		GeeCollection* _tmp2_;
		GeeIterator* _tmp3_;
		GeeIterator* _tmp4_;
		_tmp0_ = code_widgets_source_list_expandable_item_get_children ((CodeWidgetsSourceListExpandableItem*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_item_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			CodeWidgetsSourceListItem* item = NULL;
			GeeIterator* _tmp6_;
			gpointer _tmp7_;
			gboolean _tmp8_ = FALSE;
			CodeWidgetsSourceListItem* _tmp9_;
			_tmp5_ = _item_it;
			if (!gee_iterator_next (_tmp5_)) {
				break;
			}
			_tmp6_ = _item_it;
			_tmp7_ = gee_iterator_get (_tmp6_);
			item = (CodeWidgetsSourceListItem*) _tmp7_;
			_tmp9_ = item;
			if (SCRATCH_FOLDER_MANAGER_IS_ITEM (_tmp9_)) {
				CodeWidgetsSourceListItem* _tmp10_;
				gchar* _tmp11_;
				gchar* _tmp12_;
				gchar* _tmp13_;
				_tmp10_ = item;
				_tmp11_ = scratch_folder_manager_item_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, SCRATCH_FOLDER_MANAGER_TYPE_ITEM, ScratchFolderManagerItem));
				_tmp12_ = _tmp11_;
				_tmp13_ = _tmp12_;
				_tmp8_ = g_strcmp0 (_tmp13_, path) == 0;
				_g_free0 (_tmp13_);
			} else {
				_tmp8_ = FALSE;
			}
			if (_tmp8_) {
				CodeWidgetsSourceListItem* _tmp14_;
				ScratchFolderManagerItem* _tmp15_;
				_tmp14_ = item;
				_tmp15_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, SCRATCH_FOLDER_MANAGER_TYPE_ITEM, ScratchFolderManagerItem));
				result = _tmp15_;
				_g_object_unref0 (item);
				_g_object_unref0 (_item_it);
				return result;
			}
			_g_object_unref0 (item);
		}
		_g_object_unref0 (_item_it);
	}
	result = NULL;
	return result;
}

static Block22Data*
block22_data_ref (Block22Data* _data22_)
{
	g_atomic_int_inc (&_data22_->_ref_count_);
	return _data22_;
}

static void
block22_data_unref (void * _userdata_)
{
	Block22Data* _data22_;
	_data22_ = (Block22Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data22_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data22_->self;
		_g_free0 (_data22_->template_path);
		_g_object_unref0 (self);
		g_slice_free (Block22Data, _data22_);
	}
}

static Block23Data*
block23_data_ref (Block23Data* _data23_)
{
	g_atomic_int_inc (&_data23_->_ref_count_);
	return _data23_;
}

static void
block23_data_unref (void * _userdata_)
{
	Block23Data* _data23_;
	_data23_ = (Block23Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data23_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data23_->_data22_->self;
		block22_data_unref (_data23_->_data22_);
		_data23_->_data22_ = NULL;
		g_slice_free (Block23Data, _data23_);
	}
}

static void
___lambda95_ (Block23Data* _data23_)
{
	Block22Data* _data22_;
	ScratchFolderManagerFolderItem* self;
	_data22_ = _data23_->_data22_;
	self = _data22_->self;
	g_signal_handler_disconnect ((GObject*) self, _data23_->once);
	scratch_folder_manager_folder_item_copy_template (self, _data22_->template_path);
}

static void
____lambda95__scratch_folder_manager_folder_item_children_finished_loading (ScratchFolderManagerFolderItem* _sender,
                                                                            gpointer self)
{
	___lambda95_ (self);
}

void
scratch_folder_manager_folder_item_on_add_template (ScratchFolderManagerFolderItem* self,
                                                    const gchar* template_path)
{
	Block22Data* _data22_;
	gchar* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (template_path != NULL);
	_data22_ = g_slice_new0 (Block22Data);
	_data22_->_ref_count_ = 1;
	_data22_->self = g_object_ref (self);
	_tmp0_ = g_strdup (template_path);
	_g_free0 (_data22_->template_path);
	_data22_->template_path = _tmp0_;
	_tmp1_ = code_widgets_source_list_expandable_item_get_expanded ((CodeWidgetsSourceListExpandableItem*) self);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		Block23Data* _data23_;
		gulong _tmp3_;
		_data23_ = g_slice_new0 (Block23Data);
		_data23_->_ref_count_ = 1;
		_data23_->_data22_ = block22_data_ref (_data22_);
		code_widgets_source_list_expandable_item_set_expanded ((CodeWidgetsSourceListExpandableItem*) self, TRUE);
		_data23_->once = (gulong) 0;
		_tmp3_ = g_signal_connect_data (self, "children-finished-loading", (GCallback) ____lambda95__scratch_folder_manager_folder_item_children_finished_loading, block23_data_ref (_data23_), (GClosureNotify) block23_data_unref, 0);
		_data23_->once = _tmp3_;
		block23_data_unref (_data23_);
		_data23_ = NULL;
	} else {
		scratch_folder_manager_folder_item_copy_template (self, _data22_->template_path);
	}
	block22_data_unref (_data22_);
	_data22_ = NULL;
}

static Block24Data*
block24_data_ref (Block24Data* _data24_)
{
	g_atomic_int_inc (&_data24_->_ref_count_);
	return _data24_;
}

static void
block24_data_unref (void * _userdata_)
{
	Block24Data* _data24_;
	_data24_ = (Block24Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data24_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data24_->self;
		_g_object_unref0 (_data24_->new_file);
		_g_object_unref0 (self);
		g_slice_free (Block24Data, _data24_);
	}
}

static Block25Data*
block25_data_ref (Block25Data* _data25_)
{
	g_atomic_int_inc (&_data25_->_ref_count_);
	return _data25_;
}

static void
block25_data_unref (void * _userdata_)
{
	Block25Data* _data25_;
	_data25_ = (Block25Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data25_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data25_->_data24_->self;
		_g_free0 (_data25_->path);
		block24_data_unref (_data25_->_data24_);
		_data25_->_data24_ = NULL;
		g_slice_free (Block25Data, _data25_);
	}
}

static GVariant*
_variant_new18 (const gchar* value)
{
	return g_variant_ref_sink (g_variant_new_string (value));
}

static gboolean
__lambda97_ (Block25Data* _data25_)
{
	Block24Data* _data24_;
	ScratchFolderManagerFolderItem* self;
	GSimpleAction* rename_action = NULL;
	ScratchFolderManagerFileView* _tmp0_;
	ScratchFolderManagerFileView* _tmp1_;
	GSimpleActionGroup* _tmp2_;
	GSimpleActionGroup* _tmp3_;
	GSimpleAction* _tmp4_;
	gboolean _tmp5_ = FALSE;
	GSimpleAction* _tmp6_;
	gboolean result;
	_data24_ = _data25_->_data24_;
	self = _data24_->self;
	_tmp0_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = scratch_folder_manager_file_view_get_actions (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = scratch_utils_action_from_group (SCRATCH_FOLDER_MANAGER_FILE_VIEW_ACTION_RENAME_FILE, _tmp3_);
	rename_action = _tmp4_;
	_tmp6_ = rename_action;
	if (_tmp6_ != NULL) {
		GSimpleAction* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = rename_action;
		_tmp8_ = g_action_get_enabled ((GAction*) _tmp7_);
		_tmp9_ = _tmp8_;
		_tmp5_ = _tmp9_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		GSimpleAction* _tmp10_;
		GVariant* _tmp11_;
		_tmp10_ = rename_action;
		_tmp11_ = _variant_new18 (_data25_->path);
		g_signal_emit_by_name (_tmp10_, "activate", _tmp11_);
		_g_variant_unref0 (_tmp11_);
	} else {
		g_critical ("FolderItem.vala:544: Rename action not available");
	}
	result = G_SOURCE_REMOVE;
	_g_object_unref0 (rename_action);
	return result;
}

static gboolean
___lambda97__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda97_ (self);
	return result;
}

static void
__lambda96_ (Block24Data* _data24_)
{
	ScratchFolderManagerFolderItem* self;
	Block25Data* _data25_;
	GFile* _tmp0_;
	gchar* _tmp1_;
	self = _data24_->self;
	_data25_ = g_slice_new0 (Block25Data);
	_data25_->_ref_count_ = 1;
	_data25_->_data24_ = block24_data_ref (_data24_);
	g_signal_handler_disconnect ((GObject*) self, _data24_->once);
	_tmp0_ = _data24_->new_file;
	_tmp1_ = g_file_get_path (_tmp0_);
	_data25_->path = _tmp1_;
	g_timeout_add_full (G_PRIORITY_DEFAULT, SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_RENAME_AFTER_NEW_DELAY_MSEC, ___lambda97__gsource_func, block25_data_ref (_data25_), block25_data_unref);
	block25_data_unref (_data25_);
	_data25_ = NULL;
}

static void
___lambda96__code_widgets_source_list_expandable_item_child_added (CodeWidgetsSourceListExpandableItem* _sender,
                                                                   CodeWidgetsSourceListItem* item,
                                                                   gpointer self)
{
	__lambda96_ (self);
}

static void
scratch_folder_manager_folder_item_copy_template (ScratchFolderManagerFolderItem* self,
                                                  const gchar* template_path)
{
	Block24Data* _data24_;
	ScratchFolderManagerFile* _tmp0_;
	ScratchFolderManagerFile* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GFile* template_file = NULL;
	GFile* _tmp4_;
	GFile* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	ScratchFolderManagerFile* _tmp8_;
	ScratchFolderManagerFile* _tmp9_;
	GFile* _tmp10_;
	GFile* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	GFile* _tmp14_;
	gint n = 0;
	GFile* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gulong _tmp33_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (template_path != NULL);
	_data24_ = g_slice_new0 (Block24Data);
	_data24_->_ref_count_ = 1;
	_data24_->self = g_object_ref (self);
	_tmp0_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = scratch_folder_manager_file_get_is_executable (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		g_warning ("FolderItem.vala:504: Unable to open parent folder");
		block24_data_unref (_data24_);
		_data24_ = NULL;
		return;
	}
	_tmp4_ = g_file_new_for_path (template_path);
	template_file = _tmp4_;
	_tmp5_ = template_file;
	_tmp6_ = g_file_get_basename (_tmp5_);
	_tmp7_ = _tmp6_;
	code_widgets_source_list_item_set_name ((CodeWidgetsSourceListItem*) self, _tmp7_);
	_g_free0 (_tmp7_);
	_tmp8_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp9_ = _tmp8_;
	_tmp10_ = scratch_folder_manager_file_get_file (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = code_widgets_source_list_item_get_name ((CodeWidgetsSourceListItem*) self);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_file_get_child (_tmp11_, _tmp13_);
	_data24_->new_file = _tmp14_;
	n = 1;
	while (TRUE) {
		GFile* _tmp15_;
		ScratchFolderManagerFile* _tmp16_;
		ScratchFolderManagerFile* _tmp17_;
		GFile* _tmp18_;
		GFile* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		GFile* _tmp24_;
		gint _tmp25_;
		_tmp15_ = _data24_->new_file;
		if (!g_file_query_exists (_tmp15_, NULL)) {
			break;
		}
		_tmp16_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
		_tmp17_ = _tmp16_;
		_tmp18_ = scratch_folder_manager_file_get_file (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = code_widgets_source_list_item_get_name ((CodeWidgetsSourceListItem*) self);
		_tmp21_ = _tmp20_;
		_tmp22_ = g_strdup_printf ("%s %d", _tmp21_, n);
		_tmp23_ = _tmp22_;
		_tmp24_ = g_file_get_child (_tmp19_, _tmp23_);
		_g_object_unref0 (_data24_->new_file);
		_data24_->new_file = _tmp24_;
		_g_free0 (_tmp23_);
		_tmp25_ = n;
		n = _tmp25_ + 1;
	}
	_tmp26_ = _data24_->new_file;
	_tmp27_ = g_file_get_basename (_tmp26_);
	_tmp28_ = _tmp27_;
	code_widgets_source_list_item_set_name ((CodeWidgetsSourceListItem*) self, _tmp28_);
	_g_free0 (_tmp28_);
	{
		GFile* _tmp29_;
		GFile* _tmp30_;
		_tmp29_ = template_file;
		_tmp30_ = _data24_->new_file;
		g_file_copy (_tmp29_, _tmp30_, (G_FILE_COPY_TARGET_DEFAULT_MODIFIED_TIME | G_FILE_COPY_TARGET_DEFAULT_PERMS) | G_FILE_COPY_NOFOLLOW_SYMLINKS, NULL, NULL, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp31_;
		const gchar* _tmp32_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp31_ = e;
		_tmp32_ = _tmp31_->message;
		g_warning ("FolderItem.vala:528: Error copying template %s", _tmp32_);
		_g_error_free0 (e);
		_g_object_unref0 (template_file);
		block24_data_unref (_data24_);
		_data24_ = NULL;
		return;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (template_file);
		block24_data_unref (_data24_);
		_data24_ = NULL;
		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;
	}
	_data24_->once = (gulong) 0;
	_tmp33_ = g_signal_connect_data ((CodeWidgetsSourceListExpandableItem*) self, "child-added", (GCallback) ___lambda96__code_widgets_source_list_expandable_item_child_added, block24_data_ref (_data24_), (GClosureNotify) block24_data_unref, 0);
	_data24_->once = _tmp33_;
	_g_object_unref0 (template_file);
	block24_data_unref (_data24_);
	_data24_ = NULL;
}

static Block26Data*
block26_data_ref (Block26Data* _data26_)
{
	g_atomic_int_inc (&_data26_->_ref_count_);
	return _data26_;
}

static void
block26_data_unref (void * _userdata_)
{
	Block26Data* _data26_;
	_data26_ = (Block26Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data26_->self;
		_g_free0 (_data26_->name);
		_g_object_unref0 (self);
		g_slice_free (Block26Data, _data26_);
	}
}

static Block27Data*
block27_data_ref (Block27Data* _data27_)
{
	g_atomic_int_inc (&_data27_->_ref_count_);
	return _data27_;
}

static void
block27_data_unref (void * _userdata_)
{
	Block27Data* _data27_;
	_data27_ = (Block27Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data27_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data27_->_data26_->self;
		block26_data_unref (_data27_->_data26_);
		_data27_->_data26_ = NULL;
		g_slice_free (Block27Data, _data27_);
	}
}

static void
___lambda91_ (Block27Data* _data27_)
{
	Block26Data* _data26_;
	ScratchFolderManagerFolderItem* self;
	const gchar* _tmp0_;
	_data26_ = _data27_->_data26_;
	self = _data26_->self;
	g_signal_handler_disconnect ((GObject*) self, _data27_->once);
	_tmp0_ = _data26_->name;
	scratch_folder_manager_folder_item_rename_new (self, _tmp0_, _data26_->is_folder);
}

static void
____lambda91__scratch_folder_manager_folder_item_children_finished_loading (ScratchFolderManagerFolderItem* _sender,
                                                                            gpointer self)
{
	___lambda91_ (self);
}

void
scratch_folder_manager_folder_item_on_add_new (ScratchFolderManagerFolderItem* self,
                                               gboolean is_folder)
{
	Block26Data* _data26_;
	ScratchFolderManagerFile* _tmp0_;
	ScratchFolderManagerFile* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	const gchar* _tmp4_ = NULL;
	gchar* _tmp5_;
	GFile* new_file = NULL;
	ScratchFolderManagerFile* _tmp6_;
	ScratchFolderManagerFile* _tmp7_;
	GFile* _tmp8_;
	GFile* _tmp9_;
	const gchar* _tmp10_;
	GFile* _tmp11_;
	gint n = 0;
	GFile* _tmp22_;
	gchar* _tmp23_;
	gboolean _tmp24_;
	gboolean _tmp25_;
	g_return_if_fail (self != NULL);
	_data26_ = g_slice_new0 (Block26Data);
	_data26_->_ref_count_ = 1;
	_data26_->self = g_object_ref (self);
	_data26_->is_folder = is_folder;
	_tmp0_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = scratch_folder_manager_file_get_is_executable (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		g_warning ("FolderItem.vala:555: Unable to open parent folder");
		block26_data_unref (_data26_);
		_data26_ = NULL;
		return;
	}
	if (_data26_->is_folder) {
		_tmp4_ = _ ("untitled folder");
	} else {
		_tmp4_ = _ ("new file");
	}
	_tmp5_ = g_strdup (_tmp4_);
	_data26_->name = _tmp5_;
	_tmp6_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = scratch_folder_manager_file_get_file (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = _data26_->name;
	_tmp11_ = g_file_get_child (_tmp9_, _tmp10_);
	new_file = _tmp11_;
	n = 1;
	while (TRUE) {
		GFile* _tmp12_;
		ScratchFolderManagerFile* _tmp13_;
		ScratchFolderManagerFile* _tmp14_;
		GFile* _tmp15_;
		GFile* _tmp16_;
		const gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		GFile* _tmp20_;
		gint _tmp21_;
		_tmp12_ = new_file;
		if (!g_file_query_exists (_tmp12_, NULL)) {
			break;
		}
		_tmp13_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
		_tmp14_ = _tmp13_;
		_tmp15_ = scratch_folder_manager_file_get_file (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = _data26_->name;
		_tmp18_ = g_strdup_printf ("%s %d", _tmp17_, n);
		_tmp19_ = _tmp18_;
		_tmp20_ = g_file_get_child (_tmp16_, _tmp19_);
		_g_object_unref0 (new_file);
		new_file = _tmp20_;
		_g_free0 (_tmp19_);
		_tmp21_ = n;
		n = _tmp21_ + 1;
	}
	_tmp22_ = new_file;
	_tmp23_ = g_file_get_basename (_tmp22_);
	_g_free0 (_data26_->name);
	_data26_->name = _tmp23_;
	_tmp24_ = code_widgets_source_list_expandable_item_get_expanded ((CodeWidgetsSourceListExpandableItem*) self);
	_tmp25_ = _tmp24_;
	if (!_tmp25_) {
		Block27Data* _data27_;
		gulong _tmp26_;
		_data27_ = g_slice_new0 (Block27Data);
		_data27_->_ref_count_ = 1;
		_data27_->_data26_ = block26_data_ref (_data26_);
		_data27_->once = (gulong) 0;
		_tmp26_ = g_signal_connect_data (self, "children-finished-loading", (GCallback) ____lambda91__scratch_folder_manager_folder_item_children_finished_loading, block27_data_ref (_data27_), (GClosureNotify) block27_data_unref, 0);
		_data27_->once = _tmp26_;
		code_widgets_source_list_expandable_item_set_expanded ((CodeWidgetsSourceListExpandableItem*) self, TRUE);
		block27_data_unref (_data27_);
		_data27_ = NULL;
	} else {
		const gchar* _tmp27_;
		_tmp27_ = _data26_->name;
		scratch_folder_manager_folder_item_rename_new (self, _tmp27_, _data26_->is_folder);
	}
	_g_object_unref0 (new_file);
	block26_data_unref (_data26_);
	_data26_ = NULL;
}

static Block28Data*
block28_data_ref (Block28Data* _data28_)
{
	g_atomic_int_inc (&_data28_->_ref_count_);
	return _data28_;
}

static void
block28_data_unref (void * _userdata_)
{
	Block28Data* _data28_;
	_data28_ = (Block28Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data28_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data28_->self;
		_g_object_unref0 (_data28_->rename_item);
		_g_object_unref0 (self);
		g_slice_free (Block28Data, _data28_);
	}
}

static Block29Data*
block29_data_ref (Block29Data* _data29_)
{
	g_atomic_int_inc (&_data29_->_ref_count_);
	return _data29_;
}

static void
block29_data_unref (void * _userdata_)
{
	Block29Data* _data29_;
	_data29_ = (Block29Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data29_->_ref_count_)) {
		ScratchFolderManagerFolderItem* self;
		self = _data29_->_data28_->self;
		block28_data_unref (_data29_->_data28_);
		_data29_->_data28_ = NULL;
		g_slice_free (Block29Data, _data29_);
	}
}

static void
___lambda93_ (Block29Data* _data29_)
{
	Block28Data* _data28_;
	ScratchFolderManagerFolderItem* self;
	gchar* new_name = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	GError* _inner_error0_ = NULL;
	_data28_ = _data29_->_data28_;
	self = _data28_->self;
	g_signal_handler_disconnect ((GObject*) _data28_->rename_item, _data29_->once);
	_tmp0_ = code_widgets_source_list_item_get_name ((CodeWidgetsSourceListItem*) _data28_->rename_item);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	new_name = _tmp2_;
	{
		GFile* gfile = NULL;
		ScratchFolderManagerFile* _tmp3_;
		ScratchFolderManagerFile* _tmp4_;
		GFile* _tmp5_;
		GFile* _tmp6_;
		const gchar* _tmp7_;
		GFile* _tmp8_;
		gboolean _tmp9_;
		gboolean _tmp10_;
		_tmp3_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = scratch_folder_manager_file_get_file (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = new_name;
		_tmp8_ = g_file_get_child_for_display_name (_tmp6_, _tmp7_, &_inner_error0_);
		gfile = _tmp8_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp9_ = scratch_folder_manager_item_rename_item_get_is_folder (_data28_->rename_item);
		_tmp10_ = _tmp9_;
		if (_tmp10_) {
			GFile* _tmp11_;
			_tmp11_ = gfile;
			g_file_make_directory (_tmp11_, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (gfile);
				goto __catch0_g_error;
			}
		} else {
			GFile* _tmp12_;
			GFileOutputStream* _tmp13_;
			GFileOutputStream* _tmp14_;
			ScratchFolderManagerFileView* _tmp15_;
			ScratchFolderManagerFileView* _tmp16_;
			GFile* _tmp17_;
			gchar* _tmp18_;
			gchar* _tmp19_;
			_tmp12_ = gfile;
			_tmp13_ = g_file_create (_tmp12_, G_FILE_CREATE_NONE, NULL, &_inner_error0_);
			_tmp14_ = _tmp13_;
			_g_object_unref0 (_tmp14_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (gfile);
				goto __catch0_g_error;
			}
			_tmp15_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
			_tmp16_ = _tmp15_;
			_tmp17_ = gfile;
			_tmp18_ = g_file_get_path (_tmp17_);
			_tmp19_ = _tmp18_;
			g_signal_emit_by_name (_tmp16_, "activate", _tmp19_);
			_g_free0 (_tmp19_);
		}
		_g_object_unref0 (gfile);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp20_;
		const gchar* _tmp21_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp20_ = e;
		_tmp21_ = _tmp20_->message;
		g_warning ("FolderItem.vala:607: %s", _tmp21_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (new_name);
		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;
	}
	_g_free0 (new_name);
}

static void
____lambda93__code_widgets_source_list_item_edited (CodeWidgetsSourceListItem* _sender,
                                                    const gchar* new_name,
                                                    gpointer self)
{
	___lambda93_ (self);
}

static gboolean
___lambda94_ (Block29Data* _data29_)
{
	Block28Data* _data28_;
	ScratchFolderManagerFolderItem* self;
	ScratchFolderManagerFileView* _tmp0_;
	ScratchFolderManagerFileView* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	_data28_ = _data29_->_data28_;
	self = _data28_->self;
	_tmp0_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = code_widgets_source_list_get_editing ((CodeWidgetsSourceList*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		result = G_SOURCE_CONTINUE;
		return result;
	} else {
		scratch_folder_manager_folder_item_remove (self, (CodeWidgetsSourceListItem*) _data28_->rename_item);
		result = G_SOURCE_REMOVE;
		return result;
	}
}

static gboolean
____lambda94__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda94_ (self);
	return result;
}

static gboolean
__lambda92_ (Block28Data* _data28_)
{
	ScratchFolderManagerFolderItem* self;
	ScratchFolderManagerFileView* _tmp0_;
	ScratchFolderManagerFileView* _tmp1_;
	gboolean result;
	self = _data28_->self;
	_tmp0_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
	_tmp1_ = _tmp0_;
	if (code_widgets_source_list_start_editing_item ((CodeWidgetsSourceList*) _tmp1_, (CodeWidgetsSourceListItem*) _data28_->rename_item)) {
		Block29Data* _data29_;
		gulong _tmp2_;
		_data29_ = g_slice_new0 (Block29Data);
		_data29_->_ref_count_ = 1;
		_data29_->_data28_ = block28_data_ref (_data28_);
		_data29_->once = (gulong) 0;
		_tmp2_ = g_signal_connect_data ((CodeWidgetsSourceListItem*) _data28_->rename_item, "edited", (GCallback) ____lambda93__code_widgets_source_list_item_edited, block29_data_ref (_data29_), (GClosureNotify) block29_data_unref, 0);
		_data29_->once = _tmp2_;
		g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, ____lambda94__gsource_func, block29_data_ref (_data29_), block29_data_unref);
		block29_data_unref (_data29_);
		_data29_ = NULL;
	} else {
		g_critical ("FolderItem.vala:621: Failed to rename new item");
		scratch_folder_manager_folder_item_remove (self, (CodeWidgetsSourceListItem*) _data28_->rename_item);
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda92__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda92_ (self);
	return result;
}

static void
scratch_folder_manager_folder_item_rename_new (ScratchFolderManagerFolderItem* self,
                                               const gchar* name,
                                               gboolean is_folder)
{
	ScratchFolderManagerFileView* _tmp0_;
	ScratchFolderManagerFileView* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	Block28Data* _data28_;
	ScratchFolderManagerItemRenameItem* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = scratch_folder_manager_item_get_view ((ScratchFolderManagerItem*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = code_widgets_source_list_get_editing ((CodeWidgetsSourceList*) _tmp1_);
	_tmp3_ = _tmp2_;
	_vala_return_if_fail (!_tmp3_, "!view.editing");
	_data28_ = g_slice_new0 (Block28Data);
	_data28_->_ref_count_ = 1;
	_data28_->self = g_object_ref (self);
	_tmp4_ = scratch_folder_manager_item_rename_item_new (name, is_folder);
	_data28_->rename_item = _tmp4_;
	scratch_folder_manager_folder_item_add (self, (CodeWidgetsSourceListItem*) _data28_->rename_item);
	g_timeout_add_full (G_PRIORITY_DEFAULT, SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_RENAME_AFTER_NEW_DELAY_MSEC, ___lambda92__gsource_func, block28_data_ref (_data28_), block28_data_unref);
	block28_data_unref (_data28_);
	_data28_ = NULL;
}

gboolean
scratch_folder_manager_folder_item_get_loading_required (ScratchFolderManagerFolderItem* self)
{
	gboolean result;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	if (!self->priv->children_loaded) {
		guint _tmp2_;
		guint _tmp3_;
		_tmp2_ = code_widgets_source_list_expandable_item_get_n_children ((CodeWidgetsSourceListExpandableItem*) self);
		_tmp3_ = _tmp2_;
		_tmp1_ = _tmp3_ <= ((guint) 1);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		ScratchFolderManagerFile* _tmp4_;
		ScratchFolderManagerFile* _tmp5_;
		GeeCollection* _tmp6_;
		GeeCollection* _tmp7_;
		GeeCollection* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp4_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = scratch_folder_manager_file_get_children (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = _tmp7_;
		_tmp9_ = gee_collection_get_size (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp0_ = _tmp10_ > 0;
		_g_object_unref0 (_tmp8_);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static void
_scratch_folder_manager_folder_item_on_toggled_code_widgets_source_list_expandable_item_toggled (CodeWidgetsSourceListExpandableItem* _sender,
                                                                                                 gpointer self)
{
	scratch_folder_manager_folder_item_on_toggled ((ScratchFolderManagerFolderItem*) self);
}

static void
_scratch_folder_manager_folder_item_on_changed_g_file_monitor_changed (GFileMonitor* _sender,
                                                                       GFile* file,
                                                                       GFile* other_file,
                                                                       GFileMonitorEvent event_type,
                                                                       gpointer self)
{
	scratch_folder_manager_folder_item_on_changed ((ScratchFolderManagerFolderItem*) self, file, other_file, event_type);
}

static GObject *
scratch_folder_manager_folder_item_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ScratchFolderManagerFolderItem * self;
	CodeWidgetsSourceListItem* _tmp0_;
	CodeWidgetsSourceListItem* _tmp1_;
	CodeWidgetsSourceListItem* _tmp2_;
	GError* _inner_error0_ = NULL;
	parent_class = G_OBJECT_CLASS (scratch_folder_manager_folder_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, ScratchFolderManagerFolderItem);
	code_widgets_source_list_item_set_selectable ((CodeWidgetsSourceListItem*) self, FALSE);
	_tmp0_ = code_widgets_source_list_item_new ("");
	_g_object_unref0 (self->priv->dummy);
	self->priv->dummy = _tmp0_;
	_tmp1_ = self->priv->dummy;
	code_widgets_source_list_item_set_selectable (_tmp1_, FALSE);
	_tmp2_ = self->priv->dummy;
	code_widgets_source_list_expandable_item_add (G_TYPE_CHECK_INSTANCE_CAST (self, CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, CodeWidgetsSourceListExpandableItem), _tmp2_);
	self->priv->has_dummy = TRUE;
	g_signal_connect_object ((CodeWidgetsSourceListExpandableItem*) self, "toggled", (GCallback) _scratch_folder_manager_folder_item_on_toggled_code_widgets_source_list_expandable_item_toggled, self, 0);
	{
		GFileMonitor* _tmp3_ = NULL;
		ScratchFolderManagerFile* _tmp4_;
		ScratchFolderManagerFile* _tmp5_;
		GFile* _tmp6_;
		GFile* _tmp7_;
		GFileMonitor* _tmp8_;
		GFileMonitor* _tmp9_;
		GFileMonitor* _tmp10_;
		_tmp4_ = scratch_folder_manager_item_get_file ((ScratchFolderManagerItem*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = scratch_folder_manager_file_get_file (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_file_monitor_directory (_tmp7_, G_FILE_MONITOR_NONE, NULL, &_inner_error0_);
		_tmp3_ = _tmp8_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp9_ = _tmp3_;
		_tmp3_ = NULL;
		_g_object_unref0 (self->priv->monitor);
		self->priv->monitor = _tmp9_;
		_tmp10_ = self->priv->monitor;
		g_signal_connect_object (_tmp10_, "changed", (GCallback) _scratch_folder_manager_folder_item_on_changed_g_file_monitor_changed, self, 0);
		_g_object_unref0 (_tmp3_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp11_;
		const gchar* _tmp12_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp11_ = e;
		_tmp12_ = _tmp11_->message;
		g_warning ("FolderItem.vala:64: %s", _tmp12_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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 obj;
}

static void
scratch_folder_manager_folder_item_class_init (ScratchFolderManagerFolderItemClass * klass,
                                               gpointer klass_data)
{
	scratch_folder_manager_folder_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ScratchFolderManagerFolderItem_private_offset);
	((CodeWidgetsSourceListItemClass *) klass)->get_context_menu = (GMenu* (*) (CodeWidgetsSourceListItem*)) scratch_folder_manager_folder_item_real_get_context_menu;
	((ScratchFolderManagerFolderItemClass *) klass)->on_changed = (void (*) (ScratchFolderManagerFolderItem*, GFile*, GFile*, GFileMonitorEvent)) scratch_folder_manager_folder_item_real_on_changed;
	G_OBJECT_CLASS (klass)->get_property = _vala_scratch_folder_manager_folder_item_get_property;
	G_OBJECT_CLASS (klass)->constructor = scratch_folder_manager_folder_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = scratch_folder_manager_folder_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_LOADING_REQUIRED_PROPERTY, scratch_folder_manager_folder_item_properties[SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_LOADING_REQUIRED_PROPERTY] = g_param_spec_boolean ("loading-required", "loading-required", "loading-required", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	scratch_folder_manager_folder_item_signals[SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_CHILDREN_FINISHED_LOADING_SIGNAL] = g_signal_new ("children-finished-loading", SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
scratch_folder_manager_folder_item_instance_init (ScratchFolderManagerFolderItem * self,
                                                  gpointer klass)
{
	self->priv = scratch_folder_manager_folder_item_get_instance_private (self);
	self->priv->children_loaded = FALSE;
}

static void
scratch_folder_manager_folder_item_finalize (GObject * obj)
{
	ScratchFolderManagerFolderItem * self;
	GFileMonitor* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, ScratchFolderManagerFolderItem);
	_tmp0_ = self->priv->monitor;
	g_file_monitor_cancel (_tmp0_);
	_g_object_unref0 (self->priv->monitor);
	_g_object_unref0 (self->priv->dummy);
	G_OBJECT_CLASS (scratch_folder_manager_folder_item_parent_class)->finalize (obj);
}

/**
     * Expandable item in the source list, represents a folder.
     * Monitored for changes inside the directory.
     */
 G_GNUC_NO_INLINE static GType
scratch_folder_manager_folder_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ScratchFolderManagerFolderItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) scratch_folder_manager_folder_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScratchFolderManagerFolderItem), 0, (GInstanceInitFunc) scratch_folder_manager_folder_item_instance_init, NULL };
	GType scratch_folder_manager_folder_item_type_id;
	scratch_folder_manager_folder_item_type_id = g_type_register_static (SCRATCH_FOLDER_MANAGER_TYPE_ITEM, "ScratchFolderManagerFolderItem", &g_define_type_info, G_TYPE_FLAG_NONE);
	ScratchFolderManagerFolderItem_private_offset = g_type_add_instance_private (scratch_folder_manager_folder_item_type_id, sizeof (ScratchFolderManagerFolderItemPrivate));
	return scratch_folder_manager_folder_item_type_id;
}

GType
scratch_folder_manager_folder_item_get_type (void)
{
	static gsize scratch_folder_manager_folder_item_type_id__once = 0;
	if (g_once_init_enter (&scratch_folder_manager_folder_item_type_id__once)) {
		GType scratch_folder_manager_folder_item_type_id;
		scratch_folder_manager_folder_item_type_id = scratch_folder_manager_folder_item_get_type_once ();
		g_once_init_leave (&scratch_folder_manager_folder_item_type_id__once, scratch_folder_manager_folder_item_type_id);
	}
	return scratch_folder_manager_folder_item_type_id__once;
}

static void
_vala_scratch_folder_manager_folder_item_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	ScratchFolderManagerFolderItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_FOLDER_MANAGER_TYPE_FOLDER_ITEM, ScratchFolderManagerFolderItem);
	switch (property_id) {
		case SCRATCH_FOLDER_MANAGER_FOLDER_ITEM_LOADING_REQUIRED_PROPERTY:
		g_value_set_boolean (value, scratch_folder_manager_folder_item_get_loading_required (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

