You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
196 lines
7.1 KiB
196 lines
7.1 KiB
diff --git a/README b/README
|
|
index 6c6765a..5301247 100644
|
|
--- a/README
|
|
+++ b/README
|
|
@@ -1 +1,28 @@
|
|
ibus-kkc -- a Japanese Kana Kanji input engine for IBus
|
|
+=======================================================
|
|
+
|
|
+ibus-kkc makes the Kana Kanji conversion library (libkkc[0]) usable
|
|
+through IBus.
|
|
+
|
|
+
|
|
+Custom dictionaries
|
|
+-------------------
|
|
+
|
|
+ibus-kkc will look for a "dictionaries.json" file in a path consisting
|
|
+of the user's config directory concatenated with the package name (the
|
|
+default template for this file is at src/ibus-kkc-dictionaries.json[1]). By
|
|
+default the file will be searched in "$HOME/.config/ibus-kkc/".
|
|
+
|
|
+The "dictionaries.json" file is in JSON format and contains a list of
|
|
+JSON objects describing dictionaries that can be downloaded from here[2]
|
|
+(this site is in Japanese). All custom dictionary files mentioned in
|
|
+"dictionaries.json" will be searched in "/usr/local/share/skk/".
|
|
+
|
|
+The assumed default encoding of the dictionaries is "EUC-JP". If your
|
|
+dictionary uses a different encoding you can add an "encoding" field
|
|
+to the JSON object describing your dictionary. The value of that field
|
|
+should be the name of the encoding used in your custom dictionary file.
|
|
+
|
|
+[0] https://github.com/ueno/libkkc
|
|
+[1] https://github.com/ueno/ibus-kkc/blob/master/src/ibus-kkc-dictionaries.json
|
|
+[2] http://openlab.ring.gr.jp/skk/wiki/wiki.cgi?page=SKK%BC%AD%BD%F1
|
|
diff --git a/src/dictionary.vala b/src/dictionary.vala
|
|
index 34cc538..d693561 100644
|
|
--- a/src/dictionary.vala
|
|
+++ b/src/dictionary.vala
|
|
@@ -125,6 +125,9 @@ public class DictionaryRegistry : Object {
|
|
file.get_path (),
|
|
e.message);
|
|
}
|
|
+ } else {
|
|
+ warning ("Dictionary file at %s could not be found. We will run without any custom dictionaries.",
|
|
+ file.get_path ());
|
|
}
|
|
}
|
|
}
|
|
diff --git a/src/engine.vala b/src/engine.vala
|
|
index ebcf3b5..15bdd85 100644
|
|
--- a/src/engine.vala
|
|
+++ b/src/engine.vala
|
|
@@ -201,7 +201,11 @@ class KkcEngine : IBus.Engine {
|
|
context.candidates.page_start);
|
|
update_lookup_table_fast (lookup_table, true);
|
|
var candidate = context.candidates.get ();
|
|
- if (show_annotation && candidate.annotation != null) {
|
|
+ if (show_annotation
|
|
+ && candidate.annotation != null
|
|
+ // SKK-JISYO.* has annotations marked as "?" for
|
|
+ // development purposes.
|
|
+ && candidate.annotation != "?") {
|
|
var text = new IBus.Text.from_string (
|
|
candidate.annotation);
|
|
update_auxiliary_text (text, true);
|
|
@@ -280,27 +284,45 @@ class KkcEngine : IBus.Engine {
|
|
}
|
|
|
|
void update_input_mode () {
|
|
+ bool changed;
|
|
+
|
|
// Update the menu item
|
|
var iter = input_mode_props.map_iterator ();
|
|
while (iter.next ()) {
|
|
var input_mode = iter.get_key ();
|
|
var prop = iter.get_value ();
|
|
- if (input_mode == context.input_mode)
|
|
- prop.set_state (IBus.PropState.CHECKED);
|
|
- else
|
|
- prop.set_state (IBus.PropState.UNCHECKED);
|
|
- if (properties_registered)
|
|
+
|
|
+ changed = false;
|
|
+ if (input_mode == context.input_mode) {
|
|
+ if (prop.get_state () == IBus.PropState.UNCHECKED) {
|
|
+ prop.set_state (IBus.PropState.CHECKED);
|
|
+ changed = true;
|
|
+ }
|
|
+ } else {
|
|
+ if (prop.get_state () == IBus.PropState.CHECKED) {
|
|
+ prop.set_state (IBus.PropState.UNCHECKED);
|
|
+ changed = true;
|
|
+ }
|
|
+ }
|
|
+ if (changed && properties_registered)
|
|
update_property (prop);
|
|
}
|
|
|
|
// Update the menu
|
|
+ changed = false;
|
|
var symbol = new IBus.Text.from_string (
|
|
input_mode_symbols.get (context.input_mode));
|
|
var label = new IBus.Text.from_string (
|
|
_("Input Mode (%s)").printf (symbol.text));
|
|
- input_mode_prop.set_label (label);
|
|
- input_mode_prop.set_symbol (symbol);
|
|
- if (properties_registered)
|
|
+ if (input_mode_prop.get_symbol () != symbol) {
|
|
+ input_mode_prop.set_symbol (symbol);
|
|
+ changed = true;
|
|
+ }
|
|
+ if (input_mode_prop.get_label () != label) {
|
|
+ input_mode_prop.set_label (label);
|
|
+ changed = true;
|
|
+ }
|
|
+ if (changed && properties_registered)
|
|
update_property (input_mode_prop);
|
|
}
|
|
|
|
@@ -413,8 +435,10 @@ class KkcEngine : IBus.Engine {
|
|
return prop;
|
|
}
|
|
|
|
- string[] LOOKUP_TABLE_LABELS = {"1", "2", "3", "4", "5", "6", "7",
|
|
- "8", "9", "0", "a", "b", "c", "d", "e"};
|
|
+ static const string[] LOOKUP_TABLE_LABELS = {
|
|
+ "1", "2", "3", "4", "5", "6", "7", "8",
|
|
+ "9", "0", "a", "b", "c", "d", "e", "f"
|
|
+ };
|
|
|
|
bool process_lookup_table_key_event (uint keyval,
|
|
uint keycode,
|
|
@@ -664,7 +688,7 @@ class KkcEngine : IBus.Engine {
|
|
"org.freedesktop.IBus.KKC",
|
|
N_("Kana Kanji"), Config.PACKAGE_VERSION, "GPL",
|
|
"Daiki Ueno <ueno@gnu.org>",
|
|
- "http://code.google.com/p/ibus/",
|
|
+ "https://github.com/ueno/ibus-kkc",
|
|
"",
|
|
"ibus-kkc");
|
|
var engine = new IBus.EngineDesc (
|
|
diff --git a/src/ibus-1.0.vapi b/src/ibus-1.0.vapi
|
|
index 6c200f9..58e96ae 100644
|
|
--- a/src/ibus-1.0.vapi
|
|
+++ b/src/ibus-1.0.vapi
|
|
@@ -439,6 +439,7 @@ namespace IBus {
|
|
public unowned string get_icon ();
|
|
public unowned string get_key ();
|
|
public unowned IBus.Text get_label ();
|
|
+ public unowned IBus.Text get_symbol ();
|
|
public IBus.PropType get_prop_type ();
|
|
public bool get_sensitive ();
|
|
public IBus.PropState get_state ();
|
|
diff --git a/src/setup.vala b/src/setup.vala
|
|
index 0ccdd66..df9630b 100644
|
|
--- a/src/setup.vala
|
|
+++ b/src/setup.vala
|
|
@@ -402,7 +402,11 @@ class SetupDialog : Gtk.Dialog {
|
|
} catch (Error e) {
|
|
warning ("can't write shortcut: %s", e.message);
|
|
}
|
|
+#if VALA_0_36
|
|
+ model.remove (ref iter);
|
|
+#else
|
|
model.remove (iter);
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
@@ -439,7 +443,11 @@ class SetupDialog : Gtk.Dialog {
|
|
continue;
|
|
keymap.set (old_event, null);
|
|
}
|
|
+#if VALA_0_36
|
|
+ ((Gtk.ListStore)model).remove (ref iter);
|
|
+#else
|
|
((Gtk.ListStore)model).remove (iter);
|
|
+#endif
|
|
}
|
|
}
|
|
try {
|
|
@@ -524,8 +532,13 @@ class SetupDialog : Gtk.Dialog {
|
|
var rows = selection.get_selected_rows (out model);
|
|
foreach (var row in rows) {
|
|
Gtk.TreeIter iter;
|
|
- if (model.get_iter (out iter, row))
|
|
+ if (model.get_iter (out iter, row)) {
|
|
+#if VALA_0_36
|
|
+ ((Gtk.ListStore)model).remove (ref iter);
|
|
+#else
|
|
((Gtk.ListStore)model).remove (iter);
|
|
+#endif
|
|
+ }
|
|
}
|
|
save_dictionaries ("system_dictionaries");
|
|
}
|