aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2013-08-07 15:11:32 -0400
committerWilliam Hua <william.hua@canonical.com>2013-08-07 15:11:32 -0400
commit0e3bb46532e1858f2cfee808bd66efa225cb2d94 (patch)
treef6b3017c096812b77d06b940aa5fb8e9465d6739 /data
parent6d780dde682d74aa61756ad95c05f5bb1bb57b01 (diff)
downloadayatana-indicator-keyboard-0e3bb46532e1858f2cfee808bd66efa225cb2d94.tar.gz
ayatana-indicator-keyboard-0e3bb46532e1858f2cfee808bd66efa225cb2d94.tar.bz2
ayatana-indicator-keyboard-0e3bb46532e1858f2cfee808bd66efa225cb2d94.zip
Split useful code into separate Source object.
Diffstat (limited to 'data')
-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;
}
}
});