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

/*
* Copyright 2020 elementary, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

#include "slingshot.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <gee.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

#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	SYNAPSE_SWITCHBOARD_EXECUTABLE_PLUGIN_0_PROPERTY,
	SYNAPSE_SWITCHBOARD_EXECUTABLE_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* synapse_switchboard_executable_plugin_properties[SYNAPSE_SWITCHBOARD_EXECUTABLE_PLUGIN_NUM_PROPERTIES];
enum  {
	SYNAPSE_SWITCHBOARD_OBJECT_0_PROPERTY,
	SYNAPSE_SWITCHBOARD_OBJECT_URI_PROPERTY,
	SYNAPSE_SWITCHBOARD_OBJECT_NUM_PROPERTIES
};
static GParamSpec* synapse_switchboard_object_properties[SYNAPSE_SWITCHBOARD_OBJECT_NUM_PROPERTIES];
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	SYNAPSE_SWITCHBOARD_PLUGIN_0_PROPERTY,
	SYNAPSE_SWITCHBOARD_PLUGIN_ENABLED_PROPERTY,
	SYNAPSE_SWITCHBOARD_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* synapse_switchboard_plugin_properties[SYNAPSE_SWITCHBOARD_PLUGIN_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
typedef struct _SynapseSwitchboardPluginSearchData SynapseSwitchboardPluginSearchData;

struct _SynapseSwitchboardExecutablePluginPrivate {
	SynapsePlugInfo* plugs;
	gint plugs_length1;
	gint _plugs_size_;
};

struct _SynapseSwitchboardObjectPrivate {
	gchar* _uri;
};

struct _SynapseSwitchboardPluginPrivate {
	SynapseWorkerLink* worker_link;
	GSubprocess* subprocess;
	SynapseSwitchboardExecutablePlugin* executable_plugin;
	gboolean _enabled;
};

struct _SynapseSwitchboardPluginSearchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SynapseSwitchboardPlugin* self;
	SynapseQuery q;
	SynapseResultSet* result;
	SynapsePlugInfo* plugs;
	SynapseSwitchboardExecutablePlugin* _tmp0_;
	gint _tmp1_;
	SynapsePlugInfo* _tmp2_;
	gint plugs_length1;
	gint _plugs_size_;
	SynapseResultSet* _result_;
	SynapseResultSet* _tmp3_;
	SynapseMatcherFlags flags;
	SynapseQuery _tmp4_;
	const gchar* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GeeList* matchers;
	SynapseQuery _tmp8_;
	const gchar* _tmp9_;
	GeeList* _tmp10_;
	gchar* stripped;
	SynapseQuery _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	SynapsePlugInfo* _tmp15_;
	gint _tmp15__length1;
	SynapsePlugInfo* plug_collection;
	gint plug_collection_length1;
	gint _plug_collection_size_;
	gint plug_it;
	SynapsePlugInfo plug;
	const gchar* _tmp16_;
	SynapsePlugInfo _tmp17_;
	gchar** _tmp18_;
	gint _tmp18__length1;
	SynapsePlugInfo _tmp19_;
	gchar** _tmp20_;
	gint _tmp20__length1;
	SynapsePlugInfo _tmp21_;
	gchar** _tmp22_;
	gint _tmp22__length1;
	const gchar* _tmp23_;
	SynapsePlugInfo _tmp24_;
	const gchar* _tmp25_;
	gchar* searchable_name;
	gchar* _tmp26_;
	GeeList* _matcher_list;
	GeeList* _tmp27_;
	gint _matcher_size;
	GeeList* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	gint _matcher_index;
	gint _tmp31_;
	gint _tmp32_;
	GeeMapEntry* matcher;
	GeeList* _tmp33_;
	gpointer _tmp34_;
	GMatchInfo* info;
	GeeMapEntry* _tmp35_;
	gconstpointer _tmp36_;
	gconstpointer _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	GMatchInfo* _tmp41_;
	gboolean _tmp42_;
	gboolean _tmp43_;
	SynapseResultSet* _tmp44_;
	SynapsePlugInfo _tmp45_;
	SynapseSwitchboardObject* _tmp46_;
	SynapseSwitchboardObject* _tmp47_;
	GeeMapEntry* _tmp48_;
	gconstpointer _tmp49_;
	gconstpointer _tmp50_;
	SynapsePlugInfo _tmp51_;
	const gchar* _tmp52_;
	gchar* _tmp53_;
	gchar* _tmp54_;
	GMatchInfo* _tmp55_;
	gboolean _tmp56_;
	gboolean _tmp57_;
	SynapseResultSet* _tmp58_;
	SynapsePlugInfo _tmp59_;
	SynapseSwitchboardObject* _tmp60_;
	SynapseSwitchboardObject* _tmp61_;
	GError* _inner_error0_;
};

static gint SynapseSwitchboardExecutablePlugin_private_offset;
static gpointer synapse_switchboard_executable_plugin_parent_class = NULL;
static gint SynapseSwitchboardObject_private_offset;
static gpointer synapse_switchboard_object_parent_class = NULL;
static gint SynapseSwitchboardPlugin_private_offset;
static gpointer synapse_switchboard_plugin_parent_class = NULL;
static SynapseActivatableIface * synapse_switchboard_plugin_synapse_activatable_parent_iface = NULL;
static SynapseItemProviderIface * synapse_switchboard_plugin_synapse_item_provider_parent_iface = NULL;

static gchar** _vala_array_dup3 (gchar** self,
                          gssize length);
static void _vala_SynapsePlugInfo_array_free (SynapsePlugInfo * array,
                                       gssize array_length);
static SynapsePlugInfo* _vala_array_dup4 (SynapsePlugInfo* self,
                                   gssize length);
static SynapsePlugInfo* _vala_array_dup5 (SynapsePlugInfo* self,
                                   gssize length);
static void synapse_switchboard_executable_plugin_finalize (GObject * obj);
static GType synapse_switchboard_executable_plugin_get_type_once (void);
static void _dbus_synapse_switchboard_executable_plugin_set_plugs (SynapseSwitchboardExecutablePlugin* self,
                                                            GVariant* _parameters_,
                                                            GDBusMethodInvocation* invocation);
static void synapse_switchboard_executable_plugin_dbus_interface_method_call (GDBusConnection* connection,
                                                                       const gchar* sender,
                                                                       const gchar* object_path,
                                                                       const gchar* interface_name,
                                                                       const gchar* method_name,
                                                                       GVariant* parameters,
                                                                       GDBusMethodInvocation* invocation,
                                                                       gpointer user_data);
static GVariant* synapse_switchboard_executable_plugin_dbus_interface_get_property (GDBusConnection* connection,
                                                                             const gchar* sender,
                                                                             const gchar* object_path,
                                                                             const gchar* interface_name,
                                                                             const gchar* property_name,
                                                                             GError** error,
                                                                             gpointer user_data);
static gboolean synapse_switchboard_executable_plugin_dbus_interface_set_property (GDBusConnection* connection,
                                                                            const gchar* sender,
                                                                            const gchar* object_path,
                                                                            const gchar* interface_name,
                                                                            const gchar* property_name,
                                                                            GVariant* value,
                                                                            GError** error,
                                                                            gpointer user_data);
static void _synapse_switchboard_executable_plugin_unregister_object (gpointer user_data);
static void synapse_switchboard_object_real_execute (SynapseMatch* base,
                                              SynapseMatch* match);
static void synapse_switchboard_object_finalize (GObject * obj);
static GType synapse_switchboard_object_get_type_once (void);
static void _vala_synapse_switchboard_object_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_synapse_switchboard_object_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);
static void synapse_switchboard_plugin_register_plugin (void);
static void _synapse_switchboard_plugin_register_plugin_synapse_plugin_register_func (void);
static void synapse_switchboard_plugin_real_activate (SynapseActivatable* base);
static void synapse_switchboard_plugin_real_deactivate (SynapseActivatable* base);
static void synapse_switchboard_plugin_real_search_data_free (gpointer _data);
static void synapse_switchboard_plugin_real_search (SynapseItemProvider* base,
                                             SynapseQuery* q,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static gboolean synapse_switchboard_plugin_real_search_co (SynapseSwitchboardPluginSearchData* _data_);
static GObject * synapse_switchboard_plugin_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties);
static void _synapse_switchboard_plugin___lambda21_ (SynapseSwitchboardPlugin* self,
                                              GDBusConnection* connection);
static void __synapse_switchboard_plugin___lambda21__synapse_worker_link_on_connection_accepted (SynapseWorkerLink* _sender,
                                                                                          GDBusConnection* connection,
                                                                                          gpointer self);
static void _synapse_switchboard_plugin____lambda22_ (SynapseSwitchboardPlugin* self,
                                               GObject* obj,
                                               GAsyncResult* res);
static void __synapse_switchboard_plugin____lambda22__gasync_ready_callback (GObject* source_object,
                                                                      GAsyncResult* res,
                                                                      gpointer self);
static void synapse_switchboard_plugin_finalize (GObject * obj);
static GType synapse_switchboard_plugin_get_type_once (void);
static void _vala_synapse_switchboard_plugin_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_synapse_switchboard_plugin_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);
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 const GDBusArgInfo _synapse_switchboard_executable_plugin_dbus_arg_info_set_plugs_plugs = {-1, "plugs", "a(sssas)", NULL};
static const GDBusArgInfo * const _synapse_switchboard_executable_plugin_dbus_arg_info_set_plugs_in[] = {&_synapse_switchboard_executable_plugin_dbus_arg_info_set_plugs_plugs, NULL};
static const GDBusArgInfo * const _synapse_switchboard_executable_plugin_dbus_arg_info_set_plugs_out[] = {NULL};
static const GDBusMethodInfo _synapse_switchboard_executable_plugin_dbus_method_info_set_plugs = {-1, "SetPlugs", (GDBusArgInfo **) (&_synapse_switchboard_executable_plugin_dbus_arg_info_set_plugs_in), (GDBusArgInfo **) (&_synapse_switchboard_executable_plugin_dbus_arg_info_set_plugs_out), NULL};
static const GDBusMethodInfo * const _synapse_switchboard_executable_plugin_dbus_method_info[] = {&_synapse_switchboard_executable_plugin_dbus_method_info_set_plugs, NULL};
static const GDBusSignalInfo * const _synapse_switchboard_executable_plugin_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _synapse_switchboard_executable_plugin_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _synapse_switchboard_executable_plugin_dbus_interface_info = {-1, "io.elementary.ApplicationsMenu.Switchboard", (GDBusMethodInfo **) (&_synapse_switchboard_executable_plugin_dbus_method_info), (GDBusSignalInfo **) (&_synapse_switchboard_executable_plugin_dbus_signal_info), (GDBusPropertyInfo **) (&_synapse_switchboard_executable_plugin_dbus_property_info), NULL};
static const GDBusInterfaceVTable _synapse_switchboard_executable_plugin_dbus_interface_vtable = {synapse_switchboard_executable_plugin_dbus_interface_method_call, synapse_switchboard_executable_plugin_dbus_interface_get_property, synapse_switchboard_executable_plugin_dbus_interface_set_property};

static gchar**
_vala_array_dup3 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

void
synapse_plug_info_copy (const SynapsePlugInfo* self,
                        SynapsePlugInfo* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gchar** _tmp7_;
	gint _tmp7__length1;
	_tmp0_ = (*self).title;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).title);
	(*dest).title = _tmp1_;
	_tmp2_ = (*self).icon;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*dest).icon);
	(*dest).icon = _tmp3_;
	_tmp4_ = (*self).uri;
	_tmp5_ = g_strdup (_tmp4_);
	_g_free0 ((*dest).uri);
	(*dest).uri = _tmp5_;
	_tmp6_ = (*self).path;
	_tmp6__length1 = (*self).path_length1;
	_tmp7_ = (_tmp6_ != NULL) ? _vala_array_dup3 (_tmp6_, _tmp6__length1) : _tmp6_;
	_tmp7__length1 = _tmp6__length1;
	(*dest).path = (_vala_array_free ((*dest).path, (*dest).path_length1, (GDestroyNotify) g_free), NULL);
	(*dest).path = _tmp7_;
	(*dest).path_length1 = _tmp7__length1;
}

void
synapse_plug_info_destroy (SynapsePlugInfo* self)
{
	_g_free0 ((*self).title);
	_g_free0 ((*self).icon);
	_g_free0 ((*self).uri);
	(*self).path = (_vala_array_free ((*self).path, (*self).path_length1, (GDestroyNotify) g_free), NULL);
}

SynapsePlugInfo*
synapse_plug_info_dup (const SynapsePlugInfo* self)
{
	SynapsePlugInfo* dup;
	dup = g_new0 (SynapsePlugInfo, 1);
	synapse_plug_info_copy (self, dup);
	return dup;
}

void
synapse_plug_info_free (SynapsePlugInfo* self)
{
	synapse_plug_info_destroy (self);
	g_free (self);
}

static GType
synapse_plug_info_get_type_once (void)
{
	GType synapse_plug_info_type_id;
	synapse_plug_info_type_id = g_boxed_type_register_static ("SynapsePlugInfo", (GBoxedCopyFunc) synapse_plug_info_dup, (GBoxedFreeFunc) synapse_plug_info_free);
	return synapse_plug_info_type_id;
}

GType
synapse_plug_info_get_type (void)
{
	static volatile gsize synapse_plug_info_type_id__once = 0;
	if (g_once_init_enter (&synapse_plug_info_type_id__once)) {
		GType synapse_plug_info_type_id;
		synapse_plug_info_type_id = synapse_plug_info_get_type_once ();
		g_once_init_leave (&synapse_plug_info_type_id__once, synapse_plug_info_type_id);
	}
	return synapse_plug_info_type_id__once;
}

static inline gpointer
synapse_switchboard_executable_plugin_get_instance_private (SynapseSwitchboardExecutablePlugin* self)
{
	return G_STRUCT_MEMBER_P (self, SynapseSwitchboardExecutablePlugin_private_offset);
}

static void
_vala_SynapsePlugInfo_array_free (SynapsePlugInfo * array,
                                  gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			synapse_plug_info_destroy (&array[i]);
		}
	}
	g_free (array);
}

static SynapsePlugInfo*
_vala_array_dup4 (SynapsePlugInfo* self,
                  gssize length)
{
	if (length > 0) {
		SynapsePlugInfo* result;
		gssize i;
		result = g_new0 (SynapsePlugInfo, length);
		for (i = 0; i < length; i++) {
			SynapsePlugInfo _tmp0_;
			SynapsePlugInfo _tmp1_ = {0};
			_tmp0_ = self[i];
			synapse_plug_info_copy (&_tmp0_, &_tmp1_);
			result[i] = _tmp1_;
		}
		return result;
	}
	return NULL;
}

void
synapse_switchboard_executable_plugin_set_plugs (SynapseSwitchboardExecutablePlugin* self,
                                                 SynapsePlugInfo* plugs,
                                                 gint plugs_length1,
                                                 GError** error)
{
	SynapsePlugInfo* _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = (plugs != NULL) ? _vala_array_dup4 (plugs, plugs_length1) : plugs;
	_tmp0__length1 = plugs_length1;
	self->priv->plugs = (_vala_SynapsePlugInfo_array_free (self->priv->plugs, self->priv->plugs_length1), NULL);
	self->priv->plugs = _tmp0_;
	self->priv->plugs_length1 = _tmp0__length1;
	self->priv->_plugs_size_ = self->priv->plugs_length1;
}

static SynapsePlugInfo*
_vala_array_dup5 (SynapsePlugInfo* self,
                  gssize length)
{
	if (length > 0) {
		SynapsePlugInfo* result;
		gssize i;
		result = g_new0 (SynapsePlugInfo, length);
		for (i = 0; i < length; i++) {
			SynapsePlugInfo _tmp0_;
			SynapsePlugInfo _tmp1_ = {0};
			_tmp0_ = self[i];
			synapse_plug_info_copy (&_tmp0_, &_tmp1_);
			result[i] = _tmp1_;
		}
		return result;
	}
	return NULL;
}

SynapsePlugInfo*
synapse_switchboard_executable_plugin_get_plugs (SynapseSwitchboardExecutablePlugin* self,
                                                 gint* result_length1)
{
	SynapsePlugInfo* _tmp0_;
	gint _tmp0__length1;
	SynapsePlugInfo* _tmp1_;
	gint _tmp1__length1;
	SynapsePlugInfo* _tmp2_;
	gint _tmp2__length1;
	SynapsePlugInfo* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->plugs;
	_tmp0__length1 = self->priv->plugs_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup5 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

SynapseSwitchboardExecutablePlugin*
synapse_switchboard_executable_plugin_construct (GType object_type)
{
	SynapseSwitchboardExecutablePlugin * self = NULL;
	self = (SynapseSwitchboardExecutablePlugin*) g_object_new (object_type, NULL);
	return self;
}

SynapseSwitchboardExecutablePlugin*
synapse_switchboard_executable_plugin_new (void)
{
	return synapse_switchboard_executable_plugin_construct (SYNAPSE_TYPE_SWITCHBOARD_EXECUTABLE_PLUGIN);
}

static void
synapse_switchboard_executable_plugin_class_init (SynapseSwitchboardExecutablePluginClass * klass,
                                                  gpointer klass_data)
{
	synapse_switchboard_executable_plugin_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SynapseSwitchboardExecutablePlugin_private_offset);
	G_OBJECT_CLASS (klass)->finalize = synapse_switchboard_executable_plugin_finalize;
}

static void
synapse_switchboard_executable_plugin_instance_init (SynapseSwitchboardExecutablePlugin * self,
                                                     gpointer klass)
{
	self->priv = synapse_switchboard_executable_plugin_get_instance_private (self);
}

static void
synapse_switchboard_executable_plugin_finalize (GObject * obj)
{
	SynapseSwitchboardExecutablePlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYNAPSE_TYPE_SWITCHBOARD_EXECUTABLE_PLUGIN, SynapseSwitchboardExecutablePlugin);
	self->priv->plugs = (_vala_SynapsePlugInfo_array_free (self->priv->plugs, self->priv->plugs_length1), NULL);
	G_OBJECT_CLASS (synapse_switchboard_executable_plugin_parent_class)->finalize (obj);
}

static GType
synapse_switchboard_executable_plugin_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SynapseSwitchboardExecutablePluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) synapse_switchboard_executable_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SynapseSwitchboardExecutablePlugin), 0, (GInstanceInitFunc) synapse_switchboard_executable_plugin_instance_init, NULL };
	GType synapse_switchboard_executable_plugin_type_id;
	synapse_switchboard_executable_plugin_type_id = g_type_register_static (G_TYPE_OBJECT, "SynapseSwitchboardExecutablePlugin", &g_define_type_info, 0);
	g_type_set_qdata (synapse_switchboard_executable_plugin_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) synapse_switchboard_executable_plugin_register_object);
	SynapseSwitchboardExecutablePlugin_private_offset = g_type_add_instance_private (synapse_switchboard_executable_plugin_type_id, sizeof (SynapseSwitchboardExecutablePluginPrivate));
	return synapse_switchboard_executable_plugin_type_id;
}

GType
synapse_switchboard_executable_plugin_get_type (void)
{
	static volatile gsize synapse_switchboard_executable_plugin_type_id__once = 0;
	if (g_once_init_enter (&synapse_switchboard_executable_plugin_type_id__once)) {
		GType synapse_switchboard_executable_plugin_type_id;
		synapse_switchboard_executable_plugin_type_id = synapse_switchboard_executable_plugin_get_type_once ();
		g_once_init_leave (&synapse_switchboard_executable_plugin_type_id__once, synapse_switchboard_executable_plugin_type_id);
	}
	return synapse_switchboard_executable_plugin_type_id__once;
}

static void
_dbus_synapse_switchboard_executable_plugin_set_plugs (SynapseSwitchboardExecutablePlugin* self,
                                                       GVariant* _parameters_,
                                                       GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	SynapsePlugInfo* plugs = NULL;
	gint plugs_length1 = 0;
	GVariant* _tmp73_;
	SynapsePlugInfo* _tmp74_;
	gint _tmp74__length;
	gint _tmp74__size;
	gint _tmp74__length1;
	GVariantIter _tmp75_;
	GVariant* _tmp76_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp73_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp74_ = g_new (SynapsePlugInfo, 5);
	_tmp74__length = 0;
	_tmp74__size = 4;
	_tmp74__length1 = 0;
	g_variant_iter_init (&_tmp75_, _tmp73_);
	for (; (_tmp76_ = g_variant_iter_next_value (&_tmp75_)) != NULL; _tmp74__length1++) {
		SynapsePlugInfo _tmp77_;
		GVariantIter _tmp78_;
		GVariant* _tmp79_;
		GVariant* _tmp80_;
		GVariant* _tmp81_;
		GVariant* _tmp82_;
		gchar** _tmp83_;
		gint _tmp83__length;
		gint _tmp83__size;
		gint _tmp83__length1;
		GVariantIter _tmp84_;
		GVariant* _tmp85_;
		if (_tmp74__size == _tmp74__length) {
			_tmp74__size = 2 * _tmp74__size;
			_tmp74_ = g_renew (SynapsePlugInfo, _tmp74_, _tmp74__size + 1);
		}
		g_variant_iter_init (&_tmp78_, _tmp76_);
		_tmp79_ = g_variant_iter_next_value (&_tmp78_);
		_tmp77_.title = g_variant_dup_string (_tmp79_, NULL);
		g_variant_unref (_tmp79_);
		_tmp80_ = g_variant_iter_next_value (&_tmp78_);
		_tmp77_.icon = g_variant_dup_string (_tmp80_, NULL);
		g_variant_unref (_tmp80_);
		_tmp81_ = g_variant_iter_next_value (&_tmp78_);
		_tmp77_.uri = g_variant_dup_string (_tmp81_, NULL);
		g_variant_unref (_tmp81_);
		_tmp82_ = g_variant_iter_next_value (&_tmp78_);
		_tmp83_ = g_new (gchar*, 5);
		_tmp83__length = 0;
		_tmp83__size = 4;
		_tmp83__length1 = 0;
		g_variant_iter_init (&_tmp84_, _tmp82_);
		for (; (_tmp85_ = g_variant_iter_next_value (&_tmp84_)) != NULL; _tmp83__length1++) {
			if (_tmp83__size == _tmp83__length) {
				_tmp83__size = 2 * _tmp83__size;
				_tmp83_ = g_renew (gchar*, _tmp83_, _tmp83__size + 1);
			}
			_tmp83_[_tmp83__length++] = g_variant_dup_string (_tmp85_, NULL);
			g_variant_unref (_tmp85_);
		}
		_tmp77_.path_length1 = _tmp83__length1;
		_tmp83_[_tmp83__length] = NULL;
		_tmp77_.path = _tmp83_;
		g_variant_unref (_tmp82_);
		_tmp74_[_tmp74__length++] = _tmp77_;
		g_variant_unref (_tmp76_);
	}
	plugs_length1 = _tmp74__length1;
	plugs = _tmp74_;
	g_variant_unref (_tmp73_);
	synapse_switchboard_executable_plugin_set_plugs (self, plugs, plugs_length1, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	plugs = (_vala_SynapsePlugInfo_array_free (plugs, plugs_length1), NULL);
	;
}

static void
synapse_switchboard_executable_plugin_dbus_interface_method_call (GDBusConnection* connection,
                                                                  const gchar* sender,
                                                                  const gchar* object_path,
                                                                  const gchar* interface_name,
                                                                  const gchar* method_name,
                                                                  GVariant* parameters,
                                                                  GDBusMethodInvocation* invocation,
                                                                  gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "SetPlugs") == 0) {
		_dbus_synapse_switchboard_executable_plugin_set_plugs (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
synapse_switchboard_executable_plugin_dbus_interface_get_property (GDBusConnection* connection,
                                                                   const gchar* sender,
                                                                   const gchar* object_path,
                                                                   const gchar* interface_name,
                                                                   const gchar* property_name,
                                                                   GError** error,
                                                                   gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return NULL;
}

static gboolean
synapse_switchboard_executable_plugin_dbus_interface_set_property (GDBusConnection* connection,
                                                                   const gchar* sender,
                                                                   const gchar* object_path,
                                                                   const gchar* interface_name,
                                                                   const gchar* property_name,
                                                                   GVariant* value,
                                                                   GError** error,
                                                                   gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}

guint
synapse_switchboard_executable_plugin_register_object (gpointer object,
                                                       GDBusConnection* connection,
                                                       const gchar* path,
                                                       GError** error)
{
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_synapse_switchboard_executable_plugin_dbus_interface_info), &_synapse_switchboard_executable_plugin_dbus_interface_vtable, data, _synapse_switchboard_executable_plugin_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_synapse_switchboard_executable_plugin_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

static inline gpointer
synapse_switchboard_object_get_instance_private (SynapseSwitchboardObject* self)
{
	return G_STRUCT_MEMBER_P (self, SynapseSwitchboardObject_private_offset);
}

SynapseSwitchboardObject*
synapse_switchboard_object_construct (GType object_type,
                                      SynapsePlugInfo* plug_info)
{
	SynapseSwitchboardObject * self = NULL;
	SynapsePlugInfo _tmp0_;
	const gchar* _tmp1_;
	SynapsePlugInfo _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	SynapsePlugInfo _tmp6_;
	const gchar* _tmp7_;
	SynapsePlugInfo _tmp8_;
	const gchar* _tmp9_;
	g_return_val_if_fail (plug_info != NULL, NULL);
	_tmp0_ = *plug_info;
	_tmp1_ = _tmp0_.title;
	_tmp2_ = *plug_info;
	_tmp3_ = _tmp2_.title;
	_tmp4_ = g_strdup_printf (_ ("Open %s settings"), _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = *plug_info;
	_tmp7_ = _tmp6_.icon;
	_tmp8_ = *plug_info;
	_tmp9_ = _tmp8_.uri;
	self = (SynapseSwitchboardObject*) g_object_new (object_type, "title", _tmp1_, "description", _tmp5_, "icon-name", _tmp7_, "match-type", SYNAPSE_MATCH_TYPE_APPLICATION, "uri", _tmp9_, NULL);
	_g_free0 (_tmp5_);
	return self;
}

SynapseSwitchboardObject*
synapse_switchboard_object_new (SynapsePlugInfo* plug_info)
{
	return synapse_switchboard_object_construct (SYNAPSE_TYPE_SWITCHBOARD_OBJECT, plug_info);
}

static void
synapse_switchboard_object_real_execute (SynapseMatch* base,
                                         SynapseMatch* match)
{
	SynapseSwitchboardObject * self;
	GError* _inner_error0_ = NULL;
	self = (SynapseSwitchboardObject*) base;
	{
		const gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp0_ = self->priv->_uri;
		_tmp1_ = g_strdup_printf ("settings://%s", _tmp0_);
		_tmp2_ = _tmp1_;
		g_app_info_launch_default_for_uri (_tmp2_, NULL, &_inner_error0_);
		_g_free0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp3_;
		GError* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = self->priv->_uri;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		_tmp6_ = g_strdup_printf ("Failed to show URI for %s: %s\n", _tmp3_, _tmp5_);
		_tmp7_ = _tmp6_;
		g_warning ("switchboard-plugin.vala:60: %s", _tmp7_);
		_g_free0 (_tmp7_);
		_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;
	}
}

const gchar*
synapse_switchboard_object_get_uri (SynapseSwitchboardObject* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_uri;
	result = _tmp0_;
	return result;
}

void
synapse_switchboard_object_set_uri (SynapseSwitchboardObject* self,
                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = synapse_switchboard_object_get_uri (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_uri);
		self->priv->_uri = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, synapse_switchboard_object_properties[SYNAPSE_SWITCHBOARD_OBJECT_URI_PROPERTY]);
	}
}

static void
synapse_switchboard_object_class_init (SynapseSwitchboardObjectClass * klass,
                                       gpointer klass_data)
{
	synapse_switchboard_object_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SynapseSwitchboardObject_private_offset);
	((SynapseMatchClass *) klass)->execute = (void (*) (SynapseMatch*, SynapseMatch*)) synapse_switchboard_object_real_execute;
	G_OBJECT_CLASS (klass)->get_property = _vala_synapse_switchboard_object_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_synapse_switchboard_object_set_property;
	G_OBJECT_CLASS (klass)->finalize = synapse_switchboard_object_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SYNAPSE_SWITCHBOARD_OBJECT_URI_PROPERTY, synapse_switchboard_object_properties[SYNAPSE_SWITCHBOARD_OBJECT_URI_PROPERTY] = g_param_spec_string ("uri", "uri", "uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
synapse_switchboard_object_instance_init (SynapseSwitchboardObject * self,
                                          gpointer klass)
{
	self->priv = synapse_switchboard_object_get_instance_private (self);
}

static void
synapse_switchboard_object_finalize (GObject * obj)
{
	SynapseSwitchboardObject * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYNAPSE_TYPE_SWITCHBOARD_OBJECT, SynapseSwitchboardObject);
	_g_free0 (self->priv->_uri);
	G_OBJECT_CLASS (synapse_switchboard_object_parent_class)->finalize (obj);
}

static GType
synapse_switchboard_object_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SynapseSwitchboardObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) synapse_switchboard_object_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SynapseSwitchboardObject), 0, (GInstanceInitFunc) synapse_switchboard_object_instance_init, NULL };
	GType synapse_switchboard_object_type_id;
	synapse_switchboard_object_type_id = g_type_register_static (SYNAPSE_TYPE_MATCH, "SynapseSwitchboardObject", &g_define_type_info, 0);
	SynapseSwitchboardObject_private_offset = g_type_add_instance_private (synapse_switchboard_object_type_id, sizeof (SynapseSwitchboardObjectPrivate));
	return synapse_switchboard_object_type_id;
}

GType
synapse_switchboard_object_get_type (void)
{
	static volatile gsize synapse_switchboard_object_type_id__once = 0;
	if (g_once_init_enter (&synapse_switchboard_object_type_id__once)) {
		GType synapse_switchboard_object_type_id;
		synapse_switchboard_object_type_id = synapse_switchboard_object_get_type_once ();
		g_once_init_leave (&synapse_switchboard_object_type_id__once, synapse_switchboard_object_type_id);
	}
	return synapse_switchboard_object_type_id__once;
}

static void
_vala_synapse_switchboard_object_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	SynapseSwitchboardObject * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SYNAPSE_TYPE_SWITCHBOARD_OBJECT, SynapseSwitchboardObject);
	switch (property_id) {
		case SYNAPSE_SWITCHBOARD_OBJECT_URI_PROPERTY:
		g_value_set_string (value, synapse_switchboard_object_get_uri (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_synapse_switchboard_object_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	SynapseSwitchboardObject * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SYNAPSE_TYPE_SWITCHBOARD_OBJECT, SynapseSwitchboardObject);
	switch (property_id) {
		case SYNAPSE_SWITCHBOARD_OBJECT_URI_PROPERTY:
		synapse_switchboard_object_set_uri (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
synapse_switchboard_plugin_get_instance_private (SynapseSwitchboardPlugin* self)
{
	return G_STRUCT_MEMBER_P (self, SynapseSwitchboardPlugin_private_offset);
}

static void
_synapse_switchboard_plugin_register_plugin_synapse_plugin_register_func (void)
{
	synapse_switchboard_plugin_register_plugin ();
}

static void
synapse_switchboard_plugin_register_plugin (void)
{
	SynapseDataSinkPluginRegistry* _tmp0_;
	SynapseDataSinkPluginRegistry* _tmp1_;
	_tmp0_ = synapse_data_sink_plugin_registry_get_default ();
	_tmp1_ = _tmp0_;
	synapse_data_sink_plugin_registry_register_plugin (_tmp1_, SYNAPSE_TYPE_SWITCHBOARD_PLUGIN, "preferences-desktop", _synapse_switchboard_plugin_register_plugin_synapse_plugin_register_func, TRUE);
	_g_object_unref0 (_tmp1_);
}

static void
synapse_switchboard_plugin_real_activate (SynapseActivatable* base)
{
	SynapseSwitchboardPlugin * self;
	self = (SynapseSwitchboardPlugin*) base;
}

static void
synapse_switchboard_plugin_real_deactivate (SynapseActivatable* base)
{
	SynapseSwitchboardPlugin * self;
	self = (SynapseSwitchboardPlugin*) base;
}

static void
synapse_switchboard_plugin_real_search_data_free (gpointer _data)
{
	SynapseSwitchboardPluginSearchData* _data_;
	_data_ = _data;
	synapse_query_destroy (&_data_->q);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (SynapseSwitchboardPluginSearchData, _data_);
}

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

static void
synapse_switchboard_plugin_real_search (SynapseItemProvider* base,
                                        SynapseQuery* q,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	SynapseSwitchboardPlugin * self;
	SynapseSwitchboardPluginSearchData* _data_;
	SynapseSwitchboardPlugin* _tmp0_;
	SynapseQuery _tmp1_;
	SynapseQuery _tmp2_;
	SynapseQuery _tmp3_ = {0};
	g_return_if_fail (q != NULL);
	self = (SynapseSwitchboardPlugin*) base;
	_data_ = g_slice_new0 (SynapseSwitchboardPluginSearchData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, synapse_switchboard_plugin_real_search_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = *q;
	_tmp2_ = _tmp1_;
	synapse_query_copy (&_tmp2_, &_tmp3_);
	synapse_query_destroy (&_data_->q);
	_data_->q = _tmp3_;
	synapse_switchboard_plugin_real_search_co (_data_);
}

static SynapseResultSet*
synapse_switchboard_plugin_search_finish (SynapseItemProvider* base,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	SynapseResultSet* result;
	SynapseSwitchboardPluginSearchData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gboolean
synapse_switchboard_plugin_real_search_co (SynapseSwitchboardPluginSearchData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->executable_plugin;
	_data_->_tmp1_ = 0;
	_data_->_tmp2_ = synapse_switchboard_executable_plugin_get_plugs (_data_->_tmp0_, &_data_->_tmp1_);
	_data_->plugs = _data_->_tmp2_;
	_data_->plugs_length1 = _data_->_tmp1_;
	_data_->_plugs_size_ = _data_->plugs_length1;
	_data_->_tmp3_ = synapse_result_set_new ();
	_data_->_result_ = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->q;
	_data_->_tmp5_ = _data_->_tmp4_.query_string;
	_data_->_tmp6_ = strlen (_data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	if (_data_->_tmp7_ == 1) {
		_data_->flags = (SYNAPSE_MATCHER_FLAGS_NO_SUBSTRING | SYNAPSE_MATCHER_FLAGS_NO_PARTIAL) | SYNAPSE_MATCHER_FLAGS_NO_FUZZY;
	} else {
		_data_->flags = 0;
	}
	_data_->_tmp8_ = _data_->q;
	_data_->_tmp9_ = _data_->_tmp8_.query_string_folded;
	_data_->_tmp10_ = synapse_query_get_matchers_for_query (_data_->_tmp9_, _data_->flags, G_REGEX_OPTIMIZE);
	_data_->matchers = _data_->_tmp10_;
	_data_->_tmp11_ = _data_->q;
	_data_->_tmp12_ = _data_->_tmp11_.query_string;
	_data_->_tmp13_ = string_strip (_data_->_tmp12_);
	_data_->stripped = _data_->_tmp13_;
	_data_->_tmp14_ = _data_->stripped;
	if (g_strcmp0 (_data_->_tmp14_, "") == 0) {
		_data_->result = NULL;
		_g_free0 (_data_->stripped);
		_g_object_unref0 (_data_->matchers);
		_g_object_unref0 (_data_->_result_);
		_data_->plugs = (_vala_SynapsePlugInfo_array_free (_data_->plugs, _data_->plugs_length1), 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;
	}
	_data_->_tmp15_ = _data_->plugs;
	_data_->_tmp15__length1 = _data_->plugs_length1;
	{
		_data_->plug_collection_length1 = 0;
		_data_->_plug_collection_size_ = 0;
		_data_->plug_collection = _data_->_tmp15_;
		_data_->plug_collection_length1 = _data_->_tmp15__length1;
		for (_data_->plug_it = 0; _data_->plug_it < _data_->plug_collection_length1; _data_->plug_it = _data_->plug_it + 1) {
			_data_->plug = _data_->plug_collection[_data_->plug_it];
			{
				_data_->_tmp17_ = _data_->plug;
				_data_->_tmp18_ = _data_->_tmp17_.path;
				_data_->_tmp18__length1 = _data_->_tmp17_.path_length1;
				if (_data_->_tmp18__length1 > 0) {
					_data_->_tmp19_ = _data_->plug;
					_data_->_tmp20_ = _data_->_tmp19_.path;
					_data_->_tmp20__length1 = _data_->_tmp19_.path_length1;
					_data_->_tmp21_ = _data_->plug;
					_data_->_tmp22_ = _data_->_tmp21_.path;
					_data_->_tmp22__length1 = _data_->_tmp21_.path_length1;
					_data_->_tmp23_ = _data_->_tmp20_[_data_->_tmp22__length1 - 1];
					_data_->_tmp16_ = _data_->_tmp23_;
				} else {
					_data_->_tmp24_ = _data_->plug;
					_data_->_tmp25_ = _data_->_tmp24_.title;
					_data_->_tmp16_ = _data_->_tmp25_;
				}
				_data_->_tmp26_ = g_strdup (_data_->_tmp16_);
				_data_->searchable_name = _data_->_tmp26_;
				{
					_data_->_tmp27_ = _data_->matchers;
					_data_->_matcher_list = _data_->_tmp27_;
					_data_->_tmp28_ = _data_->_matcher_list;
					_data_->_tmp29_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp28_);
					_data_->_tmp30_ = _data_->_tmp29_;
					_data_->_matcher_size = _data_->_tmp30_;
					_data_->_matcher_index = -1;
					while (TRUE) {
						_data_->_matcher_index = _data_->_matcher_index + 1;
						_data_->_tmp31_ = _data_->_matcher_index;
						_data_->_tmp32_ = _data_->_matcher_size;
						if (!(_data_->_tmp31_ < _data_->_tmp32_)) {
							break;
						}
						_data_->_tmp33_ = _data_->_matcher_list;
						_data_->_tmp34_ = gee_list_get (_data_->_tmp33_, _data_->_matcher_index);
						_data_->matcher = (GeeMapEntry*) _data_->_tmp34_;
						_data_->_tmp35_ = _data_->matcher;
						_data_->_tmp36_ = gee_map_entry_get_key (_data_->_tmp35_);
						_data_->_tmp37_ = _data_->_tmp36_;
						_data_->_tmp38_ = _data_->searchable_name;
						_data_->_tmp39_ = g_utf8_strdown (_data_->_tmp38_, (gssize) -1);
						_data_->_tmp40_ = _data_->_tmp39_;
						_data_->_tmp41_ = NULL;
						_data_->_tmp42_ = g_regex_match ((GRegex*) _data_->_tmp37_, _data_->_tmp40_, 0, &_data_->_tmp41_);
						_g_match_info_unref0 (_data_->info);
						_data_->info = _data_->_tmp41_;
						_data_->_tmp43_ = _data_->_tmp42_;
						_g_free0 (_data_->_tmp40_);
						if (_data_->_tmp43_) {
							_data_->_tmp44_ = _data_->_result_;
							_data_->_tmp45_ = _data_->plug;
							_data_->_tmp46_ = synapse_switchboard_object_new (&_data_->_tmp45_);
							_data_->_tmp47_ = _data_->_tmp46_;
							synapse_result_set_add (_data_->_tmp44_, (SynapseMatch*) _data_->_tmp47_, (gint) (SYNAPSE_MATCH_SCORE_AVERAGE + SYNAPSE_MATCH_SCORE_INCREMENT_MEDIUM));
							_g_object_unref0 (_data_->_tmp47_);
							_g_match_info_unref0 (_data_->info);
							_g_object_unref0 (_data_->matcher);
							break;
						}
						_data_->_tmp48_ = _data_->matcher;
						_data_->_tmp49_ = gee_map_entry_get_key (_data_->_tmp48_);
						_data_->_tmp50_ = _data_->_tmp49_;
						_data_->_tmp51_ = _data_->plug;
						_data_->_tmp52_ = _data_->_tmp51_.title;
						_data_->_tmp53_ = g_utf8_strdown (_data_->_tmp52_, (gssize) -1);
						_data_->_tmp54_ = _data_->_tmp53_;
						_data_->_tmp55_ = NULL;
						_data_->_tmp56_ = g_regex_match ((GRegex*) _data_->_tmp50_, _data_->_tmp54_, 0, &_data_->_tmp55_);
						_g_match_info_unref0 (_data_->info);
						_data_->info = _data_->_tmp55_;
						_data_->_tmp57_ = _data_->_tmp56_;
						_g_free0 (_data_->_tmp54_);
						if (_data_->_tmp57_) {
							_data_->_tmp58_ = _data_->_result_;
							_data_->_tmp59_ = _data_->plug;
							_data_->_tmp60_ = synapse_switchboard_object_new (&_data_->_tmp59_);
							_data_->_tmp61_ = _data_->_tmp60_;
							synapse_result_set_add (_data_->_tmp58_, (SynapseMatch*) _data_->_tmp61_, (gint) (SYNAPSE_MATCH_SCORE_AVERAGE + SYNAPSE_MATCH_SCORE_INCREMENT_MEDIUM));
							_g_object_unref0 (_data_->_tmp61_);
							_g_match_info_unref0 (_data_->info);
							_g_object_unref0 (_data_->matcher);
							break;
						}
						_g_match_info_unref0 (_data_->info);
						_g_object_unref0 (_data_->matcher);
					}
				}
				_g_free0 (_data_->searchable_name);
			}
		}
	}
	synapse_query_check_cancellable (&_data_->q, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == SYNAPSE_SEARCH_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->stripped);
			_g_object_unref0 (_data_->matchers);
			_g_object_unref0 (_data_->_result_);
			_data_->plugs = (_vala_SynapsePlugInfo_array_free (_data_->plugs, _data_->plugs_length1), NULL);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_free0 (_data_->stripped);
			_g_object_unref0 (_data_->matchers);
			_g_object_unref0 (_data_->_result_);
			_data_->plugs = (_vala_SynapsePlugInfo_array_free (_data_->plugs, _data_->plugs_length1), 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;
		}
	}
	_data_->result = _data_->_result_;
	_g_free0 (_data_->stripped);
	_g_object_unref0 (_data_->matchers);
	_data_->plugs = (_vala_SynapsePlugInfo_array_free (_data_->plugs, _data_->plugs_length1), 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;
}

SynapseSwitchboardPlugin*
synapse_switchboard_plugin_construct (GType object_type)
{
	SynapseSwitchboardPlugin * self = NULL;
	self = (SynapseSwitchboardPlugin*) g_object_new (object_type, NULL);
	return self;
}

SynapseSwitchboardPlugin*
synapse_switchboard_plugin_new (void)
{
	return synapse_switchboard_plugin_construct (SYNAPSE_TYPE_SWITCHBOARD_PLUGIN);
}

static gboolean
synapse_switchboard_plugin_real_get_enabled (SynapseActivatable* base)
{
	gboolean result;
	SynapseSwitchboardPlugin* self;
	self = (SynapseSwitchboardPlugin*) base;
	result = self->priv->_enabled;
	return result;
}

static void
synapse_switchboard_plugin_real_set_enabled (SynapseActivatable* base,
                                             gboolean value)
{
	SynapseSwitchboardPlugin* self;
	gboolean old_value;
	self = (SynapseSwitchboardPlugin*) base;
	old_value = synapse_switchboard_plugin_real_get_enabled (base);
	if (old_value != value) {
		self->priv->_enabled = value;
		g_object_notify_by_pspec ((GObject *) self, synapse_switchboard_plugin_properties[SYNAPSE_SWITCHBOARD_PLUGIN_ENABLED_PROPERTY]);
	}
}

static void
_synapse_switchboard_plugin___lambda21_ (SynapseSwitchboardPlugin* self,
                                         GDBusConnection* connection)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (connection != NULL);
	{
		SynapseSwitchboardExecutablePlugin* _tmp0_;
		_tmp0_ = self->priv->executable_plugin;
		synapse_switchboard_executable_plugin_register_object (_tmp0_, connection, "/io/elementary/applicationsmenu", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		g_critical ("switchboard-plugin.vala:89: %s", _tmp2_);
		_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;
	}
}

static void
__synapse_switchboard_plugin___lambda21__synapse_worker_link_on_connection_accepted (SynapseWorkerLink* _sender,
                                                                                     GDBusConnection* connection,
                                                                                     gpointer self)
{
	_synapse_switchboard_plugin___lambda21_ ((SynapseSwitchboardPlugin*) self, connection);
}

static void
_synapse_switchboard_plugin____lambda22_ (SynapseSwitchboardPlugin* self,
                                          GObject* obj,
                                          GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		GSubprocess* _tmp0_;
		_tmp0_ = self->priv->subprocess;
		g_subprocess_wait_check_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		g_critical ("switchboard-plugin.vala:106: %s", _tmp2_);
		_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;
	}
	_g_object_unref0 (self->priv->subprocess);
	self->priv->subprocess = NULL;
}

static void
__synapse_switchboard_plugin____lambda22__gasync_ready_callback (GObject* source_object,
                                                                 GAsyncResult* res,
                                                                 gpointer self)
{
	_synapse_switchboard_plugin____lambda22_ ((SynapseSwitchboardPlugin*) self, source_object, res);
	g_object_unref (self);
}

static GObject *
synapse_switchboard_plugin_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SynapseSwitchboardPlugin * self;
	SynapseSwitchboardExecutablePlugin* _tmp0_;
	SynapseWorkerLink* _tmp1_;
	SynapseWorkerLink* _tmp2_;
	SynapseWorkerLink* _tmp3_;
	GSubprocessLauncher* launcher = NULL;
	GSubprocessLauncher* _tmp4_;
	gchar** argv = NULL;
	gchar* _tmp5_;
	SynapseWorkerLink* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar** _tmp10_;
	gint argv_length1;
	gint _argv_size_;
	GError* _inner_error0_ = NULL;
	parent_class = G_OBJECT_CLASS (synapse_switchboard_plugin_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYNAPSE_TYPE_SWITCHBOARD_PLUGIN, SynapseSwitchboardPlugin);
	_tmp0_ = synapse_switchboard_executable_plugin_new ();
	_g_object_unref0 (self->priv->executable_plugin);
	self->priv->executable_plugin = _tmp0_;
	_tmp1_ = synapse_worker_link_new ();
	_g_object_unref0 (self->priv->worker_link);
	self->priv->worker_link = _tmp1_;
	_tmp2_ = self->priv->worker_link;
	g_signal_connect_object (_tmp2_, "on-connection-accepted", (GCallback) __synapse_switchboard_plugin___lambda21__synapse_worker_link_on_connection_accepted, self, 0);
	_tmp3_ = self->priv->worker_link;
	synapse_worker_link_start (_tmp3_);
	_tmp4_ = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
	launcher = _tmp4_;
	_tmp5_ = g_build_filename (PLUGINSDIR, "switchboard-plugin", NULL);
	_tmp6_ = self->priv->worker_link;
	_tmp7_ = synapse_worker_link_get_address (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strdup_printf ("--dbus-address=%s", _tmp8_);
	_tmp10_ = g_new0 (gchar*, 2 + 1);
	_tmp10_[0] = _tmp5_;
	_tmp10_[1] = _tmp9_;
	argv = _tmp10_;
	argv_length1 = 2;
	_argv_size_ = argv_length1;
	{
		GSubprocess* _tmp11_ = NULL;
		GSubprocessLauncher* _tmp12_;
		gchar** _tmp13_;
		gint _tmp13__length1;
		GSubprocess* _tmp14_;
		GSubprocess* _tmp15_;
		GSubprocess* _tmp16_;
		_tmp12_ = launcher;
		_tmp13_ = argv;
		_tmp13__length1 = argv_length1;
		_tmp14_ = g_subprocess_launcher_spawnv (_tmp12_, _tmp13_, &_inner_error0_);
		_tmp11_ = _tmp14_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp15_ = _tmp11_;
		_tmp11_ = NULL;
		_g_object_unref0 (self->priv->subprocess);
		self->priv->subprocess = _tmp15_;
		_tmp16_ = self->priv->subprocess;
		g_subprocess_wait_check_async (_tmp16_, NULL, __synapse_switchboard_plugin____lambda22__gasync_ready_callback, g_object_ref (self));
		_g_object_unref0 (_tmp11_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp17_;
		const gchar* _tmp18_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp17_ = e;
		_tmp18_ = _tmp17_->message;
		g_warning ("switchboard-plugin.vala:112: Failed to spawn %s", _tmp18_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
		_g_object_unref0 (launcher);
		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_);
	}
	argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (launcher);
	return obj;
}

static void
synapse_switchboard_plugin_class_init (SynapseSwitchboardPluginClass * klass,
                                       gpointer klass_data)
{
	synapse_switchboard_plugin_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SynapseSwitchboardPlugin_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_synapse_switchboard_plugin_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_synapse_switchboard_plugin_set_property;
	G_OBJECT_CLASS (klass)->constructor = synapse_switchboard_plugin_constructor;
	G_OBJECT_CLASS (klass)->finalize = synapse_switchboard_plugin_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SYNAPSE_SWITCHBOARD_PLUGIN_ENABLED_PROPERTY, synapse_switchboard_plugin_properties[SYNAPSE_SWITCHBOARD_PLUGIN_ENABLED_PROPERTY] = g_param_spec_boolean ("enabled", "enabled", "enabled", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	synapse_switchboard_plugin_register_plugin ();
}

static void
synapse_switchboard_plugin_synapse_activatable_interface_init (SynapseActivatableIface * iface,
                                                               gpointer iface_data)
{
	synapse_switchboard_plugin_synapse_activatable_parent_iface = g_type_interface_peek_parent (iface);
	iface->activate = (void (*) (SynapseActivatable*)) synapse_switchboard_plugin_real_activate;
	iface->deactivate = (void (*) (SynapseActivatable*)) synapse_switchboard_plugin_real_deactivate;
	iface->get_enabled = synapse_switchboard_plugin_real_get_enabled;
	iface->set_enabled = synapse_switchboard_plugin_real_set_enabled;
}

static void
synapse_switchboard_plugin_synapse_item_provider_interface_init (SynapseItemProviderIface * iface,
                                                                 gpointer iface_data)
{
	synapse_switchboard_plugin_synapse_item_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->search = (void (*) (SynapseItemProvider*, SynapseQuery*, GAsyncReadyCallback, gpointer)) synapse_switchboard_plugin_real_search;
	iface->search_finish = (SynapseResultSet* (*) (SynapseItemProvider*, GAsyncResult*, GError**)) synapse_switchboard_plugin_search_finish;
}

static void
synapse_switchboard_plugin_instance_init (SynapseSwitchboardPlugin * self,
                                          gpointer klass)
{
	self->priv = synapse_switchboard_plugin_get_instance_private (self);
	self->priv->_enabled = TRUE;
}

static void
synapse_switchboard_plugin_finalize (GObject * obj)
{
	SynapseSwitchboardPlugin * self;
	GSubprocess* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYNAPSE_TYPE_SWITCHBOARD_PLUGIN, SynapseSwitchboardPlugin);
	_tmp0_ = self->priv->subprocess;
	if (_tmp0_ != NULL) {
		GSubprocess* _tmp1_;
		_tmp1_ = self->priv->subprocess;
		g_subprocess_force_exit (_tmp1_);
	}
	_g_object_unref0 (self->priv->worker_link);
	_g_object_unref0 (self->priv->subprocess);
	_g_object_unref0 (self->priv->executable_plugin);
	G_OBJECT_CLASS (synapse_switchboard_plugin_parent_class)->finalize (obj);
}

static GType
synapse_switchboard_plugin_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SynapseSwitchboardPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) synapse_switchboard_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SynapseSwitchboardPlugin), 0, (GInstanceInitFunc) synapse_switchboard_plugin_instance_init, NULL };
	static const GInterfaceInfo synapse_activatable_info = { (GInterfaceInitFunc) synapse_switchboard_plugin_synapse_activatable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo synapse_item_provider_info = { (GInterfaceInitFunc) synapse_switchboard_plugin_synapse_item_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType synapse_switchboard_plugin_type_id;
	synapse_switchboard_plugin_type_id = g_type_register_static (G_TYPE_OBJECT, "SynapseSwitchboardPlugin", &g_define_type_info, 0);
	g_type_add_interface_static (synapse_switchboard_plugin_type_id, SYNAPSE_TYPE_ACTIVATABLE, &synapse_activatable_info);
	g_type_add_interface_static (synapse_switchboard_plugin_type_id, SYNAPSE_TYPE_ITEM_PROVIDER, &synapse_item_provider_info);
	SynapseSwitchboardPlugin_private_offset = g_type_add_instance_private (synapse_switchboard_plugin_type_id, sizeof (SynapseSwitchboardPluginPrivate));
	return synapse_switchboard_plugin_type_id;
}

GType
synapse_switchboard_plugin_get_type (void)
{
	static volatile gsize synapse_switchboard_plugin_type_id__once = 0;
	if (g_once_init_enter (&synapse_switchboard_plugin_type_id__once)) {
		GType synapse_switchboard_plugin_type_id;
		synapse_switchboard_plugin_type_id = synapse_switchboard_plugin_get_type_once ();
		g_once_init_leave (&synapse_switchboard_plugin_type_id__once, synapse_switchboard_plugin_type_id);
	}
	return synapse_switchboard_plugin_type_id__once;
}

static void
_vala_synapse_switchboard_plugin_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	SynapseSwitchboardPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SYNAPSE_TYPE_SWITCHBOARD_PLUGIN, SynapseSwitchboardPlugin);
	switch (property_id) {
		case SYNAPSE_SWITCHBOARD_PLUGIN_ENABLED_PROPERTY:
		g_value_set_boolean (value, synapse_activatable_get_enabled ((SynapseActivatable*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_synapse_switchboard_plugin_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	SynapseSwitchboardPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SYNAPSE_TYPE_SWITCHBOARD_PLUGIN, SynapseSwitchboardPlugin);
	switch (property_id) {
		case SYNAPSE_SWITCHBOARD_PLUGIN_ENABLED_PROPERTY:
		synapse_activatable_set_enabled ((SynapseActivatable*) self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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);
}

