/* charmap-panel.c generated by valac 0.12.0, the Vala compiler
 * generated from charmap-panel.vala, do not modify */

/* -*- mode: vala; indent-tabs-mode: nil -*-*/
/* Copyright (C) 2011  Daiki Ueno*/
/* Copyright (C) 2011  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 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 <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <gucharmap/gucharmap.h>
#include <pango/pango.h>


#define IBUS_GUCHARMAP_TYPE_CHAPTER_CELL_RENDERER (ibus_gucharmap_chapter_cell_renderer_get_type ())
#define IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_GUCHARMAP_TYPE_CHAPTER_CELL_RENDERER, IBusGucharmapChapterCellRenderer))
#define IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_GUCHARMAP_TYPE_CHAPTER_CELL_RENDERER, IBusGucharmapChapterCellRendererClass))
#define IBUS_GUCHARMAP_IS_CHAPTER_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_GUCHARMAP_TYPE_CHAPTER_CELL_RENDERER))
#define IBUS_GUCHARMAP_IS_CHAPTER_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_GUCHARMAP_TYPE_CHAPTER_CELL_RENDERER))
#define IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_GUCHARMAP_TYPE_CHAPTER_CELL_RENDERER, IBusGucharmapChapterCellRendererClass))

typedef struct _IBusGucharmapChapterCellRenderer IBusGucharmapChapterCellRenderer;
typedef struct _IBusGucharmapChapterCellRendererClass IBusGucharmapChapterCellRendererClass;
typedef struct _IBusGucharmapChapterCellRendererPrivate IBusGucharmapChapterCellRendererPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#define IBUS_GUCHARMAP_TYPE_CHARMAP_PANEL (ibus_gucharmap_charmap_panel_get_type ())
#define IBUS_GUCHARMAP_CHARMAP_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_GUCHARMAP_TYPE_CHARMAP_PANEL, IBusGucharmapCharmapPanel))
#define IBUS_GUCHARMAP_CHARMAP_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_GUCHARMAP_TYPE_CHARMAP_PANEL, IBusGucharmapCharmapPanelClass))
#define IBUS_GUCHARMAP_IS_CHARMAP_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_GUCHARMAP_TYPE_CHARMAP_PANEL))
#define IBUS_GUCHARMAP_IS_CHARMAP_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_GUCHARMAP_TYPE_CHARMAP_PANEL))
#define IBUS_GUCHARMAP_CHARMAP_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_GUCHARMAP_TYPE_CHARMAP_PANEL, IBusGucharmapCharmapPanelClass))

typedef struct _IBusGucharmapCharmapPanel IBusGucharmapCharmapPanel;
typedef struct _IBusGucharmapCharmapPanelClass IBusGucharmapCharmapPanelClass;
typedef struct _IBusGucharmapCharmapPanelPrivate IBusGucharmapCharmapPanelPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define IBUS_GUCHARMAP_TYPE_CONFIG_CACHE (ibus_gucharmap_config_cache_get_type ())
#define IBUS_GUCHARMAP_CONFIG_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_GUCHARMAP_TYPE_CONFIG_CACHE, IBusGucharmapConfigCache))
#define IBUS_GUCHARMAP_CONFIG_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_GUCHARMAP_TYPE_CONFIG_CACHE, IBusGucharmapConfigCacheClass))
#define IBUS_GUCHARMAP_IS_CONFIG_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_GUCHARMAP_TYPE_CONFIG_CACHE))
#define IBUS_GUCHARMAP_IS_CONFIG_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_GUCHARMAP_TYPE_CONFIG_CACHE))
#define IBUS_GUCHARMAP_CONFIG_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_GUCHARMAP_TYPE_CONFIG_CACHE, IBusGucharmapConfigCacheClass))

typedef struct _IBusGucharmapConfigCache IBusGucharmapConfigCache;
typedef struct _IBusGucharmapConfigCacheClass IBusGucharmapConfigCacheClass;
#define _pango_font_description_free0(var) ((var == NULL) ? NULL : (var = (pango_font_description_free (var), NULL)))

struct _IBusGucharmapChapterCellRenderer {
	GtkCellRendererText parent_instance;
	IBusGucharmapChapterCellRendererPrivate * priv;
};

struct _IBusGucharmapChapterCellRendererClass {
	GtkCellRendererTextClass parent_class;
};

struct _IBusGucharmapChapterCellRendererPrivate {
	gchar* _untranslated;
};

struct _IBusGucharmapCharmapPanel {
	GtkBox parent_instance;
	IBusGucharmapCharmapPanelPrivate * priv;
};

struct _IBusGucharmapCharmapPanelClass {
	GtkBoxClass parent_class;
	void (*activate_character) (IBusGucharmapCharmapPanel* self, gunichar uc);
};

struct _IBusGucharmapCharmapPanelPrivate {
	GtkComboBox* chapters;
	GucharmapChartable* chartable;
	GtkStatusbar* statusbar;
	guint statusbar_context_id;
};


static gpointer ibus_gucharmap_chapter_cell_renderer_parent_class = NULL;
static gpointer ibus_gucharmap_charmap_panel_parent_class = NULL;
extern IBusGucharmapConfigCache* ibus_gucharmap_config;

#define IBUS_GUCHARMAP_GUCHARMAP_DOMAIN "gucharmap"
GType ibus_gucharmap_chapter_cell_renderer_get_type (void) G_GNUC_CONST;
#define IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_GUCHARMAP_TYPE_CHAPTER_CELL_RENDERER, IBusGucharmapChapterCellRendererPrivate))
enum  {
	IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER_DUMMY_PROPERTY,
	IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER_UNTRANSLATED
};
IBusGucharmapChapterCellRenderer* ibus_gucharmap_chapter_cell_renderer_new (void);
IBusGucharmapChapterCellRenderer* ibus_gucharmap_chapter_cell_renderer_construct (GType object_type);
const gchar* ibus_gucharmap_chapter_cell_renderer_get_untranslated (IBusGucharmapChapterCellRenderer* self);
void ibus_gucharmap_chapter_cell_renderer_set_untranslated (IBusGucharmapChapterCellRenderer* self, const gchar* value);
static void ibus_gucharmap_chapter_cell_renderer_finalize (GObject* obj);
static void _vala_ibus_gucharmap_chapter_cell_renderer_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_ibus_gucharmap_chapter_cell_renderer_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
GType ibus_gucharmap_charmap_panel_get_type (void) G_GNUC_CONST;
#define IBUS_GUCHARMAP_CHARMAP_PANEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IBUS_GUCHARMAP_TYPE_CHARMAP_PANEL, IBusGucharmapCharmapPanelPrivate))
enum  {
	IBUS_GUCHARMAP_CHARMAP_PANEL_DUMMY_PROPERTY
};
void ibus_gucharmap_charmap_panel_move_cursor (IBusGucharmapCharmapPanel* self, GtkMovementStep step, gint count);
void ibus_gucharmap_charmap_panel_popup_chapters (IBusGucharmapCharmapPanel* self);
void ibus_gucharmap_charmap_panel_activate_selected (IBusGucharmapCharmapPanel* self);
static void ibus_gucharmap_charmap_panel_on_chapter_changed (IBusGucharmapCharmapPanel* self, GtkComboBox* combo);
static void ibus_gucharmap_charmap_panel_on_hide (IBusGucharmapCharmapPanel* self, GtkWidget* widget);
static void ibus_gucharmap_charmap_panel_on_chartable_activate (IBusGucharmapCharmapPanel* self);
static void ibus_gucharmap_charmap_panel_on_chartable_notify_active_character (IBusGucharmapCharmapPanel* self, GObject* source, GParamSpec* param);
IBusGucharmapCharmapPanel* ibus_gucharmap_charmap_panel_new (void);
IBusGucharmapCharmapPanel* ibus_gucharmap_charmap_panel_construct (GType object_type);
static void _ibus_gucharmap_charmap_panel_on_chapter_changed_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
GType ibus_gucharmap_config_cache_get_type (void) G_GNUC_CONST;
gboolean ibus_gucharmap_config_cache_get_use_system_font (IBusGucharmapConfigCache* self);
const gchar* ibus_gucharmap_config_cache_get_font (IBusGucharmapConfigCache* self);
static void _ibus_gucharmap_charmap_panel_on_chartable_activate_gucharmap_chartable_activate (GucharmapChartable* _sender, gpointer self);
static void _ibus_gucharmap_charmap_panel_on_chartable_notify_active_character_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _ibus_gucharmap_charmap_panel_on_hide_gtk_widget_hide (GtkWidget* _sender, gpointer self);
void ibus_gucharmap_charmap_panel_activate_character (IBusGucharmapCharmapPanel* self, gunichar uc);
static void ibus_gucharmap_charmap_panel_real_activate_character (IBusGucharmapCharmapPanel* self, gunichar uc);
static void ibus_gucharmap_charmap_panel_finalize (GObject* obj);


IBusGucharmapChapterCellRenderer* ibus_gucharmap_chapter_cell_renderer_construct (GType object_type) {
	IBusGucharmapChapterCellRenderer * self = NULL;
	self = (IBusGucharmapChapterCellRenderer*) g_object_new (object_type, NULL);
	return self;
}


IBusGucharmapChapterCellRenderer* ibus_gucharmap_chapter_cell_renderer_new (void) {
	return ibus_gucharmap_chapter_cell_renderer_construct (IBUS_GUCHARMAP_TYPE_CHAPTER_CELL_RENDERER);
}


const gchar* ibus_gucharmap_chapter_cell_renderer_get_untranslated (IBusGucharmapChapterCellRenderer* self) {
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_untranslated;
	return result;
}


void ibus_gucharmap_chapter_cell_renderer_set_untranslated (IBusGucharmapChapterCellRenderer* self, const gchar* value) {
	gchar* _tmp0_;
	const gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_untranslated);
	self->priv->_untranslated = _tmp0_;
	_tmp1_ = g_dgettext (IBUS_GUCHARMAP_GUCHARMAP_DOMAIN, self->priv->_untranslated);
	g_object_set ((GtkCellRendererText*) self, "text", _tmp1_, NULL);
	g_object_notify ((GObject *) self, "untranslated");
}


static void ibus_gucharmap_chapter_cell_renderer_class_init (IBusGucharmapChapterCellRendererClass * klass) {
	ibus_gucharmap_chapter_cell_renderer_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (IBusGucharmapChapterCellRendererPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_ibus_gucharmap_chapter_cell_renderer_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ibus_gucharmap_chapter_cell_renderer_set_property;
	G_OBJECT_CLASS (klass)->finalize = ibus_gucharmap_chapter_cell_renderer_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER_UNTRANSLATED, g_param_spec_string ("untranslated", "untranslated", "untranslated", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void ibus_gucharmap_chapter_cell_renderer_instance_init (IBusGucharmapChapterCellRenderer * self) {
	self->priv = IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER_GET_PRIVATE (self);
}


static void ibus_gucharmap_chapter_cell_renderer_finalize (GObject* obj) {
	IBusGucharmapChapterCellRenderer * self;
	self = IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER (obj);
	_g_free0 (self->priv->_untranslated);
	G_OBJECT_CLASS (ibus_gucharmap_chapter_cell_renderer_parent_class)->finalize (obj);
}


GType ibus_gucharmap_chapter_cell_renderer_get_type (void) {
	static volatile gsize ibus_gucharmap_chapter_cell_renderer_type_id__volatile = 0;
	if (g_once_init_enter (&ibus_gucharmap_chapter_cell_renderer_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (IBusGucharmapChapterCellRendererClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ibus_gucharmap_chapter_cell_renderer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IBusGucharmapChapterCellRenderer), 0, (GInstanceInitFunc) ibus_gucharmap_chapter_cell_renderer_instance_init, NULL };
		GType ibus_gucharmap_chapter_cell_renderer_type_id;
		ibus_gucharmap_chapter_cell_renderer_type_id = g_type_register_static (GTK_TYPE_CELL_RENDERER_TEXT, "IBusGucharmapChapterCellRenderer", &g_define_type_info, 0);
		g_once_init_leave (&ibus_gucharmap_chapter_cell_renderer_type_id__volatile, ibus_gucharmap_chapter_cell_renderer_type_id);
	}
	return ibus_gucharmap_chapter_cell_renderer_type_id__volatile;
}


static void _vala_ibus_gucharmap_chapter_cell_renderer_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	IBusGucharmapChapterCellRenderer * self;
	self = IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER (object);
	switch (property_id) {
		case IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER_UNTRANSLATED:
		g_value_set_string (value, ibus_gucharmap_chapter_cell_renderer_get_untranslated (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_ibus_gucharmap_chapter_cell_renderer_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	IBusGucharmapChapterCellRenderer * self;
	self = IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER (object);
	switch (property_id) {
		case IBUS_GUCHARMAP_CHAPTER_CELL_RENDERER_UNTRANSLATED:
		ibus_gucharmap_chapter_cell_renderer_set_untranslated (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


void ibus_gucharmap_charmap_panel_move_cursor (IBusGucharmapCharmapPanel* self, GtkMovementStep step, gint count) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	g_signal_emit_by_name (self->priv->chartable, "move-cursor", step, count, &_tmp0_);
	_tmp0_;
}


void ibus_gucharmap_charmap_panel_popup_chapters (IBusGucharmapCharmapPanel* self) {
	g_return_if_fail (self != NULL);
	gtk_combo_box_popup (self->priv->chapters);
}


void ibus_gucharmap_charmap_panel_activate_selected (IBusGucharmapCharmapPanel* self) {
	g_return_if_fail (self != NULL);
	g_signal_emit_by_name (self->priv->chartable, "activate");
}


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


static void ibus_gucharmap_charmap_panel_on_chapter_changed (IBusGucharmapCharmapPanel* self, GtkComboBox* combo) {
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp0_ = {0};
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp1_ = gtk_combo_box_get_active_iter (combo, &_tmp0_);
	iter = _tmp0_;
	if (_tmp1_) {
		GtkTreeModel* _tmp2_ = NULL;
		GucharmapChaptersModel* _tmp3_;
		GucharmapChaptersModel* model;
		GucharmapCodepointList* _tmp4_ = NULL;
		GucharmapCodepointList* _tmp5_;
		GucharmapCodepointList* codepoint_list;
		_tmp2_ = gtk_combo_box_get_model (self->priv->chapters);
		_tmp3_ = _g_object_ref0 (GUCHARMAP_CHAPTERS_MODEL (_tmp2_));
		model = _tmp3_;
		_tmp4_ = gucharmap_chapters_model_get_codepoint_list (model, &iter);
		_tmp5_ = _g_object_ref0 (_tmp4_);
		codepoint_list = _tmp5_;
		gucharmap_chartable_set_codepoint_list (self->priv->chartable, codepoint_list);
		_g_object_unref0 (codepoint_list);
		_g_object_unref0 (model);
	}
}


static void ibus_gucharmap_charmap_panel_on_hide (IBusGucharmapCharmapPanel* self, GtkWidget* widget) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = gucharmap_chartable_get_zoom_enabled (self->priv->chartable);
	if (_tmp0_) {
		gucharmap_chartable_set_zoom_enabled (self->priv->chartable, FALSE);
		gucharmap_chartable_set_zoom_enabled (self->priv->chartable, TRUE);
	}
}


static void ibus_gucharmap_charmap_panel_on_chartable_activate (IBusGucharmapCharmapPanel* self) {
	gunichar _tmp0_;
	gunichar uc;
	g_return_if_fail (self != NULL);
	_tmp0_ = gucharmap_chartable_get_active_character (self->priv->chartable);
	uc = _tmp0_;
	g_signal_emit_by_name (self, "activate-character", uc);
}


static void ibus_gucharmap_charmap_panel_on_chartable_notify_active_character (IBusGucharmapCharmapPanel* self, GObject* source, GParamSpec* param) {
	gunichar _tmp0_;
	gunichar uc;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_;
	gchar* name;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (param != NULL);
	gtk_statusbar_remove_all (self->priv->statusbar, self->priv->statusbar_context_id);
	_tmp0_ = gucharmap_chartable_get_active_character (self->priv->chartable);
	uc = _tmp0_;
	_tmp1_ = gucharmap_get_unicode_name (uc);
	_tmp2_ = g_strdup (_tmp1_);
	name = _tmp2_;
	_tmp3_ = g_strdup_printf ("U+%X %s", (guint) uc, name);
	_tmp4_ = _tmp3_;
	gtk_statusbar_push (self->priv->statusbar, self->priv->statusbar_context_id, _tmp4_);
	_g_free0 (_tmp4_);
	_g_free0 (name);
}


static void _ibus_gucharmap_charmap_panel_on_chapter_changed_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	ibus_gucharmap_charmap_panel_on_chapter_changed (self, _sender);
}


static gpointer _pango_font_description_copy0 (gpointer self) {
	return self ? pango_font_description_copy (self) : NULL;
}


static void _ibus_gucharmap_charmap_panel_on_chartable_activate_gucharmap_chartable_activate (GucharmapChartable* _sender, gpointer self) {
	ibus_gucharmap_charmap_panel_on_chartable_activate (self);
}


static void _ibus_gucharmap_charmap_panel_on_chartable_notify_active_character_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	ibus_gucharmap_charmap_panel_on_chartable_notify_active_character (self, _sender, pspec);
}


static void _ibus_gucharmap_charmap_panel_on_hide_gtk_widget_hide (GtkWidget* _sender, gpointer self) {
	ibus_gucharmap_charmap_panel_on_hide (self, _sender);
}


IBusGucharmapCharmapPanel* ibus_gucharmap_charmap_panel_construct (GType object_type) {
	IBusGucharmapCharmapPanel * self = NULL;
	GtkVBox* _tmp0_ = NULL;
	GtkVBox* paned;
	GucharmapBlockChaptersModel* _tmp1_ = NULL;
	GucharmapBlockChaptersModel* model;
	GtkComboBox* _tmp2_ = NULL;
	IBusGucharmapChapterCellRenderer* _tmp3_ = NULL;
	IBusGucharmapChapterCellRenderer* renderer;
	GtkStatusbar* _tmp4_ = NULL;
	guint _tmp5_;
	GtkScrolledWindow* _tmp6_ = NULL;
	GtkScrolledWindow* scrolled_window;
	GucharmapChartable* _tmp7_ = NULL;
	PangoFontDescription* font_desc = NULL;
	gboolean _tmp8_;
	gunichar _tmp15_;
	gunichar uc;
	self = (IBusGucharmapCharmapPanel*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkVBox*) gtk_vbox_new (FALSE, 0);
	paned = g_object_ref_sink (_tmp0_);
	_tmp1_ = (GucharmapBlockChaptersModel*) gucharmap_block_chapters_model_new ();
	model = _tmp1_;
	gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable*) model, 1, GTK_SORT_ASCENDING);
	_tmp2_ = (GtkComboBox*) gtk_combo_box_new_with_model ((GtkTreeModel*) model);
	_g_object_unref0 (self->priv->chapters);
	self->priv->chapters = g_object_ref_sink (_tmp2_);
	g_signal_connect_object (self->priv->chapters, "changed", (GCallback) _ibus_gucharmap_charmap_panel_on_chapter_changed_gtk_combo_box_changed, self, 0);
	_tmp3_ = ibus_gucharmap_chapter_cell_renderer_new ();
	renderer = g_object_ref_sink (_tmp3_);
	gtk_cell_layout_pack_start ((GtkCellLayout*) self->priv->chapters, (GtkCellRenderer*) renderer, TRUE);
	gtk_cell_layout_set_attributes ((GtkCellLayout*) self->priv->chapters, (GtkCellRenderer*) renderer, "untranslated", 0, NULL);
	gtk_widget_set_vexpand ((GtkWidget*) self->priv->chapters, FALSE);
	gtk_box_pack_start ((GtkBox*) paned, (GtkWidget*) self->priv->chapters, FALSE, FALSE, (guint) 0);
	_tmp4_ = (GtkStatusbar*) gtk_statusbar_new ();
	_g_object_unref0 (self->priv->statusbar);
	self->priv->statusbar = g_object_ref_sink (_tmp4_);
	_tmp5_ = gtk_statusbar_get_context_id (self->priv->statusbar, "active char");
	self->priv->statusbar_context_id = _tmp5_;
	gtk_box_pack_end ((GtkBox*) paned, (GtkWidget*) self->priv->statusbar, FALSE, FALSE, (guint) 0);
	_tmp6_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	scrolled_window = g_object_ref_sink (_tmp6_);
	gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (scrolled_window, GTK_SHADOW_ETCHED_IN);
	_tmp7_ = (GucharmapChartable*) gucharmap_chartable_new ();
	_g_object_unref0 (self->priv->chartable);
	self->priv->chartable = g_object_ref_sink (_tmp7_);
	_tmp8_ = ibus_gucharmap_config_cache_get_use_system_font (ibus_gucharmap_config);
	if (_tmp8_) {
		GtkStyleContext* _tmp9_ = NULL;
		GtkStyleContext* _tmp10_;
		GtkStyleContext* style_context;
		const PangoFontDescription* _tmp11_ = NULL;
		PangoFontDescription* _tmp12_;
		_tmp9_ = gtk_widget_get_style_context ((GtkWidget*) self->priv->chartable);
		_tmp10_ = _g_object_ref0 (_tmp9_);
		style_context = _tmp10_;
		_tmp11_ = gtk_style_context_get_font (style_context, GTK_STATE_FLAG_NORMAL);
		_tmp12_ = _pango_font_description_copy0 (_tmp11_);
		_pango_font_description_free0 (font_desc);
		font_desc = _tmp12_;
		_g_object_unref0 (style_context);
	} else {
		const gchar* _tmp13_ = NULL;
		PangoFontDescription* _tmp14_ = NULL;
		_tmp13_ = ibus_gucharmap_config_cache_get_font (ibus_gucharmap_config);
		_tmp14_ = pango_font_description_from_string (_tmp13_);
		_pango_font_description_free0 (font_desc);
		font_desc = _tmp14_;
	}
	gucharmap_chartable_set_font_desc (self->priv->chartable, font_desc);
	gucharmap_chartable_set_zoom_enabled (self->priv->chartable, TRUE);
	g_signal_connect_object (self->priv->chartable, "activate", (GCallback) _ibus_gucharmap_charmap_panel_on_chartable_activate_gucharmap_chartable_activate, self, 0);
	g_signal_connect_object ((GObject*) self->priv->chartable, "notify::active-character", (GCallback) _ibus_gucharmap_charmap_panel_on_chartable_notify_active_character_g_object_notify, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "hide", (GCallback) _ibus_gucharmap_charmap_panel_on_hide_gtk_widget_hide, self, 0);
	gtk_container_add ((GtkContainer*) scrolled_window, (GtkWidget*) self->priv->chartable);
	gtk_box_pack_end ((GtkBox*) paned, (GtkWidget*) scrolled_window, TRUE, TRUE, (guint) 0);
	_tmp15_ = gucharmap_unicode_get_locale_character ();
	uc = _tmp15_;
	g_signal_emit_by_name (self, "activate-character", uc);
	gtk_widget_show_all ((GtkWidget*) paned);
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) paned, TRUE, TRUE, (guint) 0);
	_pango_font_description_free0 (font_desc);
	_g_object_unref0 (scrolled_window);
	_g_object_unref0 (renderer);
	_g_object_unref0 (model);
	_g_object_unref0 (paned);
	return self;
}


IBusGucharmapCharmapPanel* ibus_gucharmap_charmap_panel_new (void) {
	return ibus_gucharmap_charmap_panel_construct (IBUS_GUCHARMAP_TYPE_CHARMAP_PANEL);
}


static void ibus_gucharmap_charmap_panel_real_activate_character (IBusGucharmapCharmapPanel* self, gunichar uc) {
	GtkTreeModel* _tmp0_ = NULL;
	GucharmapChaptersModel* _tmp1_;
	GucharmapChaptersModel* model;
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp2_ = {0};
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_combo_box_get_model (self->priv->chapters);
	_tmp1_ = _g_object_ref0 (GUCHARMAP_CHAPTERS_MODEL (_tmp0_));
	model = _tmp1_;
	_tmp3_ = gucharmap_chapters_model_character_to_iter (model, uc, &_tmp2_);
	iter = _tmp2_;
	if (_tmp3_) {
		gtk_combo_box_set_active_iter (self->priv->chapters, &iter);
		gucharmap_chartable_set_active_character (self->priv->chartable, uc);
	}
	_g_object_unref0 (model);
}


static void ibus_gucharmap_charmap_panel_class_init (IBusGucharmapCharmapPanelClass * klass) {
	ibus_gucharmap_charmap_panel_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (IBusGucharmapCharmapPanelPrivate));
	IBUS_GUCHARMAP_CHARMAP_PANEL_CLASS (klass)->activate_character = ibus_gucharmap_charmap_panel_real_activate_character;
	G_OBJECT_CLASS (klass)->finalize = ibus_gucharmap_charmap_panel_finalize;
	g_signal_new ("activate_character", IBUS_GUCHARMAP_TYPE_CHARMAP_PANEL, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (IBusGucharmapCharmapPanelClass, activate_character), NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
}


static void ibus_gucharmap_charmap_panel_instance_init (IBusGucharmapCharmapPanel * self) {
	self->priv = IBUS_GUCHARMAP_CHARMAP_PANEL_GET_PRIVATE (self);
}


static void ibus_gucharmap_charmap_panel_finalize (GObject* obj) {
	IBusGucharmapCharmapPanel * self;
	self = IBUS_GUCHARMAP_CHARMAP_PANEL (obj);
	_g_object_unref0 (self->priv->chapters);
	_g_object_unref0 (self->priv->chartable);
	_g_object_unref0 (self->priv->statusbar);
	G_OBJECT_CLASS (ibus_gucharmap_charmap_panel_parent_class)->finalize (obj);
}


GType ibus_gucharmap_charmap_panel_get_type (void) {
	static volatile gsize ibus_gucharmap_charmap_panel_type_id__volatile = 0;
	if (g_once_init_enter (&ibus_gucharmap_charmap_panel_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (IBusGucharmapCharmapPanelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ibus_gucharmap_charmap_panel_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IBusGucharmapCharmapPanel), 0, (GInstanceInitFunc) ibus_gucharmap_charmap_panel_instance_init, NULL };
		GType ibus_gucharmap_charmap_panel_type_id;
		ibus_gucharmap_charmap_panel_type_id = g_type_register_static (GTK_TYPE_BOX, "IBusGucharmapCharmapPanel", &g_define_type_info, 0);
		g_once_init_leave (&ibus_gucharmap_charmap_panel_type_id__volatile, ibus_gucharmap_charmap_panel_type_id);
	}
	return ibus_gucharmap_charmap_panel_type_id__volatile;
}



