aboutsummaryrefslogtreecommitdiff
path: root/data/main.vala
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2013-08-08 14:53:16 -0400
committerWilliam Hua <william.hua@canonical.com>2013-08-08 14:53:16 -0400
commit61af9c29ee77c21923f65d06c1e3f17bafa90b97 (patch)
tree48708c38f417b77063b69168eae185d59d38531c /data/main.vala
parent4f411bb4a5a7350ba3142c885e52383914c24a7a (diff)
parent0e3bb46532e1858f2cfee808bd66efa225cb2d94 (diff)
downloadayatana-indicator-keyboard-61af9c29ee77c21923f65d06c1e3f17bafa90b97.tar.gz
ayatana-indicator-keyboard-61af9c29ee77c21923f65d06c1e3f17bafa90b97.tar.bz2
ayatana-indicator-keyboard-61af9c29ee77c21923f65d06c1e3f17bafa90b97.zip
Split useful code into separate Source object.
Diffstat (limited to 'data/main.vala')
-rw-r--r--data/main.vala17
1 files changed, 8 insertions, 9 deletions
diff --git a/data/main.vala b/data/main.vala
index 6457c61f..8077f093 100644
--- a/data/main.vala
+++ b/data/main.vala
@@ -91,15 +91,14 @@ int main (string[] args) {
info.get_layout_info (name, null, out short_name, null, null);
- if (short_name != null) {
- var abbreviation = get_abbreviation ((!) short_name);
-
- if (abbreviation.get_char () != '\0') {
- if (!occurrences.has_key (abbreviation)) {
- occurrences[abbreviation] = 1;
- } else {
- occurrences[abbreviation] = occurrences[abbreviation] + 1;
- }
+ var abbreviation = abbreviate (short_name);
+ var has_abbreviation = abbreviation != null && ((!) abbreviation).get_char () != '\0';
+
+ if (has_abbreviation) {
+ if (!occurrences.has_key ((!) abbreviation)) {
+ occurrences[(!) abbreviation] = 1;
+ } else {
+ occurrences[(!) abbreviation] = occurrences[(!) abbreviation] + 1;
}
}
});