aboutsummaryrefslogtreecommitdiff
path: root/lib/main.vala
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2013-04-02 17:33:46 -0400
committerWilliam Hua <william.hua@canonical.com>2013-04-02 17:33:46 -0400
commit0817b1fad80603879e7a25981fe87ce162eaaa7d (patch)
treeeadc884838ab0f60beefa1a36189ea29cbaedeaa /lib/main.vala
parent9d04807fffd9ed6eda2cbbb0d65eeb64a209c3bd (diff)
downloadayatana-indicator-keyboard-0817b1fad80603879e7a25981fe87ce162eaaa7d.tar.gz
ayatana-indicator-keyboard-0817b1fad80603879e7a25981fe87ce162eaaa7d.tar.bz2
ayatana-indicator-keyboard-0817b1fad80603879e7a25981fe87ce162eaaa7d.zip
Fix display name of IBus engines.
Diffstat (limited to 'lib/main.vala')
-rw-r--r--lib/main.vala21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/main.vala b/lib/main.vala
index 97315f96..b5b735b5 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -123,19 +123,30 @@ public class Indicator.Keyboard.Service : Object {
var language = Xkl.get_language_name (name);
var country = Xkl.get_country_name (name);
- if (language != null && country != null)
+ if (language != null && country != null) {
name = @"$language ($country)";
- else if (language != null)
+ } else if (language != null) {
name = language;
- else if (country != null)
+ } else if (country != null) {
name = country;
+ }
}
else if (type == "ibus") {
var ibus = get_ibus ();
string[] names = { name, null };
var engines = ibus.get_engines_by_names (names);
-
- name = engines[0].longname;
+ var engine = engines[0];
+ var longname = engine.longname;
+ var language = Xkl.get_language_name (engine.language);
+ var country = Xkl.get_country_name (engine.language);
+
+ if (language != null) {
+ name = @"$language ($longname)";
+ } else if (country != null) {
+ name = @"$country ($longname)";
+ } else {
+ name = longname;
+ }
}
var menu_item = new MenuItem (name, "indicator.current");