/* highlight-word-selection.c generated by valac 0.56.19, the Vala compiler
 * generated from highlight-word-selection.vala, do not modify */

/* -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-*/

#include "highlight-word-selection.h"
#include "codecore.h"
#include <gtksourceview/gtksource.h>
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <libpeas.h>

#define SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_SELECTION_HIGHLIGHT_MAX_CHARS ((guint) 255)
#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  {
	SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_0_PROPERTY,
	SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_OBJECT_PROPERTY,
	SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_NUM_PROPERTIES
};
static GParamSpec* scratch_plugins_highlight_selected_words_properties[SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define __vala_GtkTextIter_free0(var) ((var == NULL) ? NULL : (var = (_vala_GtkTextIter_free (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _ScratchPluginsHighlightSelectedWordsPrivate {
	ScratchWidgetsSourceView* current_source;
	ScratchMainWindow* main_window;
	GtkSourceSearchContext* current_search_context;
	ScratchServicesInterface* plugins;
	GObject* _object;
};

static gint ScratchPluginsHighlightSelectedWords_private_offset;
static gpointer scratch_plugins_highlight_selected_words_parent_class = NULL;
static ScratchServicesActivatablePluginIface * scratch_plugins_highlight_selected_words_scratch_services_activatable_plugin_parent_iface = NULL;
static GType scratch_plugins_highlight_selected_words_type_id = 0;

static void scratch_plugins_highlight_selected_words_real_update_state (ScratchServicesActivatablePlugin* base);
static void scratch_plugins_highlight_selected_words_real_activate (ScratchServicesActivatablePlugin* base);
static void __lambda4_ (ScratchPluginsHighlightSelectedWords* self,
                 ScratchServicesDocument* doc);
static void scratch_plugins_highlight_selected_words_on_selection_changed (ScratchPluginsHighlightSelectedWords* self);
static void _scratch_plugins_highlight_selected_words_on_selection_changed_scratch_widgets_source_view_selection_changed (ScratchWidgetsSourceView* _sender,
                                                                                                                   GtkTextIter* start_iter,
                                                                                                                   GtkTextIter* end_iter,
                                                                                                                   gpointer self);
static void ___lambda4__scratch_services_interface_hook_document (ScratchServicesInterface* _sender,
                                                           ScratchServicesDocument* doc,
                                                           gpointer self);
static void __lambda9_ (ScratchPluginsHighlightSelectedWords* self,
                 ScratchMainWindow* w);
static void ___lambda9__scratch_services_interface_hook_window (ScratchServicesInterface* _sender,
                                                         ScratchMainWindow* window,
                                                         gpointer self);
static gboolean ___lambda5_ (ScratchPluginsHighlightSelectedWords* self,
                      gunichar uc);
static gboolean ____lambda5__gtk_text_char_predicate (gunichar ch,
                                               gpointer self);
static gboolean ___lambda6_ (ScratchPluginsHighlightSelectedWords* self,
                      gunichar uc);
static gboolean ____lambda6__gtk_text_char_predicate (gunichar ch,
                                               gpointer self);
static gboolean ___lambda7_ (ScratchPluginsHighlightSelectedWords* self,
                      gunichar uc);
static gboolean ____lambda7__gtk_text_char_predicate (gunichar ch,
                                               gpointer self);
static gboolean ___lambda8_ (ScratchPluginsHighlightSelectedWords* self,
                      gunichar uc);
static gboolean ____lambda8__gtk_text_char_predicate (gunichar ch,
                                               gpointer self);
static void _vala_GtkTextIter_free (GtkTextIter* self);
static void scratch_plugins_highlight_selected_words_real_deactivate (ScratchServicesActivatablePlugin* base);
static void scratch_plugins_highlight_selected_words_finalize (GObject * obj);
static void _vala_scratch_plugins_highlight_selected_words_get_property (GObject * object,
                                                                  guint property_id,
                                                                  GValue * value,
                                                                  GParamSpec * pspec);
static void _vala_scratch_plugins_highlight_selected_words_set_property (GObject * object,
                                                                  guint property_id,
                                                                  const GValue * value,
                                                                  GParamSpec * pspec);

static inline gpointer
scratch_plugins_highlight_selected_words_get_instance_private (ScratchPluginsHighlightSelectedWords* self)
{
	return G_STRUCT_MEMBER_P (self, ScratchPluginsHighlightSelectedWords_private_offset);
}

static void
scratch_plugins_highlight_selected_words_real_update_state (ScratchServicesActivatablePlugin* base)
{
	ScratchPluginsHighlightSelectedWords * self;
	self = (ScratchPluginsHighlightSelectedWords*) base;
}

static void
_scratch_plugins_highlight_selected_words_on_selection_changed_scratch_widgets_source_view_selection_changed (ScratchWidgetsSourceView* _sender,
                                                                                                              GtkTextIter* start_iter,
                                                                                                              GtkTextIter* end_iter,
                                                                                                              gpointer self)
{
	scratch_plugins_highlight_selected_words_on_selection_changed ((ScratchPluginsHighlightSelectedWords*) self);
}

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

static void
__lambda4_ (ScratchPluginsHighlightSelectedWords* self,
            ScratchServicesDocument* doc)
{
	ScratchWidgetsSourceView* _tmp0_;
	ScratchWidgetsSourceView* _tmp3_;
	ScratchWidgetsSourceView* _tmp4_;
	ScratchWidgetsSourceView* _tmp5_;
	ScratchWidgetsSourceView* _tmp6_;
	g_return_if_fail (doc != NULL);
	_tmp0_ = self->priv->current_source;
	if (_tmp0_ != NULL) {
		ScratchWidgetsSourceView* _tmp1_;
		guint _tmp2_;
		_tmp1_ = self->priv->current_source;
		g_signal_parse_name ("selection-changed", SCRATCH_WIDGETS_TYPE_SOURCE_VIEW, &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _scratch_plugins_highlight_selected_words_on_selection_changed_scratch_widgets_source_view_selection_changed, self);
	}
	_tmp3_ = scratch_services_document_get_source_view (doc);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 (self->priv->current_source);
	self->priv->current_source = _tmp5_;
	_tmp6_ = self->priv->current_source;
	g_signal_connect_object (_tmp6_, "selection-changed", (GCallback) _scratch_plugins_highlight_selected_words_on_selection_changed_scratch_widgets_source_view_selection_changed, self, 0);
}

static void
___lambda4__scratch_services_interface_hook_document (ScratchServicesInterface* _sender,
                                                      ScratchServicesDocument* doc,
                                                      gpointer self)
{
	__lambda4_ ((ScratchPluginsHighlightSelectedWords*) self, doc);
}

static void
__lambda9_ (ScratchPluginsHighlightSelectedWords* self,
            ScratchMainWindow* w)
{
	ScratchMainWindow* _tmp0_;
	g_return_if_fail (w != NULL);
	_tmp0_ = _g_object_ref0 (w);
	_g_object_unref0 (self->priv->main_window);
	self->priv->main_window = _tmp0_;
}

static void
___lambda9__scratch_services_interface_hook_window (ScratchServicesInterface* _sender,
                                                    ScratchMainWindow* window,
                                                    gpointer self)
{
	__lambda9_ ((ScratchPluginsHighlightSelectedWords*) self, window);
}

static void
scratch_plugins_highlight_selected_words_real_activate (ScratchServicesActivatablePlugin* base)
{
	ScratchPluginsHighlightSelectedWords * self;
	GObject* _tmp0_;
	GObject* _tmp1_;
	ScratchServicesInterface* _tmp2_;
	ScratchServicesInterface* _tmp3_;
	self = (ScratchPluginsHighlightSelectedWords*) base;
	_tmp0_ = scratch_services_activatable_plugin_get_object ((ScratchServicesActivatablePlugin*) self);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (self->priv->plugins);
	self->priv->plugins = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, SCRATCH_SERVICES_TYPE_INTERFACE, ScratchServicesInterface);
	_tmp2_ = self->priv->plugins;
	g_signal_connect_object (_tmp2_, "hook-document", (GCallback) ___lambda4__scratch_services_interface_hook_document, self, 0);
	_tmp3_ = self->priv->plugins;
	g_signal_connect_object (_tmp3_, "hook-window", (GCallback) ___lambda9__scratch_services_interface_hook_window, self, 0);
}

static gboolean
___lambda5_ (ScratchPluginsHighlightSelectedWords* self,
             gunichar uc)
{
	gboolean result;
	result = !g_unichar_isspace (uc);
	return result;
}

static gboolean
____lambda5__gtk_text_char_predicate (gunichar ch,
                                      gpointer self)
{
	gboolean result;
	result = ___lambda5_ ((ScratchPluginsHighlightSelectedWords*) self, ch);
	return result;
}

static gboolean
___lambda6_ (ScratchPluginsHighlightSelectedWords* self,
             gunichar uc)
{
	GUnicodeBreakType break_type = 0;
	gboolean _tmp0_ = FALSE;
	gboolean result;
	break_type = g_unichar_break_type (uc);
	if (break_type == G_UNICODE_BREAK_ALPHABETIC) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = break_type == G_UNICODE_BREAK_WORD_JOINER;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	} else {
		result = TRUE;
		return result;
	}
}

static gboolean
____lambda6__gtk_text_char_predicate (gunichar ch,
                                      gpointer self)
{
	gboolean result;
	result = ___lambda6_ ((ScratchPluginsHighlightSelectedWords*) self, ch);
	return result;
}

static gboolean
___lambda7_ (ScratchPluginsHighlightSelectedWords* self,
             gunichar uc)
{
	gboolean result;
	result = !g_unichar_isspace (uc);
	return result;
}

static gboolean
____lambda7__gtk_text_char_predicate (gunichar ch,
                                      gpointer self)
{
	gboolean result;
	result = ___lambda7_ ((ScratchPluginsHighlightSelectedWords*) self, ch);
	return result;
}

static gboolean
___lambda8_ (ScratchPluginsHighlightSelectedWords* self,
             gunichar uc)
{
	GUnicodeBreakType break_type = 0;
	gboolean _tmp0_ = FALSE;
	gboolean result;
	break_type = g_unichar_break_type (uc);
	if (break_type == G_UNICODE_BREAK_ALPHABETIC) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = break_type == G_UNICODE_BREAK_WORD_JOINER;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	} else {
		result = TRUE;
		return result;
	}
}

static gboolean
____lambda8__gtk_text_char_predicate (gunichar ch,
                                      gpointer self)
{
	gboolean result;
	result = ___lambda8_ ((ScratchPluginsHighlightSelectedWords*) self, ch);
	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 void
_vala_GtkTextIter_free (GtkTextIter* self)
{
	g_boxed_free (gtk_text_iter_get_type (), self);
}

static void
scratch_plugins_highlight_selected_words_on_selection_changed (ScratchPluginsHighlightSelectedWords* self)
{
	ScratchMainWindow* _tmp0_;
	GtkSourceSearchContext* _tmp1_;
	GtkTextIter start = {0};
	GtkTextIter end = {0};
	gboolean _tmp3_ = FALSE;
	ScratchWidgetsSourceView* _tmp4_;
	GtkTextBuffer* _tmp5_;
	GtkTextBuffer* _tmp6_;
	GtkTextIter _tmp7_ = {0};
	GtkTextIter _tmp8_ = {0};
	gboolean _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->main_window;
	_vala_return_if_fail (_tmp0_ != NULL, "main_window != null");
	_tmp1_ = self->priv->current_search_context;
	if (_tmp1_ != NULL) {
		GtkSourceSearchContext* _tmp2_;
		_tmp2_ = self->priv->current_search_context;
		gtk_source_search_context_set_highlight (_tmp2_, FALSE);
		_g_object_unref0 (self->priv->current_search_context);
		self->priv->current_search_context = NULL;
	}
	_tmp4_ = self->priv->current_source;
	_tmp5_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp4_);
	_tmp6_ = _tmp5_;
	_tmp9_ = gtk_text_buffer_get_selection_bounds (_tmp6_, &_tmp7_, &_tmp8_);
	start = _tmp7_;
	end = _tmp8_;
	if (_tmp9_) {
		ScratchMainWindow* _tmp10_;
		_tmp10_ = self->priv->main_window;
		_tmp3_ = !scratch_main_window_has_successful_search (_tmp10_);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		GtkTextIter* original_start = NULL;
		GtkTextIter* _tmp11_;
		GtkTextIter _tmp12_;
		GtkTextIter* _tmp13_;
		GtkTextIter _tmp14_;
		GtkTextIter _tmp15_;
		gchar* selected_text = NULL;
		GtkTextIter _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		const gchar* _tmp21_;
		_tmp11_ = gtk_text_iter_copy (&start);
		original_start = _tmp11_;
		_tmp12_ = end;
		gtk_text_iter_forward_find_char (&start, ____lambda5__gtk_text_char_predicate, self, &_tmp12_);
		gtk_text_iter_backward_find_char (&start, ____lambda6__gtk_text_char_predicate, self, NULL);
		_tmp13_ = original_start;
		_tmp14_ = *_tmp13_;
		if (gtk_text_iter_compare (&start, &_tmp14_) < 0) {
			gtk_text_iter_forward_char (&start);
		}
		_tmp15_ = start;
		gtk_text_iter_backward_find_char (&end, ____lambda7__gtk_text_char_predicate, self, &_tmp15_);
		gtk_text_iter_forward_find_char (&end, ____lambda8__gtk_text_char_predicate, self, NULL);
		_tmp16_ = end;
		_tmp17_ = gtk_text_iter_get_text (&start, &_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = string_strip (_tmp18_);
		_tmp20_ = _tmp19_;
		_g_free0 (_tmp18_);
		selected_text = _tmp20_;
		_tmp21_ = selected_text;
		if (((guint) g_utf8_strlen (_tmp21_, (gssize) -1)) <= SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_SELECTION_HIGHLIGHT_MAX_CHARS) {
			ScratchWidgetsSourceView* _tmp22_;
			GtkTextBuffer* _tmp23_;
			GtkTextBuffer* _tmp24_;
			GtkSourceSearchContext* _tmp25_;
			GtkSourceSearchContext* _tmp26_;
			GtkSourceSearchSettings* _tmp27_;
			GtkSourceSearchSettings* _tmp28_;
			const gchar* _tmp29_;
			GtkSourceSearchContext* _tmp30_;
			_tmp22_ = self->priv->current_source;
			_tmp23_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp22_);
			_tmp24_ = _tmp23_;
			_tmp25_ = gtk_source_search_context_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, gtk_source_buffer_get_type (), GtkSourceBuffer), NULL);
			_g_object_unref0 (self->priv->current_search_context);
			self->priv->current_search_context = _tmp25_;
			_tmp26_ = self->priv->current_search_context;
			_tmp27_ = gtk_source_search_context_get_settings (_tmp26_);
			_tmp28_ = _tmp27_;
			_tmp29_ = selected_text;
			gtk_source_search_settings_set_search_text (_tmp28_, _tmp29_);
			_tmp30_ = self->priv->current_search_context;
			gtk_source_search_context_set_highlight (_tmp30_, TRUE);
		}
		_g_free0 (selected_text);
		__vala_GtkTextIter_free0 (original_start);
	}
}

static void
scratch_plugins_highlight_selected_words_real_deactivate (ScratchServicesActivatablePlugin* base)
{
	ScratchPluginsHighlightSelectedWords * self;
	ScratchWidgetsSourceView* _tmp0_;
	self = (ScratchPluginsHighlightSelectedWords*) base;
	_tmp0_ = self->priv->current_source;
	if (_tmp0_ != NULL) {
		ScratchWidgetsSourceView* _tmp1_;
		guint _tmp2_;
		_tmp1_ = self->priv->current_source;
		g_signal_parse_name ("selection-changed", SCRATCH_WIDGETS_TYPE_SOURCE_VIEW, &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _scratch_plugins_highlight_selected_words_on_selection_changed_scratch_widgets_source_view_selection_changed, self);
	}
}

ScratchPluginsHighlightSelectedWords*
scratch_plugins_highlight_selected_words_construct (GType object_type)
{
	ScratchPluginsHighlightSelectedWords * self = NULL;
	self = (ScratchPluginsHighlightSelectedWords*) g_object_new (object_type, NULL);
	return self;
}

ScratchPluginsHighlightSelectedWords*
scratch_plugins_highlight_selected_words_new (void)
{
	return scratch_plugins_highlight_selected_words_construct (SCRATCH_PLUGINS_TYPE_HIGHLIGHT_SELECTED_WORDS);
}

static GObject*
scratch_plugins_highlight_selected_words_real_get_object (ScratchServicesActivatablePlugin* base)
{
	GObject* result;
	ScratchPluginsHighlightSelectedWords* self;
	GObject* _tmp0_;
	GObject* _tmp1_;
	self = (ScratchPluginsHighlightSelectedWords*) base;
	_tmp0_ = self->priv->_object;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
scratch_plugins_highlight_selected_words_real_set_object (ScratchServicesActivatablePlugin* base,
                                                          GObject* value)
{
	ScratchPluginsHighlightSelectedWords* self;
	GObject* old_value;
	self = (ScratchPluginsHighlightSelectedWords*) base;
	old_value = scratch_plugins_highlight_selected_words_real_get_object (base);
	if (old_value != value) {
		GObject* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_object);
		self->priv->_object = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, scratch_plugins_highlight_selected_words_properties[SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_OBJECT_PROPERTY]);
	}
	_g_object_unref0 (old_value);
}

static void
scratch_plugins_highlight_selected_words_class_init (ScratchPluginsHighlightSelectedWordsClass * klass,
                                                     gpointer klass_data)
{
	scratch_plugins_highlight_selected_words_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ScratchPluginsHighlightSelectedWords_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_scratch_plugins_highlight_selected_words_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_scratch_plugins_highlight_selected_words_set_property;
	G_OBJECT_CLASS (klass)->finalize = scratch_plugins_highlight_selected_words_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_OBJECT_PROPERTY, scratch_plugins_highlight_selected_words_properties[SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_OBJECT_PROPERTY] = g_param_spec_object ("object", "object", "object", G_TYPE_OBJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
scratch_plugins_highlight_selected_words_scratch_services_activatable_plugin_interface_init (ScratchServicesActivatablePluginIface * iface,
                                                                                             gpointer iface_data)
{
	scratch_plugins_highlight_selected_words_scratch_services_activatable_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->update_state = (void (*) (ScratchServicesActivatablePlugin*)) scratch_plugins_highlight_selected_words_real_update_state;
	iface->activate = (void (*) (ScratchServicesActivatablePlugin*)) scratch_plugins_highlight_selected_words_real_activate;
	iface->deactivate = (void (*) (ScratchServicesActivatablePlugin*)) scratch_plugins_highlight_selected_words_real_deactivate;
	iface->get_object = scratch_plugins_highlight_selected_words_real_get_object;
	iface->set_object = scratch_plugins_highlight_selected_words_real_set_object;
}

static void
scratch_plugins_highlight_selected_words_instance_init (ScratchPluginsHighlightSelectedWords * self,
                                                        gpointer klass)
{
	self->priv = scratch_plugins_highlight_selected_words_get_instance_private (self);
	self->priv->main_window = NULL;
	self->priv->current_search_context = NULL;
}

static void
scratch_plugins_highlight_selected_words_finalize (GObject * obj)
{
	ScratchPluginsHighlightSelectedWords * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SCRATCH_PLUGINS_TYPE_HIGHLIGHT_SELECTED_WORDS, ScratchPluginsHighlightSelectedWords);
	_g_object_unref0 (self->priv->current_source);
	_g_object_unref0 (self->priv->main_window);
	_g_object_unref0 (self->priv->current_search_context);
	_g_object_unref0 (self->priv->plugins);
	_g_object_unref0 (self->priv->_object);
	G_OBJECT_CLASS (scratch_plugins_highlight_selected_words_parent_class)->finalize (obj);
}

/***
  BEGIN LICENSE

  Copyright (C) 2013 Madelynn May <madelynnmay@madelynnmay.com>
  This program is free software: you can redistribute it and/or modify it
  under the terms of the GNU Lesser General Public License version 3, as published
  by the Free Software Foundation.

  This program is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranties of
  MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
  PURPOSE.  See the GNU General Public License for more details.

  You should have received a copy of the GNU General Public License along
  with this program.  If not, see <http://www.gnu.org/licenses/>

  END LICENSE
***/
GType
scratch_plugins_highlight_selected_words_get_type (void)
{
	return scratch_plugins_highlight_selected_words_type_id;
}

GType
scratch_plugins_highlight_selected_words_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (ScratchPluginsHighlightSelectedWordsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) scratch_plugins_highlight_selected_words_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScratchPluginsHighlightSelectedWords), 0, (GInstanceInitFunc) scratch_plugins_highlight_selected_words_instance_init, NULL };
	static const GInterfaceInfo scratch_services_activatable_plugin_info = { (GInterfaceInitFunc) scratch_plugins_highlight_selected_words_scratch_services_activatable_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	scratch_plugins_highlight_selected_words_type_id = g_type_module_register_type (module, peas_extension_base_get_type (), "ScratchPluginsHighlightSelectedWords", &g_define_type_info, G_TYPE_FLAG_NONE);
	g_type_module_add_interface (module, scratch_plugins_highlight_selected_words_type_id, SCRATCH_SERVICES_TYPE_ACTIVATABLE_PLUGIN, &scratch_services_activatable_plugin_info);
	ScratchPluginsHighlightSelectedWords_private_offset = sizeof (ScratchPluginsHighlightSelectedWordsPrivate);
	return scratch_plugins_highlight_selected_words_type_id;
}

static void
_vala_scratch_plugins_highlight_selected_words_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec)
{
	ScratchPluginsHighlightSelectedWords * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_PLUGINS_TYPE_HIGHLIGHT_SELECTED_WORDS, ScratchPluginsHighlightSelectedWords);
	switch (property_id) {
		case SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_OBJECT_PROPERTY:
		g_value_take_object (value, scratch_services_activatable_plugin_get_object ((ScratchServicesActivatablePlugin*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_scratch_plugins_highlight_selected_words_set_property (GObject * object,
                                                             guint property_id,
                                                             const GValue * value,
                                                             GParamSpec * pspec)
{
	ScratchPluginsHighlightSelectedWords * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_PLUGINS_TYPE_HIGHLIGHT_SELECTED_WORDS, ScratchPluginsHighlightSelectedWords);
	switch (property_id) {
		case SCRATCH_PLUGINS_HIGHLIGHT_SELECTED_WORDS_OBJECT_PROPERTY:
		scratch_services_activatable_plugin_set_object ((ScratchServicesActivatablePlugin*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

void
peas_register_types (GTypeModule* module)
{
	PeasObjectModule* objmodule = NULL;
	PeasObjectModule* _tmp0_;
	g_return_if_fail (module != NULL);
	scratch_plugins_highlight_selected_words_register_type (module);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (module, peas_object_module_get_type ()) ? ((PeasObjectModule*) module) : NULL);
	objmodule = _tmp0_;
	peas_object_module_register_extension_type (objmodule, SCRATCH_SERVICES_TYPE_ACTIVATABLE_PLUGIN, SCRATCH_PLUGINS_TYPE_HIGHLIGHT_SELECTED_WORDS);
	_g_object_unref0 (objmodule);
}

