/* themes.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from themes.vala, do not modify */

/*
 * This file is part of budgie-desktop
 *
 * Copyright Budgie Desktop Developers
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib/gstdio.h>

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

typedef enum  {
	THEME_TYPE_ICON_THEME,
	THEME_TYPE_GTK_THEME,
	THEME_TYPE_CURSOR_THEME
} ThemeType;

#define TYPE_THEME_TYPE (theme_type_get_type ())

#define TYPE_THEME_INFO (theme_info_get_type ())
#define THEME_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME_INFO, ThemeInfo))
#define THEME_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME_INFO, ThemeInfoClass))
#define IS_THEME_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME_INFO))
#define IS_THEME_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME_INFO))
#define THEME_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME_INFO, ThemeInfoClass))

typedef struct _ThemeInfo ThemeInfo;
typedef struct _ThemeInfoClass ThemeInfoClass;
typedef struct _ThemeInfoPrivate ThemeInfoPrivate;
enum  {
	THEME_INFO_0_PROPERTY,
	THEME_INFO_NUM_PROPERTIES
};
static GParamSpec* theme_info_properties[THEME_INFO_NUM_PROPERTIES];

#define TYPE_THEME_SCANNER (theme_scanner_get_type ())
#define THEME_SCANNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME_SCANNER, ThemeScanner))
#define THEME_SCANNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME_SCANNER, ThemeScannerClass))
#define IS_THEME_SCANNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME_SCANNER))
#define IS_THEME_SCANNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME_SCANNER))
#define THEME_SCANNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME_SCANNER, ThemeScannerClass))

typedef struct _ThemeScanner ThemeScanner;
typedef struct _ThemeScannerClass ThemeScannerClass;
typedef struct _ThemeScannerPrivate ThemeScannerPrivate;
enum  {
	THEME_SCANNER_0_PROPERTY,
	THEME_SCANNER_NUM_PROPERTIES
};
static GParamSpec* theme_scanner_properties[THEME_SCANNER_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ThemeScannerScanThemesData ThemeScannerScanThemesData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ThemeScannerScanThemesDirData ThemeScannerScanThemesDirData;
typedef struct _ThemeScannerScanOneData ThemeScannerScanOneData;
typedef struct _ThemeScannerMaybeAddGtkThemeData ThemeScannerMaybeAddGtkThemeData;
#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
typedef struct _ThemeScannerMaybeAddIconThemeData ThemeScannerMaybeAddIconThemeData;
typedef struct _ThemeScannerMaybeAddCursorsData ThemeScannerMaybeAddCursorsData;
typedef struct _ThemeScannerMaybeAddIconsData ThemeScannerMaybeAddIconsData;

struct _ThemeInfo {
	GObject parent_instance;
	ThemeInfoPrivate * priv;
};

struct _ThemeInfoClass {
	GObjectClass parent_class;
};

struct _ThemeInfoPrivate {
	ThemeType theme_type;
	GList* paths;
};

struct _ThemeScanner {
	GObject parent_instance;
	ThemeScannerPrivate * priv;
};

struct _ThemeScannerClass {
	GObjectClass parent_class;
};

struct _ThemeScannerPrivate {
	gchar** xdg_paths;
	gint xdg_paths_length1;
	gint _xdg_paths_size_;
	gchar** gtk_theme_blacklist;
	gint gtk_theme_blacklist_length1;
	gint _gtk_theme_blacklist_size_;
	gchar** icon_theme_blacklist;
	gint icon_theme_blacklist_length1;
	gint _icon_theme_blacklist_size_;
	gchar** normal_suffixes;
	gint normal_suffixes_length1;
	gint _normal_suffixes_size_;
	gchar** legacy_suffixes;
	gint legacy_suffixes_length1;
	gint _legacy_suffixes_size_;
	gchar** gtk_theme_paths;
	gint gtk_theme_paths_length1;
	gint _gtk_theme_paths_size_;
	GHashTable* gtk_themes;
	GHashTable* cursor_themes;
	GHashTable* icon_themes;
};

struct _ThemeScannerScanThemesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ThemeScanner* self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** xdg_path_collection;
	gint xdg_path_collection_length1;
	gint _xdg_path_collection_size_;
	gint xdg_path_it;
	gchar* _tmp1_;
	gchar* xdg_path;
	const gchar* _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar* home_dir;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	const gchar* _tmp11_;
	gchar** _tmp12_;
	gint _tmp12__length1;
};

struct _ThemeScannerScanThemesDirData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ThemeScanner* self;
	gchar* base_dir;
	gchar** suffixes;
	gint suffixes_length1;
	gchar** suffix_collection;
	gint suffix_collection_length1;
	gint _suffix_collection_size_;
	gint suffix_it;
	gchar* _tmp0_;
	gchar* suffix;
	gchar* full_path;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	GFile* f;
	const gchar* _tmp4_;
	GFile* _tmp5_;
	GFileEnumerator* en;
	GFile* _tmp6_;
	GFileEnumerator* _tmp7_;
	GList* files;
	GFileEnumerator* _tmp8_;
	GList* _tmp9_;
	GList* _tmp10_;
	GList* _tmp11_;
	GList* file_collection;
	GList* file_it;
	GFileInfo* _tmp12_;
	GFileInfo* file;
	gchar* display_path;
	GFileInfo* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* sep;
	gchar* _tmp16_;
	gchar* path;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	GError* e;
	GError* _tmp24_;
	const gchar* _tmp25_;
	GError* _inner_error0_;
};

struct _ThemeScannerScanOneData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ThemeScanner* self;
	gchar* path_type;
	gchar* full_path;
	gchar* display_name;
	gboolean gtk_theme;
	gboolean _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** suffix_collection;
	gint suffix_collection_length1;
	gint _suffix_collection_size_;
	gint suffix_it;
	gchar* _tmp2_;
	gchar* suffix;
	gchar* path;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gboolean added;
	const gchar* _tmp5_;
};

struct _ThemeScannerMaybeAddGtkThemeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ThemeScanner* self;
	gchar* path;
	gchar* theme_name;
	gboolean result;
	gchar* test_path;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gint index;
	gboolean _tmp2_;
	gint _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gchar* blacklisted_item;
	gchar** _tmp5_;
	gint _tmp5__length1;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gboolean _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	ThemeInfo* info;
	GHashTable* _tmp11_;
	gconstpointer _tmp12_;
	ThemeInfo* _tmp13_;
	ThemeInfo* ninfo;
	ThemeInfo* _tmp14_;
	GHashTable* _tmp15_;
	gchar* _tmp16_;
	ThemeInfo* _tmp17_;
	ThemeInfo* _tmp18_;
	GHashTable* _tmp19_;
	gconstpointer _tmp20_;
	ThemeInfo* _tmp21_;
};

struct _ThemeScannerMaybeAddIconThemeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ThemeScanner* self;
	gchar* path;
	gchar* theme_name;
	gchar* test_path;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gboolean icon_theme;
	GKeyFile* f;
	GKeyFile* _tmp2_;
	GKeyFile* _tmp3_;
	const gchar* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	GKeyFile* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	GKeyFile* _tmp10_;
	gboolean _tmp11_;
	GKeyFile* _tmp12_;
	gchar* cursor_path;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	GError* _inner_error0_;
};

struct _ThemeScannerMaybeAddCursorsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ThemeScanner* self;
	gchar* path;
	gchar* theme_name;
	gboolean result;
	ThemeInfo* info;
	GHashTable* _tmp0_;
	gconstpointer _tmp1_;
	ThemeInfo* _tmp2_;
	ThemeInfo* ninfo;
	ThemeInfo* _tmp3_;
	GHashTable* _tmp4_;
	gchar* _tmp5_;
	ThemeInfo* _tmp6_;
	ThemeInfo* _tmp7_;
	GHashTable* _tmp8_;
	gconstpointer _tmp9_;
	ThemeInfo* _tmp10_;
};

struct _ThemeScannerMaybeAddIconsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ThemeScanner* self;
	gchar* path;
	gchar* theme_name;
	gboolean result;
	gint index;
	gboolean _tmp0_;
	gint _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar* blacklisted_item;
	gchar** _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	ThemeInfo* info;
	GHashTable* _tmp9_;
	gconstpointer _tmp10_;
	ThemeInfo* _tmp11_;
	ThemeInfo* ninfo;
	ThemeInfo* _tmp12_;
	GHashTable* _tmp13_;
	gchar* _tmp14_;
	ThemeInfo* _tmp15_;
	ThemeInfo* _tmp16_;
	GHashTable* _tmp17_;
	gconstpointer _tmp18_;
	ThemeInfo* _tmp19_;
};

static gint ThemeInfo_private_offset;
static gpointer theme_info_parent_class = NULL;
static gint ThemeScanner_private_offset;
static gpointer theme_scanner_parent_class = NULL;

VALA_EXTERN GType theme_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType theme_info_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ThemeInfo, g_object_unref)
static void _g_free0_ (gpointer var);
static inline void _g_list_free__g_free0_ (GList* self);
VALA_EXTERN ThemeInfo* theme_info_new (ThemeType type);
VALA_EXTERN ThemeInfo* theme_info_construct (GType object_type,
                                 ThemeType type);
VALA_EXTERN gboolean theme_info_add_path (ThemeInfo* self,
                              const gchar* path);
VALA_EXTERN gboolean theme_info_contains_path (ThemeInfo* self,
                                   const gchar* path);
static void theme_info_finalize (GObject * obj);
static GType theme_info_get_type_once (void);
VALA_EXTERN GType theme_scanner_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ThemeScanner, g_object_unref)
VALA_EXTERN ThemeScanner* theme_scanner_new (void);
VALA_EXTERN ThemeScanner* theme_scanner_construct (GType object_type);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static void _vala_array_add6 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _g_object_unref0_ (gpointer var);
static void theme_scanner_scan_themes_data_free (gpointer _data);
VALA_EXTERN void theme_scanner_scan_themes (ThemeScanner* self,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void theme_scanner_scan_themes_finish (ThemeScanner* self,
                                       GAsyncResult* _res_);
static gboolean theme_scanner_scan_themes_co (ThemeScannerScanThemesData* _data_);
static void theme_scanner_scan_themes_dir (ThemeScanner* self,
                                    const gchar* base_dir,
                                    gchar** suffixes,
                                    gint suffixes_length1,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void theme_scanner_scan_themes_dir_finish (ThemeScanner* self,
                                           GAsyncResult* _res_);
static void theme_scanner_scan_themes_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_);
static void theme_scanner_scan_themes_dir_data_free (gpointer _data);
static gboolean theme_scanner_scan_themes_dir_co (ThemeScannerScanThemesDirData* _data_);
static void theme_scanner_scan_themes_dir_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void theme_scanner_scan_one (ThemeScanner* self,
                             const gchar* path_type,
                             const gchar* full_path,
                             const gchar* display_name,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_);
static void theme_scanner_scan_one_finish (ThemeScanner* self,
                                    GAsyncResult* _res_);
static void theme_scanner_scan_one_data_free (gpointer _data);
static gboolean theme_scanner_scan_one_co (ThemeScannerScanOneData* _data_);
static void theme_scanner_maybe_add_gtk_theme (ThemeScanner* self,
                                        const gchar* path,
                                        const gchar* theme_name,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static gboolean theme_scanner_maybe_add_gtk_theme_finish (ThemeScanner* self,
                                                   GAsyncResult* _res_);
static void theme_scanner_scan_one_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_);
static void theme_scanner_maybe_add_icon_theme (ThemeScanner* self,
                                         const gchar* path,
                                         const gchar* theme_name,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void theme_scanner_maybe_add_icon_theme_finish (ThemeScanner* self,
                                                GAsyncResult* _res_);
static void theme_scanner_maybe_add_gtk_theme_data_free (gpointer _data);
static gboolean theme_scanner_maybe_add_gtk_theme_co (ThemeScannerMaybeAddGtkThemeData* _data_);
VALA_EXTERN gchar** theme_scanner_get_gtk_themes (ThemeScanner* self,
                                      gint* result_length1);
static void _vala_array_add7 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
VALA_EXTERN gchar** theme_scanner_get_cursor_themes (ThemeScanner* self,
                                         gint* result_length1);
static void _vala_array_add8 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
VALA_EXTERN gchar** theme_scanner_get_icon_themes (ThemeScanner* self,
                                       gint* result_length1);
static void _vala_array_add9 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void theme_scanner_maybe_add_icon_theme_data_free (gpointer _data);
static gboolean theme_scanner_maybe_add_icon_theme_co (ThemeScannerMaybeAddIconThemeData* _data_);
static void theme_scanner_maybe_add_icons (ThemeScanner* self,
                                    const gchar* path,
                                    const gchar* theme_name,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static gboolean theme_scanner_maybe_add_icons_finish (ThemeScanner* self,
                                               GAsyncResult* _res_);
static void theme_scanner_maybe_add_icon_theme_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void theme_scanner_maybe_add_cursors (ThemeScanner* self,
                                      const gchar* path,
                                      const gchar* theme_name,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
static gboolean theme_scanner_maybe_add_cursors_finish (ThemeScanner* self,
                                                 GAsyncResult* _res_);
static void theme_scanner_maybe_add_cursors_data_free (gpointer _data);
static gboolean theme_scanner_maybe_add_cursors_co (ThemeScannerMaybeAddCursorsData* _data_);
static void theme_scanner_maybe_add_icons_data_free (gpointer _data);
static gboolean theme_scanner_maybe_add_icons_co (ThemeScannerMaybeAddIconsData* _data_);
static void theme_scanner_finalize (GObject * obj);
static GType theme_scanner_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static GType
theme_type_get_type_once (void)
{
	static const GEnumValue values[] = {{THEME_TYPE_ICON_THEME, "THEME_TYPE_ICON_THEME", "icon-theme"}, {THEME_TYPE_GTK_THEME, "THEME_TYPE_GTK_THEME", "gtk-theme"}, {THEME_TYPE_CURSOR_THEME, "THEME_TYPE_CURSOR_THEME", "cursor-theme"}, {0, NULL, NULL}};
	GType theme_type_type_id;
	theme_type_type_id = g_enum_register_static ("ThemeType", values);
	return theme_type_type_id;
}

GType
theme_type_get_type (void)
{
	static volatile gsize theme_type_type_id__once = 0;
	if (g_once_init_enter (&theme_type_type_id__once)) {
		GType theme_type_type_id;
		theme_type_type_id = theme_type_get_type_once ();
		g_once_init_leave (&theme_type_type_id__once, theme_type_type_id);
	}
	return theme_type_type_id__once;
}

static inline gpointer
theme_info_get_instance_private (ThemeInfo* self)
{
	return G_STRUCT_MEMBER_P (self, ThemeInfo_private_offset);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static inline void
_g_list_free__g_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_free0_);
}

ThemeInfo*
theme_info_construct (GType object_type,
                      ThemeType type)
{
	ThemeInfo * self = NULL;
	self = (ThemeInfo*) g_object_new (object_type, NULL);
	self->priv->theme_type = type;
	(self->priv->paths == NULL) ? NULL : (self->priv->paths = (_g_list_free__g_free0_ (self->priv->paths), NULL));
	self->priv->paths = NULL;
	return self;
}

ThemeInfo*
theme_info_new (ThemeType type)
{
	return theme_info_construct (TYPE_THEME_INFO, type);
}

/**
 * Try to add a path
 */
gboolean
theme_info_add_path (ThemeInfo* self,
                     const gchar* path)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	if (theme_info_contains_path (self, path)) {
		result = FALSE;
		return result;
	}
	_tmp0_ = g_strdup (path);
	self->priv->paths = g_list_append (self->priv->paths, _tmp0_);
	result = TRUE;
	return result;
}

gboolean
theme_info_contains_path (ThemeInfo* self,
                          const gchar* path)
{
	GList* g = NULL;
	GList* _tmp0_;
	GCompareFunc _tmp1_;
	GList* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	_tmp0_ = self->priv->paths;
	_tmp1_ = ((GCompareFunc) g_strcmp0);
	_tmp2_ = g_list_find_custom (_tmp0_, path, _tmp1_);
	g = _tmp2_;
	result = g != NULL;
	return result;
}

static void
theme_info_class_init (ThemeInfoClass * klass,
                       gpointer klass_data)
{
	theme_info_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ThemeInfo_private_offset);
	G_OBJECT_CLASS (klass)->finalize = theme_info_finalize;
}

static void
theme_info_instance_init (ThemeInfo * self,
                          gpointer klass)
{
	self->priv = theme_info_get_instance_private (self);
}

static void
theme_info_finalize (GObject * obj)
{
	ThemeInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_THEME_INFO, ThemeInfo);
	(self->priv->paths == NULL) ? NULL : (self->priv->paths = (_g_list_free__g_free0_ (self->priv->paths), NULL));
	G_OBJECT_CLASS (theme_info_parent_class)->finalize (obj);
}

static GType
theme_info_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ThemeInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) theme_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ThemeInfo), 0, (GInstanceInitFunc) theme_info_instance_init, NULL };
	GType theme_info_type_id;
	theme_info_type_id = g_type_register_static (G_TYPE_OBJECT, "ThemeInfo", &g_define_type_info, 0);
	ThemeInfo_private_offset = g_type_add_instance_private (theme_info_type_id, sizeof (ThemeInfoPrivate));
	return theme_info_type_id;
}

GType
theme_info_get_type (void)
{
	static volatile gsize theme_info_type_id__once = 0;
	if (g_once_init_enter (&theme_info_type_id__once)) {
		GType theme_info_type_id;
		theme_info_type_id = theme_info_get_type_once ();
		g_once_init_leave (&theme_info_type_id__once, theme_info_type_id);
	}
	return theme_info_type_id__once;
}

static inline gpointer
theme_scanner_get_instance_private (ThemeScanner* self)
{
	return G_STRUCT_MEMBER_P (self, ThemeScanner_private_offset);
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

static void
_vala_array_add6 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

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

ThemeScanner*
theme_scanner_construct (GType object_type)
{
	ThemeScanner * self = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar** _tmp12_;
	GHashFunc _tmp13_;
	GEqualFunc _tmp14_;
	GHashTable* _tmp15_;
	GHashFunc _tmp16_;
	GEqualFunc _tmp17_;
	GHashTable* _tmp18_;
	GHashFunc _tmp19_;
	GEqualFunc _tmp20_;
	GHashTable* _tmp21_;
	self = (ThemeScanner*) g_object_new (object_type, NULL);
	_tmp0_ = g_get_user_data_dir ();
	_tmp1_ = g_strdup (_tmp0_);
	_tmp2_ = g_new0 (gchar*, 1 + 1);
	_tmp2_[0] = _tmp1_;
	self->priv->xdg_paths = (_vala_array_free (self->priv->xdg_paths, self->priv->xdg_paths_length1, (GDestroyNotify) g_free), NULL);
	self->priv->xdg_paths = _tmp2_;
	self->priv->xdg_paths_length1 = 1;
	self->priv->_xdg_paths_size_ = self->priv->xdg_paths_length1;
	_tmp4_ = _tmp3_ = g_get_system_data_dirs ();
	{
		gchar** item_collection = NULL;
		gint item_collection_length1 = 0;
		gint _item_collection_size_ = 0;
		gint item_it = 0;
		item_collection = _tmp4_;
		item_collection_length1 = _vala_array_length (_tmp3_);
		for (item_it = 0; item_it < item_collection_length1; item_it = item_it + 1) {
			gchar* _tmp5_;
			gchar* item = NULL;
			_tmp5_ = g_strdup (item_collection[item_it]);
			item = _tmp5_;
			{
				const gchar* _tmp6_;
				gchar** _tmp7_;
				gint _tmp7__length1;
				const gchar* _tmp8_;
				gchar* _tmp9_;
				_tmp6_ = item;
				_tmp7_ = self->priv->xdg_paths;
				_tmp7__length1 = self->priv->xdg_paths_length1;
				if (_vala_string_array_contains (_tmp7_, _tmp7__length1, _tmp6_)) {
					_g_free0 (item);
					continue;
				}
				_tmp8_ = item;
				_tmp9_ = g_strdup (_tmp8_);
				_vala_array_add6 (&self->priv->xdg_paths, &self->priv->xdg_paths_length1, &self->priv->_xdg_paths_size_, _tmp9_);
				_g_free0 (item);
			}
		}
	}
	_tmp10_ = g_strdup_printf ("gtk-%d.0", GTK_MAJOR_VERSION);
	_tmp11_ = g_strdup_printf ("gtk-%d-%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION);
	_tmp12_ = g_new0 (gchar*, 2 + 1);
	_tmp12_[0] = _tmp10_;
	_tmp12_[1] = _tmp11_;
	self->priv->gtk_theme_paths = (_vala_array_free (self->priv->gtk_theme_paths, self->priv->gtk_theme_paths_length1, (GDestroyNotify) g_free), NULL);
	self->priv->gtk_theme_paths = _tmp12_;
	self->priv->gtk_theme_paths_length1 = 2;
	self->priv->_gtk_theme_paths_size_ = self->priv->gtk_theme_paths_length1;
	_tmp13_ = g_str_hash;
	_tmp14_ = g_str_equal;
	_tmp15_ = g_hash_table_new_full (_tmp13_, _tmp14_, _g_free0_, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->gtk_themes);
	self->priv->gtk_themes = _tmp15_;
	_tmp16_ = g_str_hash;
	_tmp17_ = g_str_equal;
	_tmp18_ = g_hash_table_new_full (_tmp16_, _tmp17_, _g_free0_, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->cursor_themes);
	self->priv->cursor_themes = _tmp18_;
	_tmp19_ = g_str_hash;
	_tmp20_ = g_str_equal;
	_tmp21_ = g_hash_table_new_full (_tmp19_, _tmp20_, _g_free0_, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->icon_themes);
	self->priv->icon_themes = _tmp21_;
	return self;
}

ThemeScanner*
theme_scanner_new (void)
{
	return theme_scanner_construct (TYPE_THEME_SCANNER);
}

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

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

void
theme_scanner_scan_themes (ThemeScanner* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	ThemeScannerScanThemesData* _data_;
	ThemeScanner* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ThemeScannerScanThemesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, theme_scanner_scan_themes_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	theme_scanner_scan_themes_co (_data_);
}

void
theme_scanner_scan_themes_finish (ThemeScanner* self,
                                  GAsyncResult* _res_)
{
	ThemeScannerScanThemesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/**
 * Scan all theme types
 */
static void
theme_scanner_scan_themes_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_)
{
	ThemeScannerScanThemesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	theme_scanner_scan_themes_co (_data_);
}

static gboolean
theme_scanner_scan_themes_co (ThemeScannerScanThemesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->xdg_paths;
	_data_->_tmp0__length1 = _data_->self->priv->xdg_paths_length1;
	{
		_data_->xdg_path_collection_length1 = 0;
		_data_->_xdg_path_collection_size_ = 0;
		_data_->xdg_path_collection = _data_->_tmp0_;
		_data_->xdg_path_collection_length1 = _data_->_tmp0__length1;
		for (_data_->xdg_path_it = 0; _data_->xdg_path_it < _data_->xdg_path_collection_length1; _data_->xdg_path_it = _data_->xdg_path_it + 1) {
			_data_->_tmp1_ = g_strdup (_data_->xdg_path_collection[_data_->xdg_path_it]);
			_data_->xdg_path = _data_->_tmp1_;
			{
				_data_->_tmp2_ = _data_->xdg_path;
				_data_->_tmp3_ = _data_->self->priv->normal_suffixes;
				_data_->_tmp3__length1 = _data_->self->priv->normal_suffixes_length1;
				_data_->_state_ = 1;
				theme_scanner_scan_themes_dir (_data_->self, _data_->_tmp2_, _data_->_tmp3_, (gint) _data_->_tmp3__length1, theme_scanner_scan_themes_ready, _data_);
				return FALSE;
				_state_1:
				theme_scanner_scan_themes_dir_finish (_data_->self, _data_->_res_);
				_g_free0 (_data_->xdg_path);
			}
		}
	}
	_data_->_tmp4_ = g_get_home_dir ();
	_data_->_tmp5_ = g_strdup (_data_->_tmp4_);
	_data_->home_dir = _data_->_tmp5_;
	_data_->_tmp7_ = _data_->home_dir;
	if (_data_->_tmp7_ == NULL) {
		_data_->_tmp6_ = TRUE;
	} else {
		_data_->_tmp8_ = _data_->home_dir;
		_data_->_tmp9_ = strlen (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp6_ = _data_->_tmp10_ < 1;
	}
	if (_data_->_tmp6_) {
		_g_free0 (_data_->home_dir);
		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;
	}
	_data_->_tmp11_ = _data_->home_dir;
	_data_->_tmp12_ = _data_->self->priv->legacy_suffixes;
	_data_->_tmp12__length1 = _data_->self->priv->legacy_suffixes_length1;
	_data_->_state_ = 2;
	theme_scanner_scan_themes_dir (_data_->self, _data_->_tmp11_, _data_->_tmp12_, (gint) _data_->_tmp12__length1, theme_scanner_scan_themes_ready, _data_);
	return FALSE;
	_state_2:
	theme_scanner_scan_themes_dir_finish (_data_->self, _data_->_res_);
	_g_free0 (_data_->home_dir);
	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
theme_scanner_scan_themes_dir_data_free (gpointer _data)
{
	ThemeScannerScanThemesDirData* _data_;
	_data_ = _data;
	_g_free0 (_data_->base_dir);
	_g_object_unref0 (_data_->self);
	g_slice_free (ThemeScannerScanThemesDirData, _data_);
}

static void
theme_scanner_scan_themes_dir (ThemeScanner* self,
                               const gchar* base_dir,
                               gchar** suffixes,
                               gint suffixes_length1,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	ThemeScannerScanThemesDirData* _data_;
	ThemeScanner* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (base_dir != NULL);
	_data_ = g_slice_new0 (ThemeScannerScanThemesDirData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, theme_scanner_scan_themes_dir_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (base_dir);
	_g_free0 (_data_->base_dir);
	_data_->base_dir = _tmp1_;
	_data_->suffixes = suffixes;
	_data_->suffixes_length1 = suffixes_length1;
	theme_scanner_scan_themes_dir_co (_data_);
}

static void
theme_scanner_scan_themes_dir_finish (ThemeScanner* self,
                                      GAsyncResult* _res_)
{
	ThemeScannerScanThemesDirData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/**
 * Scan a directory for all theme types
 */
static void
theme_scanner_scan_themes_dir_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	ThemeScannerScanThemesDirData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	theme_scanner_scan_themes_dir_co (_data_);
}

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

static gboolean
theme_scanner_scan_themes_dir_co (ThemeScannerScanThemesDirData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!g_file_test (_data_->base_dir, G_FILE_TEST_IS_DIR)) {
		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;
	}
	{
		{
			_data_->suffix_collection_length1 = 0;
			_data_->_suffix_collection_size_ = 0;
			_data_->suffix_collection = _data_->suffixes;
			_data_->suffix_collection_length1 = _data_->suffixes_length1;
			for (_data_->suffix_it = 0; _data_->suffix_it < _data_->suffix_collection_length1; _data_->suffix_it = _data_->suffix_it + 1) {
				_data_->_tmp0_ = g_strdup (_data_->suffix_collection[_data_->suffix_it]);
				_data_->suffix = _data_->_tmp0_;
				{
					_data_->_tmp1_ = _data_->suffix;
					_data_->_tmp2_ = g_strdup_printf ("%s%s%s", _data_->base_dir, G_DIR_SEPARATOR_S, _data_->_tmp1_);
					_data_->full_path = _data_->_tmp2_;
					_data_->_tmp3_ = _data_->full_path;
					if (!g_file_test (_data_->_tmp3_, G_FILE_TEST_IS_DIR)) {
						_g_free0 (_data_->full_path);
						_g_free0 (_data_->suffix);
						continue;
					}
					_data_->_tmp4_ = _data_->full_path;
					_data_->_tmp5_ = g_file_new_for_path (_data_->_tmp4_);
					_data_->f = _data_->_tmp5_;
					_data_->_tmp6_ = _data_->f;
					_data_->_state_ = 1;
					g_file_enumerate_children_async (_data_->_tmp6_, "standard::*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, G_PRIORITY_DEFAULT, NULL, theme_scanner_scan_themes_dir_ready, _data_);
					return FALSE;
					_state_1:
					_data_->_tmp7_ = g_file_enumerate_children_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error0_);
					_data_->en = _data_->_tmp7_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						_g_object_unref0 (_data_->f);
						_g_free0 (_data_->full_path);
						_g_free0 (_data_->suffix);
						goto __catch0_g_error;
					}
					while (TRUE) {
						_data_->_tmp8_ = _data_->en;
						_data_->_state_ = 2;
						g_file_enumerator_next_files_async (_data_->_tmp8_, 10, G_PRIORITY_DEFAULT, NULL, theme_scanner_scan_themes_dir_ready, _data_);
						return FALSE;
						_state_2:
						_data_->_tmp9_ = g_file_enumerator_next_files_finish (_data_->_tmp8_, _data_->_res_, &_data_->_inner_error0_);
						_data_->files = _data_->_tmp9_;
						if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
							_g_object_unref0 (_data_->en);
							_g_object_unref0 (_data_->f);
							_g_free0 (_data_->full_path);
							_g_free0 (_data_->suffix);
							goto __catch0_g_error;
						}
						_data_->_tmp10_ = _data_->files;
						if (_data_->_tmp10_ == NULL) {
							(_data_->files == NULL) ? NULL : (_data_->files = (_g_list_free__g_object_unref0_ (_data_->files), NULL));
							break;
						}
						_data_->_tmp11_ = _data_->files;
						{
							_data_->file_collection = _data_->_tmp11_;
							for (_data_->file_it = _data_->file_collection; _data_->file_it != NULL; _data_->file_it = _data_->file_it->next) {
								_data_->_tmp12_ = _g_object_ref0 ((GFileInfo*) _data_->file_it->data);
								_data_->file = _data_->_tmp12_;
								{
									_data_->_tmp13_ = _data_->file;
									_data_->_tmp14_ = g_file_info_get_display_name (_data_->_tmp13_);
									_data_->_tmp15_ = g_strdup (_data_->_tmp14_);
									_data_->display_path = _data_->_tmp15_;
									_data_->_tmp16_ = g_strdup (G_DIR_SEPARATOR_S);
									_data_->sep = _data_->_tmp16_;
									_data_->_tmp17_ = _data_->full_path;
									_data_->_tmp18_ = _data_->sep;
									_data_->_tmp19_ = _data_->display_path;
									_data_->_tmp20_ = g_strdup_printf ("%s%s%s", _data_->_tmp17_, _data_->_tmp18_, _data_->_tmp19_);
									_data_->path = _data_->_tmp20_;
									_data_->_tmp21_ = _data_->suffix;
									_data_->_tmp22_ = _data_->path;
									_data_->_tmp23_ = _data_->display_path;
									_data_->_state_ = 3;
									theme_scanner_scan_one (_data_->self, _data_->_tmp21_, _data_->_tmp22_, _data_->_tmp23_, theme_scanner_scan_themes_dir_ready, _data_);
									return FALSE;
									_state_3:
									theme_scanner_scan_one_finish (_data_->self, _data_->_res_);
									_g_free0 (_data_->path);
									_g_free0 (_data_->sep);
									_g_free0 (_data_->display_path);
									_g_object_unref0 (_data_->file);
								}
							}
						}
						(_data_->files == NULL) ? NULL : (_data_->files = (_g_list_free__g_object_unref0_ (_data_->files), NULL));
					}
					_g_object_unref0 (_data_->en);
					_g_object_unref0 (_data_->f);
					_g_free0 (_data_->full_path);
					_g_free0 (_data_->suffix);
				}
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp24_ = _data_->e;
		_data_->_tmp25_ = _data_->_tmp24_->message;
		g_message ("themes.vala:159: Error in scan_themes_dir: %s\n", _data_->_tmp25_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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
theme_scanner_scan_one_data_free (gpointer _data)
{
	ThemeScannerScanOneData* _data_;
	_data_ = _data;
	_g_free0 (_data_->path_type);
	_g_free0 (_data_->full_path);
	_g_free0 (_data_->display_name);
	_g_object_unref0 (_data_->self);
	g_slice_free (ThemeScannerScanOneData, _data_);
}

static void
theme_scanner_scan_one (ThemeScanner* self,
                        const gchar* path_type,
                        const gchar* full_path,
                        const gchar* display_name,
                        GAsyncReadyCallback _callback_,
                        gpointer _user_data_)
{
	ThemeScannerScanOneData* _data_;
	ThemeScanner* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path_type != NULL);
	g_return_if_fail (full_path != NULL);
	g_return_if_fail (display_name != NULL);
	_data_ = g_slice_new0 (ThemeScannerScanOneData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, theme_scanner_scan_one_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (path_type);
	_g_free0 (_data_->path_type);
	_data_->path_type = _tmp1_;
	_tmp2_ = g_strdup (full_path);
	_g_free0 (_data_->full_path);
	_data_->full_path = _tmp2_;
	_tmp3_ = g_strdup (display_name);
	_g_free0 (_data_->display_name);
	_data_->display_name = _tmp3_;
	theme_scanner_scan_one_co (_data_);
}

static void
theme_scanner_scan_one_finish (ThemeScanner* self,
                               GAsyncResult* _res_)
{
	ThemeScannerScanOneData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/**
 * Scan one directory with the given type, i.e. "icons", or "themes"
 */
static void
theme_scanner_scan_one_ready (GObject* source_object,
                              GAsyncResult* _res_,
                              gpointer _user_data_)
{
	ThemeScannerScanOneData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	theme_scanner_scan_one_co (_data_);
}

static gboolean
theme_scanner_scan_one_co (ThemeScannerScanOneData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->gtk_theme = FALSE;
	if (g_strcmp0 (_data_->path_type, "themes") == 0) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp0_ = g_strcmp0 (_data_->path_type, ".themes") == 0;
	}
	if (_data_->_tmp0_) {
		_data_->gtk_theme = TRUE;
	}
	if (_data_->gtk_theme) {
		_data_->_tmp1_ = _data_->self->priv->gtk_theme_paths;
		_data_->_tmp1__length1 = _data_->self->priv->gtk_theme_paths_length1;
		{
			_data_->suffix_collection_length1 = 0;
			_data_->_suffix_collection_size_ = 0;
			_data_->suffix_collection = _data_->_tmp1_;
			_data_->suffix_collection_length1 = _data_->_tmp1__length1;
			for (_data_->suffix_it = 0; _data_->suffix_it < _data_->suffix_collection_length1; _data_->suffix_it = _data_->suffix_it + 1) {
				_data_->_tmp2_ = g_strdup (_data_->suffix_collection[_data_->suffix_it]);
				_data_->suffix = _data_->_tmp2_;
				{
					_data_->_tmp3_ = _data_->suffix;
					_data_->_tmp4_ = g_strdup_printf ("%s%s%s", _data_->full_path, G_DIR_SEPARATOR_S, _data_->_tmp3_);
					_data_->path = _data_->_tmp4_;
					_data_->_tmp5_ = _data_->path;
					_data_->_state_ = 1;
					theme_scanner_maybe_add_gtk_theme (_data_->self, _data_->_tmp5_, _data_->display_name, theme_scanner_scan_one_ready, _data_);
					return FALSE;
					_state_1:
					_data_->added = theme_scanner_maybe_add_gtk_theme_finish (_data_->self, _data_->_res_);
					if (_data_->added) {
						_g_free0 (_data_->path);
						_g_free0 (_data_->suffix);
						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;
					}
					_g_free0 (_data_->path);
					_g_free0 (_data_->suffix);
				}
			}
		}
	} else {
		_data_->_state_ = 2;
		theme_scanner_maybe_add_icon_theme (_data_->self, _data_->full_path, _data_->display_name, theme_scanner_scan_one_ready, _data_);
		return FALSE;
		_state_2:
		theme_scanner_maybe_add_icon_theme_finish (_data_->self, _data_->_res_);
	}
	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
theme_scanner_maybe_add_gtk_theme_data_free (gpointer _data)
{
	ThemeScannerMaybeAddGtkThemeData* _data_;
	_data_ = _data;
	_g_free0 (_data_->path);
	_g_free0 (_data_->theme_name);
	_g_object_unref0 (_data_->self);
	g_slice_free (ThemeScannerMaybeAddGtkThemeData, _data_);
}

static void
theme_scanner_maybe_add_gtk_theme (ThemeScanner* self,
                                   const gchar* path,
                                   const gchar* theme_name,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	ThemeScannerMaybeAddGtkThemeData* _data_;
	ThemeScanner* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	g_return_if_fail (theme_name != NULL);
	_data_ = g_slice_new0 (ThemeScannerMaybeAddGtkThemeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, theme_scanner_maybe_add_gtk_theme_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp1_;
	_tmp2_ = g_strdup (theme_name);
	_g_free0 (_data_->theme_name);
	_data_->theme_name = _tmp2_;
	theme_scanner_maybe_add_gtk_theme_co (_data_);
}

static gboolean
theme_scanner_maybe_add_gtk_theme_finish (ThemeScanner* self,
                                          GAsyncResult* _res_)
{
	gboolean result;
	ThemeScannerMaybeAddGtkThemeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

/**
 * Attempt to add a unique theme into the set
 */
static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (needle != NULL, 0);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gboolean
theme_scanner_maybe_add_gtk_theme_co (ThemeScannerMaybeAddGtkThemeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strdup_printf ("%s%s%s", _data_->path, G_DIR_SEPARATOR_S, "gtk.css");
	_data_->test_path = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->test_path;
	if (!g_file_test (_data_->_tmp1_, G_FILE_TEST_EXISTS)) {
		_data_->result = FALSE;
		_g_free0 (_data_->test_path);
		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;
	}
	{
		_data_->index = 0;
		{
			_data_->_tmp2_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp2_) {
					_data_->_tmp3_ = _data_->index;
					_data_->index = _data_->_tmp3_ + 1;
				}
				_data_->_tmp2_ = FALSE;
				_data_->_tmp4_ = _data_->self->priv->gtk_theme_blacklist;
				_data_->_tmp4__length1 = _data_->self->priv->gtk_theme_blacklist_length1;
				if (!(_data_->index < _data_->_tmp4__length1)) {
					break;
				}
				_data_->_tmp5_ = _data_->self->priv->gtk_theme_blacklist;
				_data_->_tmp5__length1 = _data_->self->priv->gtk_theme_blacklist_length1;
				_data_->_tmp6_ = _data_->_tmp5_[_data_->index];
				_data_->_tmp7_ = g_strdup (_data_->_tmp6_);
				_data_->blacklisted_item = _data_->_tmp7_;
				_data_->_tmp9_ = _data_->blacklisted_item;
				if (g_strcmp0 (_data_->_tmp9_, _data_->theme_name) == 0) {
					_data_->_tmp8_ = TRUE;
				} else {
					_data_->_tmp10_ = _data_->blacklisted_item;
					_data_->_tmp8_ = string_index_of (_data_->theme_name, _data_->_tmp10_, 0) != -1;
				}
				if (_data_->_tmp8_) {
					_data_->result = FALSE;
					_g_free0 (_data_->blacklisted_item);
					_g_free0 (_data_->test_path);
					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;
				}
				_g_free0 (_data_->blacklisted_item);
			}
		}
	}
	_data_->_tmp11_ = _data_->self->priv->gtk_themes;
	_data_->_tmp12_ = g_hash_table_lookup (_data_->_tmp11_, _data_->theme_name);
	_data_->info = (ThemeInfo*) _data_->_tmp12_;
	_data_->_tmp13_ = _data_->info;
	if (_data_->_tmp13_ == NULL) {
		_data_->_tmp14_ = theme_info_new (THEME_TYPE_GTK_THEME);
		_data_->ninfo = _data_->_tmp14_;
		_data_->_tmp15_ = _data_->self->priv->gtk_themes;
		_data_->_tmp16_ = g_strdup (_data_->theme_name);
		_data_->_tmp17_ = _data_->ninfo;
		_data_->_tmp18_ = _g_object_ref0 (_data_->_tmp17_);
		g_hash_table_insert (_data_->_tmp15_, _data_->_tmp16_, _data_->_tmp18_);
		_data_->_tmp19_ = _data_->self->priv->gtk_themes;
		_data_->_tmp20_ = g_hash_table_lookup (_data_->_tmp19_, _data_->theme_name);
		_data_->info = (ThemeInfo*) _data_->_tmp20_;
		_g_object_unref0 (_data_->ninfo);
	}
	_data_->_tmp21_ = _data_->info;
	if (theme_info_add_path (_data_->_tmp21_, _data_->path)) {
		_data_->result = TRUE;
		_g_free0 (_data_->test_path);
		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;
	}
	_data_->result = FALSE;
	_g_free0 (_data_->test_path);
	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;
}

/**
 * Return a unique list of currently known gtk themes
 */
static void
_vala_array_add7 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

gchar**
theme_scanner_get_gtk_themes (ThemeScanner* self,
                              gint* result_length1)
{
	gchar** t = NULL;
	gchar** _tmp0_;
	gint t_length1;
	gint _t_size_;
	const gchar* name = NULL;
	ThemeInfo* info = NULL;
	GHashTableIter iter = {0};
	GHashTable* _tmp1_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	t = _tmp0_;
	t_length1 = 0;
	_t_size_ = t_length1;
	name = NULL;
	info = NULL;
	_tmp1_ = self->priv->gtk_themes;
	g_hash_table_iter_init (&iter, _tmp1_);
	while (TRUE) {
		gconstpointer _tmp2_ = NULL;
		gconstpointer _tmp3_ = NULL;
		gboolean _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = g_hash_table_iter_next (&iter, (gpointer*) (&_tmp2_), (gpointer*) (&_tmp3_));
		name = (const gchar*) _tmp2_;
		info = (ThemeInfo*) _tmp3_;
		if (!_tmp4_) {
			break;
		}
		_tmp5_ = name;
		_tmp6_ = g_strconcat ("", _tmp5_, NULL);
		_vala_array_add7 (&t, &t_length1, &_t_size_, _tmp6_);
	}
	_tmp7_ = t;
	_tmp7__length1 = t_length1;
	if (result_length1) {
		*result_length1 = _tmp7__length1;
	}
	result = _tmp7_;
	return result;
}

/**
 * Return a unique list of currently known cursor themes
 */
static void
_vala_array_add8 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

gchar**
theme_scanner_get_cursor_themes (ThemeScanner* self,
                                 gint* result_length1)
{
	gchar** t = NULL;
	gchar** _tmp0_;
	gint t_length1;
	gint _t_size_;
	const gchar* name = NULL;
	ThemeInfo* info = NULL;
	GHashTableIter iter = {0};
	GHashTable* _tmp1_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	t = _tmp0_;
	t_length1 = 0;
	_t_size_ = t_length1;
	name = NULL;
	info = NULL;
	_tmp1_ = self->priv->cursor_themes;
	g_hash_table_iter_init (&iter, _tmp1_);
	while (TRUE) {
		gconstpointer _tmp2_ = NULL;
		gconstpointer _tmp3_ = NULL;
		gboolean _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = g_hash_table_iter_next (&iter, (gpointer*) (&_tmp2_), (gpointer*) (&_tmp3_));
		name = (const gchar*) _tmp2_;
		info = (ThemeInfo*) _tmp3_;
		if (!_tmp4_) {
			break;
		}
		_tmp5_ = name;
		_tmp6_ = g_strconcat ("", _tmp5_, NULL);
		_vala_array_add8 (&t, &t_length1, &_t_size_, _tmp6_);
	}
	_tmp7_ = t;
	_tmp7__length1 = t_length1;
	if (result_length1) {
		*result_length1 = _tmp7__length1;
	}
	result = _tmp7_;
	return result;
}

/**
 * Return a unique list of currently known icon themes
 */
static void
_vala_array_add9 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

gchar**
theme_scanner_get_icon_themes (ThemeScanner* self,
                               gint* result_length1)
{
	gchar** t = NULL;
	gchar** _tmp0_;
	gint t_length1;
	gint _t_size_;
	const gchar* name = NULL;
	ThemeInfo* info = NULL;
	GHashTableIter iter = {0};
	GHashTable* _tmp1_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	t = _tmp0_;
	t_length1 = 0;
	_t_size_ = t_length1;
	name = NULL;
	info = NULL;
	_tmp1_ = self->priv->icon_themes;
	g_hash_table_iter_init (&iter, _tmp1_);
	while (TRUE) {
		gconstpointer _tmp2_ = NULL;
		gconstpointer _tmp3_ = NULL;
		gboolean _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = g_hash_table_iter_next (&iter, (gpointer*) (&_tmp2_), (gpointer*) (&_tmp3_));
		name = (const gchar*) _tmp2_;
		info = (ThemeInfo*) _tmp3_;
		if (!_tmp4_) {
			break;
		}
		_tmp5_ = name;
		_tmp6_ = g_strconcat ("", _tmp5_, NULL);
		_vala_array_add9 (&t, &t_length1, &_t_size_, _tmp6_);
	}
	_tmp7_ = t;
	_tmp7__length1 = t_length1;
	if (result_length1) {
		*result_length1 = _tmp7__length1;
	}
	result = _tmp7_;
	return result;
}

static void
theme_scanner_maybe_add_icon_theme_data_free (gpointer _data)
{
	ThemeScannerMaybeAddIconThemeData* _data_;
	_data_ = _data;
	_g_free0 (_data_->path);
	_g_free0 (_data_->theme_name);
	_g_object_unref0 (_data_->self);
	g_slice_free (ThemeScannerMaybeAddIconThemeData, _data_);
}

static void
theme_scanner_maybe_add_icon_theme (ThemeScanner* self,
                                    const gchar* path,
                                    const gchar* theme_name,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	ThemeScannerMaybeAddIconThemeData* _data_;
	ThemeScanner* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	g_return_if_fail (theme_name != NULL);
	_data_ = g_slice_new0 (ThemeScannerMaybeAddIconThemeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, theme_scanner_maybe_add_icon_theme_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp1_;
	_tmp2_ = g_strdup (theme_name);
	_g_free0 (_data_->theme_name);
	_data_->theme_name = _tmp2_;
	theme_scanner_maybe_add_icon_theme_co (_data_);
}

static void
theme_scanner_maybe_add_icon_theme_finish (ThemeScanner* self,
                                           GAsyncResult* _res_)
{
	ThemeScannerMaybeAddIconThemeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/**
 * Attempt to add cursor/icon theme to the set
 */
static void
theme_scanner_maybe_add_icon_theme_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	ThemeScannerMaybeAddIconThemeData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	theme_scanner_maybe_add_icon_theme_co (_data_);
}

static gboolean
theme_scanner_maybe_add_icon_theme_co (ThemeScannerMaybeAddIconThemeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strdup_printf ("%s%s%s", _data_->path, G_DIR_SEPARATOR_S, "index.theme");
	_data_->test_path = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->test_path;
	if (!g_file_test (_data_->_tmp1_, G_FILE_TEST_EXISTS)) {
		_g_free0 (_data_->test_path);
		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;
	}
	_data_->icon_theme = TRUE;
	_data_->_tmp2_ = g_key_file_new ();
	_data_->f = _data_->_tmp2_;
	{
		_data_->_tmp3_ = _data_->f;
		_data_->_tmp4_ = _data_->test_path;
		g_key_file_load_from_file (_data_->_tmp3_, _data_->_tmp4_, G_KEY_FILE_NONE, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_g_key_file_unref0 (_data_->f);
		_g_free0 (_data_->test_path);
		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;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_key_file_unref0 (_data_->f);
		_g_free0 (_data_->test_path);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp7_ = _data_->f;
		_data_->_tmp6_ = g_key_file_has_key (_data_->_tmp7_, "Icon Theme", "Directories", &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		if (!_data_->_tmp6_) {
			_data_->_tmp5_ = TRUE;
		} else {
			_data_->_tmp10_ = _data_->f;
			_data_->_tmp9_ = g_key_file_has_key (_data_->_tmp10_, "Icon Theme", "Hidden", &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch1_g_error;
			}
			if (_data_->_tmp9_) {
				_data_->_tmp12_ = _data_->f;
				_data_->_tmp11_ = g_key_file_get_boolean (_data_->_tmp12_, "Icon Theme", "Hidden", &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					goto __catch1_g_error;
				}
				_data_->_tmp8_ = _data_->_tmp11_;
			} else {
				_data_->_tmp8_ = FALSE;
			}
			_data_->_tmp5_ = _data_->_tmp8_;
		}
		if (_data_->_tmp5_) {
			_data_->icon_theme = FALSE;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_data_->icon_theme = FALSE;
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_key_file_unref0 (_data_->f);
		_g_free0 (_data_->test_path);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	if (_data_->icon_theme) {
		_data_->_state_ = 1;
		theme_scanner_maybe_add_icons (_data_->self, _data_->path, _data_->theme_name, theme_scanner_maybe_add_icon_theme_ready, _data_);
		return FALSE;
		_state_1:
		theme_scanner_maybe_add_icons_finish (_data_->self, _data_->_res_);
	}
	_data_->_tmp13_ = g_strdup_printf ("%s%s%s", _data_->path, G_DIR_SEPARATOR_S, "cursors");
	_data_->cursor_path = _data_->_tmp13_;
	_data_->_tmp14_ = _data_->cursor_path;
	if (g_file_test (_data_->_tmp14_, G_FILE_TEST_EXISTS)) {
		_data_->_state_ = 2;
		theme_scanner_maybe_add_cursors (_data_->self, _data_->path, _data_->theme_name, theme_scanner_maybe_add_icon_theme_ready, _data_);
		return FALSE;
		_state_2:
		theme_scanner_maybe_add_cursors_finish (_data_->self, _data_->_res_);
	}
	_g_free0 (_data_->cursor_path);
	_g_key_file_unref0 (_data_->f);
	_g_free0 (_data_->test_path);
	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
theme_scanner_maybe_add_cursors_data_free (gpointer _data)
{
	ThemeScannerMaybeAddCursorsData* _data_;
	_data_ = _data;
	_g_free0 (_data_->path);
	_g_free0 (_data_->theme_name);
	_g_object_unref0 (_data_->self);
	g_slice_free (ThemeScannerMaybeAddCursorsData, _data_);
}

static void
theme_scanner_maybe_add_cursors (ThemeScanner* self,
                                 const gchar* path,
                                 const gchar* theme_name,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	ThemeScannerMaybeAddCursorsData* _data_;
	ThemeScanner* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	g_return_if_fail (theme_name != NULL);
	_data_ = g_slice_new0 (ThemeScannerMaybeAddCursorsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, theme_scanner_maybe_add_cursors_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp1_;
	_tmp2_ = g_strdup (theme_name);
	_g_free0 (_data_->theme_name);
	_data_->theme_name = _tmp2_;
	theme_scanner_maybe_add_cursors_co (_data_);
}

static gboolean
theme_scanner_maybe_add_cursors_finish (ThemeScanner* self,
                                        GAsyncResult* _res_)
{
	gboolean result;
	ThemeScannerMaybeAddCursorsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

/**
 * Try adding unique cursor theme
 */
static gboolean
theme_scanner_maybe_add_cursors_co (ThemeScannerMaybeAddCursorsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->cursor_themes;
	_data_->_tmp1_ = g_hash_table_lookup (_data_->_tmp0_, _data_->theme_name);
	_data_->info = (ThemeInfo*) _data_->_tmp1_;
	_data_->_tmp2_ = _data_->info;
	if (_data_->_tmp2_ == NULL) {
		_data_->_tmp3_ = theme_info_new (THEME_TYPE_CURSOR_THEME);
		_data_->ninfo = _data_->_tmp3_;
		_data_->_tmp4_ = _data_->self->priv->cursor_themes;
		_data_->_tmp5_ = g_strdup (_data_->theme_name);
		_data_->_tmp6_ = _data_->ninfo;
		_data_->_tmp7_ = _g_object_ref0 (_data_->_tmp6_);
		g_hash_table_insert (_data_->_tmp4_, _data_->_tmp5_, _data_->_tmp7_);
		_data_->_tmp8_ = _data_->self->priv->cursor_themes;
		_data_->_tmp9_ = g_hash_table_lookup (_data_->_tmp8_, _data_->theme_name);
		_data_->info = (ThemeInfo*) _data_->_tmp9_;
		_g_object_unref0 (_data_->ninfo);
	}
	_data_->_tmp10_ = _data_->info;
	if (theme_info_add_path (_data_->_tmp10_, _data_->path)) {
		_data_->result = TRUE;
		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;
	}
	_data_->result = FALSE;
	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
theme_scanner_maybe_add_icons_data_free (gpointer _data)
{
	ThemeScannerMaybeAddIconsData* _data_;
	_data_ = _data;
	_g_free0 (_data_->path);
	_g_free0 (_data_->theme_name);
	_g_object_unref0 (_data_->self);
	g_slice_free (ThemeScannerMaybeAddIconsData, _data_);
}

static void
theme_scanner_maybe_add_icons (ThemeScanner* self,
                               const gchar* path,
                               const gchar* theme_name,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	ThemeScannerMaybeAddIconsData* _data_;
	ThemeScanner* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	g_return_if_fail (theme_name != NULL);
	_data_ = g_slice_new0 (ThemeScannerMaybeAddIconsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, theme_scanner_maybe_add_icons_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp1_;
	_tmp2_ = g_strdup (theme_name);
	_g_free0 (_data_->theme_name);
	_data_->theme_name = _tmp2_;
	theme_scanner_maybe_add_icons_co (_data_);
}

static gboolean
theme_scanner_maybe_add_icons_finish (ThemeScanner* self,
                                      GAsyncResult* _res_)
{
	gboolean result;
	ThemeScannerMaybeAddIconsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

/**
 * Try adding unique icon theme
 */
static gboolean
theme_scanner_maybe_add_icons_co (ThemeScannerMaybeAddIconsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->index = 0;
		{
			_data_->_tmp0_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp0_) {
					_data_->_tmp1_ = _data_->index;
					_data_->index = _data_->_tmp1_ + 1;
				}
				_data_->_tmp0_ = FALSE;
				_data_->_tmp2_ = _data_->self->priv->icon_theme_blacklist;
				_data_->_tmp2__length1 = _data_->self->priv->icon_theme_blacklist_length1;
				if (!(_data_->index < _data_->_tmp2__length1)) {
					break;
				}
				_data_->_tmp3_ = _data_->self->priv->icon_theme_blacklist;
				_data_->_tmp3__length1 = _data_->self->priv->icon_theme_blacklist_length1;
				_data_->_tmp4_ = _data_->_tmp3_[_data_->index];
				_data_->_tmp5_ = g_strdup (_data_->_tmp4_);
				_data_->blacklisted_item = _data_->_tmp5_;
				_data_->_tmp7_ = _data_->blacklisted_item;
				if (g_strcmp0 (_data_->_tmp7_, _data_->theme_name) == 0) {
					_data_->_tmp6_ = TRUE;
				} else {
					_data_->_tmp8_ = _data_->blacklisted_item;
					_data_->_tmp6_ = string_index_of (_data_->theme_name, _data_->_tmp8_, 0) != -1;
				}
				if (_data_->_tmp6_) {
					_data_->result = FALSE;
					_g_free0 (_data_->blacklisted_item);
					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;
				}
				_g_free0 (_data_->blacklisted_item);
			}
		}
	}
	_data_->_tmp9_ = _data_->self->priv->icon_themes;
	_data_->_tmp10_ = g_hash_table_lookup (_data_->_tmp9_, _data_->theme_name);
	_data_->info = (ThemeInfo*) _data_->_tmp10_;
	_data_->_tmp11_ = _data_->info;
	if (_data_->_tmp11_ == NULL) {
		_data_->_tmp12_ = theme_info_new (THEME_TYPE_ICON_THEME);
		_data_->ninfo = _data_->_tmp12_;
		_data_->_tmp13_ = _data_->self->priv->icon_themes;
		_data_->_tmp14_ = g_strdup (_data_->theme_name);
		_data_->_tmp15_ = _data_->ninfo;
		_data_->_tmp16_ = _g_object_ref0 (_data_->_tmp15_);
		g_hash_table_insert (_data_->_tmp13_, _data_->_tmp14_, _data_->_tmp16_);
		_data_->_tmp17_ = _data_->self->priv->icon_themes;
		_data_->_tmp18_ = g_hash_table_lookup (_data_->_tmp17_, _data_->theme_name);
		_data_->info = (ThemeInfo*) _data_->_tmp18_;
		_g_object_unref0 (_data_->ninfo);
	}
	_data_->_tmp19_ = _data_->info;
	if (theme_info_add_path (_data_->_tmp19_, _data_->path)) {
		_data_->result = TRUE;
		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;
	}
	_data_->result = FALSE;
	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
theme_scanner_class_init (ThemeScannerClass * klass,
                          gpointer klass_data)
{
	theme_scanner_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ThemeScanner_private_offset);
	G_OBJECT_CLASS (klass)->finalize = theme_scanner_finalize;
}

static void
theme_scanner_instance_init (ThemeScanner * self,
                             gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar** _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar** _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar** _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar** _tmp27_;
	self->priv = theme_scanner_get_instance_private (self);
	self->priv->xdg_paths = NULL;
	self->priv->xdg_paths_length1 = 0;
	self->priv->_xdg_paths_size_ = self->priv->xdg_paths_length1;
	_tmp0_ = g_strdup ("Adwaita");
	_tmp1_ = g_strdup ("Breeze");
	_tmp2_ = g_strdup ("Clearlooks");
	_tmp3_ = g_strdup ("Crux");
	_tmp4_ = g_strdup ("Default");
	_tmp5_ = g_strdup ("Emacs");
	_tmp6_ = g_strdup ("Industrial");
	_tmp7_ = g_strdup ("Kv");
	_tmp8_ = g_strdup ("Mist");
	_tmp9_ = g_strdup ("Murrina");
	_tmp10_ = g_strdup ("Raleigh");
	_tmp11_ = g_strdup ("Redmond");
	_tmp12_ = g_strdup ("ThinIce");
	_tmp13_ = g_new0 (gchar*, 13 + 1);
	_tmp13_[0] = _tmp0_;
	_tmp13_[1] = _tmp1_;
	_tmp13_[2] = _tmp2_;
	_tmp13_[3] = _tmp3_;
	_tmp13_[4] = _tmp4_;
	_tmp13_[5] = _tmp5_;
	_tmp13_[6] = _tmp6_;
	_tmp13_[7] = _tmp7_;
	_tmp13_[8] = _tmp8_;
	_tmp13_[9] = _tmp9_;
	_tmp13_[10] = _tmp10_;
	_tmp13_[11] = _tmp11_;
	_tmp13_[12] = _tmp12_;
	self->priv->gtk_theme_blacklist = _tmp13_;
	self->priv->gtk_theme_blacklist_length1 = 13;
	self->priv->_gtk_theme_blacklist_size_ = self->priv->gtk_theme_blacklist_length1;
	_tmp14_ = g_strdup ("Adwaita");
	_tmp15_ = g_strdup ("HighContrast");
	_tmp16_ = g_strdup ("Papirus-Adapta");
	_tmp17_ = g_strdup ("Papirus-Adapta-Nokto");
	_tmp18_ = g_strdup ("breeze");
	_tmp19_ = g_strdup ("hicolor");
	_tmp20_ = g_strdup ("solus-sc");
	_tmp21_ = g_new0 (gchar*, 7 + 1);
	_tmp21_[0] = _tmp14_;
	_tmp21_[1] = _tmp15_;
	_tmp21_[2] = _tmp16_;
	_tmp21_[3] = _tmp17_;
	_tmp21_[4] = _tmp18_;
	_tmp21_[5] = _tmp19_;
	_tmp21_[6] = _tmp20_;
	self->priv->icon_theme_blacklist = _tmp21_;
	self->priv->icon_theme_blacklist_length1 = 7;
	self->priv->_icon_theme_blacklist_size_ = self->priv->icon_theme_blacklist_length1;
	_tmp22_ = g_strdup ("themes");
	_tmp23_ = g_strdup ("icons");
	_tmp24_ = g_new0 (gchar*, 2 + 1);
	_tmp24_[0] = _tmp22_;
	_tmp24_[1] = _tmp23_;
	self->priv->normal_suffixes = _tmp24_;
	self->priv->normal_suffixes_length1 = 2;
	self->priv->_normal_suffixes_size_ = self->priv->normal_suffixes_length1;
	_tmp25_ = g_strdup (".themes");
	_tmp26_ = g_strdup (".icons");
	_tmp27_ = g_new0 (gchar*, 2 + 1);
	_tmp27_[0] = _tmp25_;
	_tmp27_[1] = _tmp26_;
	self->priv->legacy_suffixes = _tmp27_;
	self->priv->legacy_suffixes_length1 = 2;
	self->priv->_legacy_suffixes_size_ = self->priv->legacy_suffixes_length1;
	self->priv->gtk_theme_paths = NULL;
	self->priv->gtk_theme_paths_length1 = 0;
	self->priv->_gtk_theme_paths_size_ = self->priv->gtk_theme_paths_length1;
	self->priv->gtk_themes = NULL;
	self->priv->cursor_themes = NULL;
	self->priv->icon_themes = NULL;
}

static void
theme_scanner_finalize (GObject * obj)
{
	ThemeScanner * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_THEME_SCANNER, ThemeScanner);
	self->priv->xdg_paths = (_vala_array_free (self->priv->xdg_paths, self->priv->xdg_paths_length1, (GDestroyNotify) g_free), NULL);
	self->priv->gtk_theme_blacklist = (_vala_array_free (self->priv->gtk_theme_blacklist, self->priv->gtk_theme_blacklist_length1, (GDestroyNotify) g_free), NULL);
	self->priv->icon_theme_blacklist = (_vala_array_free (self->priv->icon_theme_blacklist, self->priv->icon_theme_blacklist_length1, (GDestroyNotify) g_free), NULL);
	self->priv->normal_suffixes = (_vala_array_free (self->priv->normal_suffixes, self->priv->normal_suffixes_length1, (GDestroyNotify) g_free), NULL);
	self->priv->legacy_suffixes = (_vala_array_free (self->priv->legacy_suffixes, self->priv->legacy_suffixes_length1, (GDestroyNotify) g_free), NULL);
	self->priv->gtk_theme_paths = (_vala_array_free (self->priv->gtk_theme_paths, self->priv->gtk_theme_paths_length1, (GDestroyNotify) g_free), NULL);
	_g_hash_table_unref0 (self->priv->gtk_themes);
	_g_hash_table_unref0 (self->priv->cursor_themes);
	_g_hash_table_unref0 (self->priv->icon_themes);
	G_OBJECT_CLASS (theme_scanner_parent_class)->finalize (obj);
}

static GType
theme_scanner_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ThemeScannerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) theme_scanner_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ThemeScanner), 0, (GInstanceInitFunc) theme_scanner_instance_init, NULL };
	GType theme_scanner_type_id;
	theme_scanner_type_id = g_type_register_static (G_TYPE_OBJECT, "ThemeScanner", &g_define_type_info, 0);
	ThemeScanner_private_offset = g_type_add_instance_private (theme_scanner_type_id, sizeof (ThemeScannerPrivate));
	return theme_scanner_type_id;
}

GType
theme_scanner_get_type (void)
{
	static volatile gsize theme_scanner_type_id__once = 0;
	if (g_once_init_enter (&theme_scanner_type_id__once)) {
		GType theme_scanner_type_id;
		theme_scanner_type_id = theme_scanner_get_type_once ();
		g_once_init_leave (&theme_scanner_type_id__once, theme_scanner_type_id);
	}
	return theme_scanner_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

