/* vim:set et sts=4: */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <ibus.h>
#include <hangul.h>
#include <string.h>
+#include "i18n.h"
#include "engine.h"
#include "ustring.h"
+
typedef struct _IBusHangulEngine IBusHangulEngine;
typedef struct _IBusHangulEngineClass IBusHangulEngineClass;
static IBusEngineClass *parent_class = NULL;
static HanjaTable *hanja_table = NULL;
+static HanjaTable *symbol_table = NULL;
static IBusConfig *config = NULL;
static GString *hangul_keyboard;
hanja_table = hanja_table_load (NULL);
+ symbol_table = hanja_table_load (IBUSHANGUL_DATADIR "/data/symbol.txt");
+
config = ibus_bus_get_config (bus);
hangul_keyboard = g_string_new_len ("2", 8);
hanja_table_delete (hanja_table);
hanja_table = NULL;
+ hanja_table_delete (symbol_table);
+ symbol_table = NULL;
+
g_object_unref (config);
config = NULL;
hangul->prop_list = ibus_prop_list_new ();
- label = ibus_text_new_from_static_string ("韓");
- tooltip = ibus_text_new_from_static_string ("Enable/Disable Hanja mode");
+ label = ibus_text_new_from_string (_("Hanja lock"));
+ tooltip = ibus_text_new_from_string (_("Enable/Disable Hanja mode"));
prop = ibus_property_new ("hanja_mode",
- PROP_TYPE_NORMAL,
+ PROP_TYPE_TOGGLE,
label,
NULL,
tooltip,
ibus_prop_list_append (hangul->prop_list, prop);
hangul->prop_hanja_mode = prop;
- label = ibus_text_new_from_static_string ("Setup");
- tooltip = ibus_text_new_from_static_string ("Configure hangul engine");
+ label = ibus_text_new_from_string (_("Setup"));
+ tooltip = ibus_text_new_from_string (_("Configure hangul engine"));
prop = ibus_property_new ("setup",
PROP_TYPE_NORMAL,
label,
if (ustring_length(preedit) > 0) {
utf8 = ustring_to_utf8 (preedit, -1);
if (utf8 != NULL) {
- hangul->hanja_list = hanja_table_match_prefix (hanja_table, utf8);
+ if (symbol_table != NULL)
+ hangul->hanja_list = hanja_table_match_prefix (symbol_table, utf8);
+ if (hangul->hanja_list == NULL)
+ hangul->hanja_list = hanja_table_match_prefix (hanja_table, utf8);
g_free (utf8);
}
}
{
IBusHangulEngine *hangul = (IBusHangulEngine *) engine;
- IBusText* label = NULL;
if (hangul->hanja_mode) {
- label = ibus_text_new_from_static_string("漢");
+ hangul->prop_hanja_mode->state = PROP_STATE_CHECKED;
} else {
- label = ibus_text_new_from_static_string("韓");
+ hangul->prop_hanja_mode->state = PROP_STATE_UNCHECKED;
}
- ibus_property_set_label (hangul->prop_hanja_mode, label);
- g_object_unref (label);
ibus_engine_register_properties (engine, hangul->prop_list);
g_free(path);
} else if (strcmp(prop_name, "hanja_mode") == 0) {
IBusHangulEngine *hangul = (IBusHangulEngine *) engine;
- IBusText *label;
hangul->hanja_mode = !hangul->hanja_mode;
-
if (hangul->hanja_mode) {
- label = ibus_text_new_from_static_string("漢");
hangul->prop_hanja_mode->state = PROP_STATE_CHECKED;
} else {
- label = ibus_text_new_from_static_string("韓");
hangul->prop_hanja_mode->state = PROP_STATE_UNCHECKED;
}
- ibus_property_set_label (hangul->prop_hanja_mode, label);
ibus_engine_update_property (engine, hangul->prop_hanja_mode);
- g_object_unref(label);
}
}