[gnome-shell] status/keyboard: Handle IBus engines which don't specify a symbol
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] status/keyboard: Handle IBus engines which don't specify a symbol
- Date: Wed, 12 Sep 2012 16:56:48 +0000 (UTC)
commit 409af28cb703b50dbd6860d2c27b2e1f9bd14b71
Author: Rui Matos <tiagomatos gmail com>
Date: Sun Sep 9 22:44:25 2012 +0200
status/keyboard: Handle IBus engines which don't specify a symbol
In this case, fall back to the 2 or 3 letter language code or, failing
that, to a keyboard symbol.
https://bugzilla.gnome.org/show_bug.cgi?id=683613
js/ui/status/keyboard.js | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 3dd7e3f..ce5824e 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -245,7 +245,7 @@ const InputSourceIndicator = new Lang.Class({
info.exists = true;
info.displayName = language + ' (' + engineDesc.get_longname() + ')';
- info.shortName = engineDesc.get_symbol();
+ info.shortName = this._makeEngineShortName(engineDesc);
}
}
@@ -320,6 +320,18 @@ const InputSourceIndicator = new Lang.Class({
Util.spawn(['gkbd-keyboard-display', '-l', description]);
},
+ _makeEngineShortName: function(engineDesc) {
+ let symbol = engineDesc.get_symbol();
+ if (symbol && symbol[0])
+ return symbol;
+
+ let langCode = engineDesc.get_language().split('_', 1)[0];
+ if (langCode.length == 2 || langCode.length == 3)
+ return langCode.toLowerCase();
+
+ return String.fromCharCode(0x2328); // keyboard glyph
+ },
+
_containerGetPreferredWidth: function(container, for_height, alloc) {
// Here, and in _containerGetPreferredHeight, we need to query
// for the height of all children, but we ignore the results
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]