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

/*
* Copyright (c) 2010 Michal Hruby <michal.mhr@gmail.com>
*               2017 elementary LLC.
*
* 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
*
* Authored by: Michal Hruby <michal.mhr@gmail.com>
*              Alberto Aldegheri <albyrock87+dev@gmail.com>
*/

#include "slingshot.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.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

enum  {
	SYNAPSE_MATCH_0_PROPERTY,
	SYNAPSE_MATCH_TITLE_PROPERTY,
	SYNAPSE_MATCH_DESCRIPTION_PROPERTY,
	SYNAPSE_MATCH_ICON_NAME_PROPERTY,
	SYNAPSE_MATCH_HAS_THUMBNAIL_PROPERTY,
	SYNAPSE_MATCH_THUMBNAIL_PATH_PROPERTY,
	SYNAPSE_MATCH_MATCH_TYPE_PROPERTY,
	SYNAPSE_MATCH_NUM_PROPERTIES
};
static GParamSpec* synapse_match_properties[SYNAPSE_MATCH_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	SYNAPSE_MATCH_EXECUTED_SIGNAL,
	SYNAPSE_MATCH_NUM_SIGNALS
};
static guint synapse_match_signals[SYNAPSE_MATCH_NUM_SIGNALS] = {0};

struct _SynapseMatchPrivate {
	gchar* _title;
	gchar* _description;
	gchar* _icon_name;
	gboolean _has_thumbnail;
	gchar* _thumbnail_path;
	SynapseMatchType _match_type;
};

static gint SynapseMatch_private_offset;
static gpointer synapse_match_parent_class = NULL;
static GType synapse_match_type_id = 0;

static void synapse_match_real_execute (SynapseMatch* self,
                                 SynapseMatch* match);
static void synapse_match_real_execute_with_target (SynapseMatch* self,
                                             SynapseMatch* source,
                                             SynapseMatch* target);
static gboolean synapse_match_real_needs_target (SynapseMatch* self);
static SynapseQueryFlags synapse_match_real_target_flags (SynapseMatch* self);
static void synapse_match_finalize (GObject * obj);
static void _vala_synapse_match_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_synapse_match_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);

static GType
synapse_match_type_get_type_once (void)
{
	static const GEnumValue values[] = {{SYNAPSE_MATCH_TYPE_UNKNOWN, "SYNAPSE_MATCH_TYPE_UNKNOWN", "unknown"}, {SYNAPSE_MATCH_TYPE_TEXT, "SYNAPSE_MATCH_TYPE_TEXT", "text"}, {SYNAPSE_MATCH_TYPE_APPLICATION, "SYNAPSE_MATCH_TYPE_APPLICATION", "application"}, {SYNAPSE_MATCH_TYPE_BOOKMARK, "SYNAPSE_MATCH_TYPE_BOOKMARK", "bookmark"}, {SYNAPSE_MATCH_TYPE_GENERIC_URI, "SYNAPSE_MATCH_TYPE_GENERIC_URI", "generic-uri"}, {SYNAPSE_MATCH_TYPE_ACTION, "SYNAPSE_MATCH_TYPE_ACTION", "action"}, {SYNAPSE_MATCH_TYPE_SEARCH, "SYNAPSE_MATCH_TYPE_SEARCH", "search"}, {SYNAPSE_MATCH_TYPE_CONTACT, "SYNAPSE_MATCH_TYPE_CONTACT", "contact"}, {0, NULL, NULL}};
	GType synapse_match_type_type_id;
	synapse_match_type_type_id = g_enum_register_static ("SynapseMatchType", values);
	return synapse_match_type_type_id;
}

GType
synapse_match_type_get_type (void)
{
	static volatile gsize synapse_match_type_type_id__once = 0;
	if (g_once_init_enter (&synapse_match_type_type_id__once)) {
		GType synapse_match_type_type_id;
		synapse_match_type_type_id = synapse_match_type_get_type_once ();
		g_once_init_leave (&synapse_match_type_type_id__once, synapse_match_type_type_id);
	}
	return synapse_match_type_type_id__once;
}

static inline gpointer
synapse_match_get_instance_private (SynapseMatch* self)
{
	return G_STRUCT_MEMBER_P (self, SynapseMatch_private_offset);
}

static GType
synapse_match_score_get_type_once (void)
{
	static const GEnumValue values[] = {{SYNAPSE_MATCH_SCORE_INCREMENT_MINOR, "SYNAPSE_MATCH_SCORE_INCREMENT_MINOR", "increment-minor"}, {SYNAPSE_MATCH_SCORE_INCREMENT_SMALL, "SYNAPSE_MATCH_SCORE_INCREMENT_SMALL", "increment-small"}, {SYNAPSE_MATCH_SCORE_INCREMENT_MEDIUM, "SYNAPSE_MATCH_SCORE_INCREMENT_MEDIUM", "increment-medium"}, {SYNAPSE_MATCH_SCORE_INCREMENT_LARGE, "SYNAPSE_MATCH_SCORE_INCREMENT_LARGE", "increment-large"}, {SYNAPSE_MATCH_SCORE_URI_PENALTY, "SYNAPSE_MATCH_SCORE_URI_PENALTY", "uri-penalty"}, {SYNAPSE_MATCH_SCORE_POOR, "SYNAPSE_MATCH_SCORE_POOR", "poor"}, {SYNAPSE_MATCH_SCORE_BELOW_AVERAGE, "SYNAPSE_MATCH_SCORE_BELOW_AVERAGE", "below-average"}, {SYNAPSE_MATCH_SCORE_AVERAGE, "SYNAPSE_MATCH_SCORE_AVERAGE", "average"}, {SYNAPSE_MATCH_SCORE_ABOVE_AVERAGE, "SYNAPSE_MATCH_SCORE_ABOVE_AVERAGE", "above-average"}, {SYNAPSE_MATCH_SCORE_GOOD, "SYNAPSE_MATCH_SCORE_GOOD", "good"}, {SYNAPSE_MATCH_SCORE_VERY_GOOD, "SYNAPSE_MATCH_SCORE_VERY_GOOD", "very-good"}, {SYNAPSE_MATCH_SCORE_EXCELLENT, "SYNAPSE_MATCH_SCORE_EXCELLENT", "excellent"}, {SYNAPSE_MATCH_SCORE_HIGHEST, "SYNAPSE_MATCH_SCORE_HIGHEST", "highest"}, {0, NULL, NULL}};
	GType synapse_match_score_type_id;
	synapse_match_score_type_id = g_enum_register_static ("SynapseMatchScore", values);
	return synapse_match_score_type_id;
}

GType
synapse_match_score_get_type (void)
{
	static volatile gsize synapse_match_score_type_id__once = 0;
	if (g_once_init_enter (&synapse_match_score_type_id__once)) {
		GType synapse_match_score_type_id;
		synapse_match_score_type_id = synapse_match_score_get_type_once ();
		g_once_init_leave (&synapse_match_score_type_id__once, synapse_match_score_type_id);
	}
	return synapse_match_score_type_id__once;
}

static void
synapse_match_real_execute (SynapseMatch* self,
                            SynapseMatch* match)
{
	g_critical ("Match.vala:63: execute () is not implemented");
}

void
synapse_match_execute (SynapseMatch* self,
                       SynapseMatch* match)
{
	SynapseMatchClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = SYNAPSE_MATCH_GET_CLASS (self);
	if (_klass_->execute) {
		_klass_->execute (self, match);
	}
}

static void
synapse_match_real_execute_with_target (SynapseMatch* self,
                                        SynapseMatch* source,
                                        SynapseMatch* target)
{
	if (target == NULL) {
		synapse_match_execute (self, source);
	} else {
		g_critical ("Match.vala:70: execute () is not implemented");
	}
}

void
synapse_match_execute_with_target (SynapseMatch* self,
                                   SynapseMatch* source,
                                   SynapseMatch* target)
{
	SynapseMatchClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = SYNAPSE_MATCH_GET_CLASS (self);
	if (_klass_->execute_with_target) {
		_klass_->execute_with_target (self, source, target);
	}
}

static gboolean
synapse_match_real_needs_target (SynapseMatch* self)
{
	gboolean result;
	result = FALSE;
	return result;
}

gboolean
synapse_match_needs_target (SynapseMatch* self)
{
	SynapseMatchClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = SYNAPSE_MATCH_GET_CLASS (self);
	if (_klass_->needs_target) {
		return _klass_->needs_target (self);
	}
	return FALSE;
}

static SynapseQueryFlags
synapse_match_real_target_flags (SynapseMatch* self)
{
	SynapseQueryFlags result;
	result = SYNAPSE_QUERY_FLAGS_ALL;
	return result;
}

SynapseQueryFlags
synapse_match_target_flags (SynapseMatch* self)
{
	SynapseMatchClass* _klass_;
	g_return_val_if_fail (self != NULL, 0U);
	_klass_ = SYNAPSE_MATCH_GET_CLASS (self);
	if (_klass_->target_flags) {
		return _klass_->target_flags (self);
	}
	return 0U;
}

SynapseMatch*
synapse_match_construct (GType object_type)
{
	SynapseMatch * self = NULL;
	self = (SynapseMatch*) g_object_new (object_type, NULL);
	return self;
}

const gchar*
synapse_match_get_title (SynapseMatch* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_title;
	result = _tmp0_;
	return result;
}

void
synapse_match_set_title (SynapseMatch* self,
                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = synapse_match_get_title (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_title);
		self->priv->_title = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, synapse_match_properties[SYNAPSE_MATCH_TITLE_PROPERTY]);
	}
}

const gchar*
synapse_match_get_description (SynapseMatch* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_description;
	result = _tmp0_;
	return result;
}

void
synapse_match_set_description (SynapseMatch* self,
                               const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = synapse_match_get_description (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_description);
		self->priv->_description = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, synapse_match_properties[SYNAPSE_MATCH_DESCRIPTION_PROPERTY]);
	}
}

const gchar*
synapse_match_get_icon_name (SynapseMatch* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_icon_name;
	result = _tmp0_;
	return result;
}

void
synapse_match_set_icon_name (SynapseMatch* self,
                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = synapse_match_get_icon_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_icon_name);
		self->priv->_icon_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, synapse_match_properties[SYNAPSE_MATCH_ICON_NAME_PROPERTY]);
	}
}

gboolean
synapse_match_get_has_thumbnail (SynapseMatch* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_has_thumbnail;
	return result;
}

void
synapse_match_set_has_thumbnail (SynapseMatch* self,
                                 gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = synapse_match_get_has_thumbnail (self);
	if (old_value != value) {
		self->priv->_has_thumbnail = value;
		g_object_notify_by_pspec ((GObject *) self, synapse_match_properties[SYNAPSE_MATCH_HAS_THUMBNAIL_PROPERTY]);
	}
}

const gchar*
synapse_match_get_thumbnail_path (SynapseMatch* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_thumbnail_path;
	result = _tmp0_;
	return result;
}

void
synapse_match_set_thumbnail_path (SynapseMatch* self,
                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = synapse_match_get_thumbnail_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_thumbnail_path);
		self->priv->_thumbnail_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, synapse_match_properties[SYNAPSE_MATCH_THUMBNAIL_PATH_PROPERTY]);
	}
}

SynapseMatchType
synapse_match_get_match_type (SynapseMatch* self)
{
	SynapseMatchType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_match_type;
	return result;
}

void
synapse_match_set_match_type (SynapseMatch* self,
                              SynapseMatchType value)
{
	SynapseMatchType old_value;
	g_return_if_fail (self != NULL);
	old_value = synapse_match_get_match_type (self);
	if (old_value != value) {
		self->priv->_match_type = value;
		g_object_notify_by_pspec ((GObject *) self, synapse_match_properties[SYNAPSE_MATCH_MATCH_TYPE_PROPERTY]);
	}
}

static void
synapse_match_class_init (SynapseMatchClass * klass,
                          gpointer klass_data)
{
	synapse_match_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SynapseMatch_private_offset);
	((SynapseMatchClass *) klass)->execute = (void (*) (SynapseMatch*, SynapseMatch*)) synapse_match_real_execute;
	((SynapseMatchClass *) klass)->execute_with_target = (void (*) (SynapseMatch*, SynapseMatch*, SynapseMatch*)) synapse_match_real_execute_with_target;
	((SynapseMatchClass *) klass)->needs_target = (gboolean (*) (SynapseMatch*)) synapse_match_real_needs_target;
	((SynapseMatchClass *) klass)->target_flags = (SynapseQueryFlags (*) (SynapseMatch*)) synapse_match_real_target_flags;
	G_OBJECT_CLASS (klass)->get_property = _vala_synapse_match_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_synapse_match_set_property;
	G_OBJECT_CLASS (klass)->finalize = synapse_match_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SYNAPSE_MATCH_TITLE_PROPERTY, synapse_match_properties[SYNAPSE_MATCH_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SYNAPSE_MATCH_DESCRIPTION_PROPERTY, synapse_match_properties[SYNAPSE_MATCH_DESCRIPTION_PROPERTY] = g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SYNAPSE_MATCH_ICON_NAME_PROPERTY, synapse_match_properties[SYNAPSE_MATCH_ICON_NAME_PROPERTY] = g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SYNAPSE_MATCH_HAS_THUMBNAIL_PROPERTY, synapse_match_properties[SYNAPSE_MATCH_HAS_THUMBNAIL_PROPERTY] = g_param_spec_boolean ("has-thumbnail", "has-thumbnail", "has-thumbnail", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SYNAPSE_MATCH_THUMBNAIL_PATH_PROPERTY, synapse_match_properties[SYNAPSE_MATCH_THUMBNAIL_PATH_PROPERTY] = g_param_spec_string ("thumbnail-path", "thumbnail-path", "thumbnail-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SYNAPSE_MATCH_MATCH_TYPE_PROPERTY, synapse_match_properties[SYNAPSE_MATCH_MATCH_TYPE_PROPERTY] = g_param_spec_enum ("match-type", "match-type", "match-type", SYNAPSE_TYPE_MATCH_TYPE, SYNAPSE_MATCH_TYPE_UNKNOWN, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	synapse_match_signals[SYNAPSE_MATCH_EXECUTED_SIGNAL] = g_signal_new ("executed", SYNAPSE_TYPE_MATCH, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
synapse_match_instance_init (SynapseMatch * self,
                             gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	self->priv = synapse_match_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_title = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->priv->_description = _tmp1_;
	self->priv->_icon_name = NULL;
	self->priv->_has_thumbnail = FALSE;
	self->priv->_thumbnail_path = NULL;
	self->priv->_match_type = SYNAPSE_MATCH_TYPE_UNKNOWN;
}

static void
synapse_match_finalize (GObject * obj)
{
	SynapseMatch * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYNAPSE_TYPE_MATCH, SynapseMatch);
	_g_free0 (self->priv->_title);
	_g_free0 (self->priv->_description);
	_g_free0 (self->priv->_icon_name);
	_g_free0 (self->priv->_thumbnail_path);
	G_OBJECT_CLASS (synapse_match_parent_class)->finalize (obj);
}

GType
synapse_match_get_type (void)
{
	return synapse_match_type_id;
}

GType
synapse_match_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (SynapseMatchClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) synapse_match_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SynapseMatch), 0, (GInstanceInitFunc) synapse_match_instance_init, NULL };
	synapse_match_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "SynapseMatch", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	SynapseMatch_private_offset = sizeof (SynapseMatchPrivate);
	return synapse_match_type_id;
}

static void
_vala_synapse_match_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	SynapseMatch * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SYNAPSE_TYPE_MATCH, SynapseMatch);
	switch (property_id) {
		case SYNAPSE_MATCH_TITLE_PROPERTY:
		g_value_set_string (value, synapse_match_get_title (self));
		break;
		case SYNAPSE_MATCH_DESCRIPTION_PROPERTY:
		g_value_set_string (value, synapse_match_get_description (self));
		break;
		case SYNAPSE_MATCH_ICON_NAME_PROPERTY:
		g_value_set_string (value, synapse_match_get_icon_name (self));
		break;
		case SYNAPSE_MATCH_HAS_THUMBNAIL_PROPERTY:
		g_value_set_boolean (value, synapse_match_get_has_thumbnail (self));
		break;
		case SYNAPSE_MATCH_THUMBNAIL_PATH_PROPERTY:
		g_value_set_string (value, synapse_match_get_thumbnail_path (self));
		break;
		case SYNAPSE_MATCH_MATCH_TYPE_PROPERTY:
		g_value_set_enum (value, synapse_match_get_match_type (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_synapse_match_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	SynapseMatch * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SYNAPSE_TYPE_MATCH, SynapseMatch);
	switch (property_id) {
		case SYNAPSE_MATCH_TITLE_PROPERTY:
		synapse_match_set_title (self, g_value_get_string (value));
		break;
		case SYNAPSE_MATCH_DESCRIPTION_PROPERTY:
		synapse_match_set_description (self, g_value_get_string (value));
		break;
		case SYNAPSE_MATCH_ICON_NAME_PROPERTY:
		synapse_match_set_icon_name (self, g_value_get_string (value));
		break;
		case SYNAPSE_MATCH_HAS_THUMBNAIL_PROPERTY:
		synapse_match_set_has_thumbnail (self, g_value_get_boolean (value));
		break;
		case SYNAPSE_MATCH_THUMBNAIL_PATH_PROPERTY:
		synapse_match_set_thumbnail_path (self, g_value_get_string (value));
		break;
		case SYNAPSE_MATCH_MATCH_TYPE_PROPERTY:
		synapse_match_set_match_type (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

