/* convert-segment-state-handler.c generated by valac 0.56.19, the Vala compiler
 * generated from convert-segment-state-handler.vala, do not modify */

/*
 * Copyright (C) 2011-2014 Daiki Ueno <ueno@gnu.org>
 * Copyright (C) 2011-2014 Red Hat, 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied 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, see <http://www.gnu.org/licenses/>.
 */

#include <glib-object.h>
#include "libkkc/libkkc.h"
#include <glib.h>
#include <stdlib.h>
#include <string.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 KKC_TYPE_STATE_HANDLER (kkc_state_handler_get_type ())
#define KKC_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KKC_TYPE_STATE_HANDLER, KkcStateHandler))
#define KKC_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KKC_TYPE_STATE_HANDLER, KkcStateHandlerClass))
#define KKC_IS_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KKC_TYPE_STATE_HANDLER))
#define KKC_IS_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KKC_TYPE_STATE_HANDLER))
#define KKC_STATE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KKC_TYPE_STATE_HANDLER, KkcStateHandlerClass))

typedef struct _KkcStateHandler KkcStateHandler;
typedef struct _KkcStateHandlerClass KkcStateHandlerClass;
typedef struct _KkcStateHandlerPrivate KkcStateHandlerPrivate;

#define KKC_TYPE_STATE (kkc_state_get_type ())
#define KKC_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KKC_TYPE_STATE, KkcState))
#define KKC_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KKC_TYPE_STATE, KkcStateClass))
#define KKC_IS_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KKC_TYPE_STATE))
#define KKC_IS_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KKC_TYPE_STATE))
#define KKC_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KKC_TYPE_STATE, KkcStateClass))

typedef struct _KkcState KkcState;
typedef struct _KkcStateClass KkcStateClass;

#define KKC_TYPE_CONVERT_SEGMENT_STATE_HANDLER (kkc_convert_segment_state_handler_get_type ())
#define KKC_CONVERT_SEGMENT_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KKC_TYPE_CONVERT_SEGMENT_STATE_HANDLER, KkcConvertSegmentStateHandler))
#define KKC_CONVERT_SEGMENT_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KKC_TYPE_CONVERT_SEGMENT_STATE_HANDLER, KkcConvertSegmentStateHandlerClass))
#define KKC_IS_CONVERT_SEGMENT_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KKC_TYPE_CONVERT_SEGMENT_STATE_HANDLER))
#define KKC_IS_CONVERT_SEGMENT_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KKC_TYPE_CONVERT_SEGMENT_STATE_HANDLER))
#define KKC_CONVERT_SEGMENT_STATE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KKC_TYPE_CONVERT_SEGMENT_STATE_HANDLER, KkcConvertSegmentStateHandlerClass))

typedef struct _KkcConvertSegmentStateHandler KkcConvertSegmentStateHandler;
typedef struct _KkcConvertSegmentStateHandlerClass KkcConvertSegmentStateHandlerClass;
typedef struct _KkcConvertSegmentStateHandlerPrivate KkcConvertSegmentStateHandlerPrivate;
enum  {
	KKC_CONVERT_SEGMENT_STATE_HANDLER_0_PROPERTY,
	KKC_CONVERT_SEGMENT_STATE_HANDLER_NUM_PROPERTIES
};
static GParamSpec* kkc_convert_segment_state_handler_properties[KKC_CONVERT_SEGMENT_STATE_HANDLER_NUM_PROPERTIES];
typedef struct _KkcStatePrivate KkcStatePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define KKC_TYPE_CONVERT_SENTENCE_STATE_HANDLER (kkc_convert_sentence_state_handler_get_type ())
#define KKC_CONVERT_SENTENCE_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KKC_TYPE_CONVERT_SENTENCE_STATE_HANDLER, KkcConvertSentenceStateHandler))
#define KKC_CONVERT_SENTENCE_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KKC_TYPE_CONVERT_SENTENCE_STATE_HANDLER, KkcConvertSentenceStateHandlerClass))
#define KKC_IS_CONVERT_SENTENCE_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KKC_TYPE_CONVERT_SENTENCE_STATE_HANDLER))
#define KKC_IS_CONVERT_SENTENCE_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KKC_TYPE_CONVERT_SENTENCE_STATE_HANDLER))
#define KKC_CONVERT_SENTENCE_STATE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KKC_TYPE_CONVERT_SENTENCE_STATE_HANDLER, KkcConvertSentenceStateHandlerClass))

typedef struct _KkcConvertSentenceStateHandler KkcConvertSentenceStateHandler;
typedef struct _KkcConvertSentenceStateHandlerClass KkcConvertSentenceStateHandlerClass;
typedef gboolean (*KkcCommandCallback) (const gchar* command, KkcState* state, KkcKeyEvent* key, gpointer user_data);
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_type_class_unref0(var) ((var == NULL) ? NULL : (var = (g_type_class_unref (var), NULL)))

struct _KkcStateHandler {
	GObject parent_instance;
	KkcStateHandlerPrivate * priv;
};

struct _KkcStateHandlerClass {
	GObjectClass parent_class;
	gboolean (*process_key_event) (KkcStateHandler* self, KkcState* state, KkcKeyEvent* key);
};

struct _KkcConvertSegmentStateHandler {
	KkcStateHandler parent_instance;
	KkcConvertSegmentStateHandlerPrivate * priv;
};

struct _KkcConvertSegmentStateHandlerClass {
	KkcStateHandlerClass parent_class;
};

struct _KkcState {
	GObject parent_instance;
	KkcStatePrivate * priv;
	GType handler_type;
	KkcLanguageModel* model;
	KkcDecoder* decoder;
	KkcSegmentList* segments;
	KkcCandidateList* candidates;
	KkcDictionaryList* dictionaries;
	KkcRomKanaConverter* rom_kana_converter;
	KkcRomKanaCharacterList* input_characters;
	gint input_characters_cursor_pos;
	GString* selection;
	GString* output;
	gboolean quoted;
	KkcKeyEvent* this_command_key;
	KkcKeyEvent* last_command_key;
	gchar* overriding_input;
	GeeIterator* completion_iterator;
};

struct _KkcStateClass {
	GObjectClass parent_class;
};

static gpointer kkc_convert_segment_state_handler_parent_class = NULL;

VALA_EXTERN GType kkc_state_handler_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType kkc_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType kkc_convert_segment_state_handler_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gboolean kkc_state_handler_process_key_event (KkcStateHandler* self,
                                              KkcState* state,
                                              KkcKeyEvent* key);
static gboolean kkc_convert_segment_state_handler_do_next_candidate (KkcConvertSegmentStateHandler* self,
                                                              const gchar* command,
                                                              KkcState* state,
                                                              KkcKeyEvent* key);
static gboolean kkc_convert_segment_state_handler_do_previous_candidate (KkcConvertSegmentStateHandler* self,
                                                                  const gchar* command,
                                                                  KkcState* state,
                                                                  KkcKeyEvent* key);
static gboolean kkc_convert_segment_state_handler_do_purge_candidate (KkcConvertSegmentStateHandler* self,
                                                               const gchar* command,
                                                               KkcState* state,
                                                               KkcKeyEvent* key);
VALA_EXTERN void kkc_state_purge_candidate (KkcState* self,
                                KkcCandidate* candidate);
VALA_EXTERN void kkc_state_reset (KkcState* self);
static gboolean kkc_convert_segment_state_handler_do_select_unhandled (KkcConvertSegmentStateHandler* self,
                                                                const gchar* command,
                                                                KkcState* state,
                                                                KkcKeyEvent* key);
VALA_EXTERN GType kkc_convert_sentence_state_handler_get_type (void) G_GNUC_CONST ;
static gboolean kkc_convert_segment_state_handler_do_clear_unhandled (KkcConvertSegmentStateHandler* self,
                                                               const gchar* command,
                                                               KkcState* state,
                                                               KkcKeyEvent* key);
VALA_EXTERN void kkc_candidate_list_clear (KkcCandidateList* self);
static gboolean kkc_convert_segment_state_handler_real_process_key_event (KkcStateHandler* base,
                                                                   KkcState* state,
                                                                   KkcKeyEvent* key);
VALA_EXTERN gboolean kkc_state_handler_dispatch_command (KkcStateHandler* self,
                                             KkcState* state,
                                             KkcKeyEvent* key);
VALA_EXTERN KkcConvertSegmentStateHandler* kkc_convert_segment_state_handler_new (void);
VALA_EXTERN KkcConvertSegmentStateHandler* kkc_convert_segment_state_handler_construct (GType object_type);
VALA_EXTERN KkcStateHandler* kkc_state_handler_construct (GType object_type);
static GObject * kkc_convert_segment_state_handler_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties);
VALA_EXTERN void kkc_state_handler_register_command_callback (KkcStateHandler* self,
                                                  const gchar* command,
                                                  KkcCommandCallback cb,
                                                  gpointer cb_target);
static gboolean _kkc_convert_segment_state_handler_do_next_candidate_kkc_command_callback (const gchar* command,
                                                                                    KkcState* state,
                                                                                    KkcKeyEvent* key,
                                                                                    gpointer self);
static gboolean _kkc_convert_segment_state_handler_do_previous_candidate_kkc_command_callback (const gchar* command,
                                                                                        KkcState* state,
                                                                                        KkcKeyEvent* key,
                                                                                        gpointer self);
static gboolean _kkc_convert_segment_state_handler_do_purge_candidate_kkc_command_callback (const gchar* command,
                                                                                     KkcState* state,
                                                                                     KkcKeyEvent* key,
                                                                                     gpointer self);
static gboolean _kkc_convert_segment_state_handler_do_clear_unhandled_kkc_command_callback (const gchar* command,
                                                                                     KkcState* state,
                                                                                     KkcKeyEvent* key,
                                                                                     gpointer self);
static gboolean _kkc_convert_segment_state_handler_do_select_unhandled_kkc_command_callback (const gchar* command,
                                                                                      KkcState* state,
                                                                                      KkcKeyEvent* key,
                                                                                      gpointer self);
static GEnumValue* _g_enum_value_dup (GEnumValue* self);
static GType kkc_convert_segment_state_handler_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static gboolean
kkc_convert_segment_state_handler_do_next_candidate (KkcConvertSegmentStateHandler* self,
                                                     const gchar* command,
                                                     KkcState* state,
                                                     KkcKeyEvent* key)
{
	KkcCandidateList* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = state->candidates;
	kkc_candidate_list_cursor_down (_tmp0_);
	result = TRUE;
	return result;
}

static gboolean
kkc_convert_segment_state_handler_do_previous_candidate (KkcConvertSegmentStateHandler* self,
                                                         const gchar* command,
                                                         KkcState* state,
                                                         KkcKeyEvent* key)
{
	KkcCandidateList* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = state->candidates;
	kkc_candidate_list_cursor_up (_tmp0_);
	result = TRUE;
	return result;
}

static gboolean
kkc_convert_segment_state_handler_do_purge_candidate (KkcConvertSegmentStateHandler* self,
                                                      const gchar* command,
                                                      KkcState* state,
                                                      KkcKeyEvent* key)
{
	KkcCandidateList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = state->candidates;
	_tmp1_ = kkc_candidate_list_get_cursor_pos (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ >= 0) {
		KkcCandidate* candidate = NULL;
		KkcCandidateList* _tmp3_;
		KkcCandidate* _tmp4_;
		KkcCandidate* _tmp5_;
		_tmp3_ = state->candidates;
		_tmp4_ = kkc_candidate_list_get (_tmp3_, -1);
		candidate = _tmp4_;
		_tmp5_ = candidate;
		kkc_state_purge_candidate (state, _tmp5_);
		kkc_state_reset (state);
		_g_object_unref0 (candidate);
	}
	result = TRUE;
	return result;
}

static gboolean
kkc_convert_segment_state_handler_do_select_unhandled (KkcConvertSegmentStateHandler* self,
                                                       const gchar* command,
                                                       KkcState* state,
                                                       KkcKeyEvent* key)
{
	KkcCandidateList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = state->candidates;
	_tmp1_ = kkc_candidate_list_get_cursor_pos (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ >= 0) {
		KkcCandidateList* _tmp3_;
		_tmp3_ = state->candidates;
		kkc_candidate_list_select (_tmp3_);
	}
	state->handler_type = KKC_TYPE_CONVERT_SENTENCE_STATE_HANDLER;
	result = FALSE;
	return result;
}

static gboolean
kkc_convert_segment_state_handler_do_clear_unhandled (KkcConvertSegmentStateHandler* self,
                                                      const gchar* command,
                                                      KkcState* state,
                                                      KkcKeyEvent* key)
{
	KkcCandidateList* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = state->candidates;
	kkc_candidate_list_clear (_tmp0_);
	state->handler_type = KKC_TYPE_CONVERT_SENTENCE_STATE_HANDLER;
	result = FALSE;
	return result;
}

static gboolean
kkc_convert_segment_state_handler_real_process_key_event (KkcStateHandler* base,
                                                          KkcState* state,
                                                          KkcKeyEvent* key)
{
	KkcConvertSegmentStateHandler * self;
	gboolean result;
	self = (KkcConvertSegmentStateHandler*) base;
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	result = kkc_state_handler_dispatch_command ((KkcStateHandler*) self, state, key);
	return result;
}

KkcConvertSegmentStateHandler*
kkc_convert_segment_state_handler_construct (GType object_type)
{
	KkcConvertSegmentStateHandler * self = NULL;
	self = (KkcConvertSegmentStateHandler*) kkc_state_handler_construct (object_type);
	return self;
}

KkcConvertSegmentStateHandler*
kkc_convert_segment_state_handler_new (void)
{
	return kkc_convert_segment_state_handler_construct (KKC_TYPE_CONVERT_SEGMENT_STATE_HANDLER);
}

static gboolean
_kkc_convert_segment_state_handler_do_next_candidate_kkc_command_callback (const gchar* command,
                                                                           KkcState* state,
                                                                           KkcKeyEvent* key,
                                                                           gpointer self)
{
	gboolean result;
	result = kkc_convert_segment_state_handler_do_next_candidate ((KkcConvertSegmentStateHandler*) self, command, state, key);
	return result;
}

static gboolean
_kkc_convert_segment_state_handler_do_previous_candidate_kkc_command_callback (const gchar* command,
                                                                               KkcState* state,
                                                                               KkcKeyEvent* key,
                                                                               gpointer self)
{
	gboolean result;
	result = kkc_convert_segment_state_handler_do_previous_candidate ((KkcConvertSegmentStateHandler*) self, command, state, key);
	return result;
}

static gboolean
_kkc_convert_segment_state_handler_do_purge_candidate_kkc_command_callback (const gchar* command,
                                                                            KkcState* state,
                                                                            KkcKeyEvent* key,
                                                                            gpointer self)
{
	gboolean result;
	result = kkc_convert_segment_state_handler_do_purge_candidate ((KkcConvertSegmentStateHandler*) self, command, state, key);
	return result;
}

static gboolean
_kkc_convert_segment_state_handler_do_clear_unhandled_kkc_command_callback (const gchar* command,
                                                                            KkcState* state,
                                                                            KkcKeyEvent* key,
                                                                            gpointer self)
{
	gboolean result;
	result = kkc_convert_segment_state_handler_do_clear_unhandled ((KkcConvertSegmentStateHandler*) self, command, state, key);
	return result;
}

static gboolean
_kkc_convert_segment_state_handler_do_select_unhandled_kkc_command_callback (const gchar* command,
                                                                             KkcState* state,
                                                                             KkcKeyEvent* key,
                                                                             gpointer self)
{
	gboolean result;
	result = kkc_convert_segment_state_handler_do_select_unhandled ((KkcConvertSegmentStateHandler*) self, command, state, key);
	return result;
}

static GEnumValue*
_g_enum_value_dup (GEnumValue* self)
{
	GEnumValue* dup;
	dup = g_new0 (GEnumValue, 1);
	memcpy (dup, self, sizeof (GEnumValue));
	return dup;
}

static gpointer
__g_enum_value_dup0 (gpointer self)
{
	return self ? _g_enum_value_dup (self) : NULL;
}

static GObject *
kkc_convert_segment_state_handler_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	KkcConvertSegmentStateHandler * self;
	GEnumClass* enum_class = NULL;
	GTypeClass* _tmp0_;
	parent_class = G_OBJECT_CLASS (kkc_convert_segment_state_handler_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KKC_TYPE_CONVERT_SEGMENT_STATE_HANDLER, KkcConvertSegmentStateHandler);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "next-candidate", _kkc_convert_segment_state_handler_do_next_candidate_kkc_command_callback, self);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "previous-candidate", _kkc_convert_segment_state_handler_do_previous_candidate_kkc_command_callback, self);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "purge-candidate", _kkc_convert_segment_state_handler_do_purge_candidate_kkc_command_callback, self);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "abort", _kkc_convert_segment_state_handler_do_clear_unhandled_kkc_command_callback, self);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "next-segment", _kkc_convert_segment_state_handler_do_select_unhandled_kkc_command_callback, self);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "previous-segment", _kkc_convert_segment_state_handler_do_select_unhandled_kkc_command_callback, self);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "first-segment", _kkc_convert_segment_state_handler_do_select_unhandled_kkc_command_callback, self);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "last-segment", _kkc_convert_segment_state_handler_do_select_unhandled_kkc_command_callback, self);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "delete", _kkc_convert_segment_state_handler_do_clear_unhandled_kkc_command_callback, self);
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, "original-candidate", _kkc_convert_segment_state_handler_do_clear_unhandled_kkc_command_callback, self);
	_tmp0_ = g_type_class_ref (KKC_TYPE_KANA_MODE);
	enum_class = (GEnumClass*) _tmp0_;
	{
		gint i = 0;
		GEnumClass* _tmp1_;
		_tmp1_ = enum_class;
		i = _tmp1_->minimum;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				GEnumClass* _tmp4_;
				GEnumValue* enum_value = NULL;
				GEnumClass* _tmp5_;
				GEnumValue* _tmp6_;
				GEnumValue* _tmp7_;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				_tmp4_ = enum_class;
				if (!(i <= _tmp4_->maximum)) {
					break;
				}
				_tmp5_ = enum_class;
				_tmp6_ = __g_enum_value_dup0 (g_enum_get_value (_tmp5_, i));
				enum_value = _tmp6_;
				_tmp7_ = enum_value;
				if (_tmp7_ != NULL) {
					GEnumValue* _tmp8_;
					const gchar* _tmp9_;
					gchar* _tmp10_;
					gchar* _tmp11_;
					_tmp8_ = enum_value;
					_tmp9_ = (*_tmp8_).value_nick;
					_tmp10_ = g_strconcat ("convert-", _tmp9_, NULL);
					_tmp11_ = _tmp10_;
					kkc_state_handler_register_command_callback ((KkcStateHandler*) self, _tmp11_, _kkc_convert_segment_state_handler_do_clear_unhandled_kkc_command_callback, self);
					_g_free0 (_tmp11_);
				}
				_g_free0 (enum_value);
			}
		}
	}
	kkc_state_handler_register_command_callback ((KkcStateHandler*) self, NULL, _kkc_convert_segment_state_handler_do_select_unhandled_kkc_command_callback, self);
	_g_type_class_unref0 (enum_class);
	return obj;
}

static void
kkc_convert_segment_state_handler_class_init (KkcConvertSegmentStateHandlerClass * klass,
                                              gpointer klass_data)
{
	kkc_convert_segment_state_handler_parent_class = g_type_class_peek_parent (klass);
	((KkcStateHandlerClass *) klass)->process_key_event = (gboolean (*) (KkcStateHandler*, KkcState*, KkcKeyEvent*)) kkc_convert_segment_state_handler_real_process_key_event;
	G_OBJECT_CLASS (klass)->constructor = kkc_convert_segment_state_handler_constructor;
}

static void
kkc_convert_segment_state_handler_instance_init (KkcConvertSegmentStateHandler * self,
                                                 gpointer klass)
{
}

static GType
kkc_convert_segment_state_handler_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (KkcConvertSegmentStateHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) kkc_convert_segment_state_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (KkcConvertSegmentStateHandler), 0, (GInstanceInitFunc) kkc_convert_segment_state_handler_instance_init, NULL };
	GType kkc_convert_segment_state_handler_type_id;
	kkc_convert_segment_state_handler_type_id = g_type_register_static (KKC_TYPE_STATE_HANDLER, "KkcConvertSegmentStateHandler", &g_define_type_info, 0);
	return kkc_convert_segment_state_handler_type_id;
}

GType
kkc_convert_segment_state_handler_get_type (void)
{
	static volatile gsize kkc_convert_segment_state_handler_type_id__once = 0;
	if (g_once_init_enter (&kkc_convert_segment_state_handler_type_id__once)) {
		GType kkc_convert_segment_state_handler_type_id;
		kkc_convert_segment_state_handler_type_id = kkc_convert_segment_state_handler_get_type_once ();
		g_once_init_leave (&kkc_convert_segment_state_handler_type_id__once, kkc_convert_segment_state_handler_type_id);
	}
	return kkc_convert_segment_state_handler_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

