From 0e3bb46532e1858f2cfee808bd66efa225cb2d94 Mon Sep 17 00:00:00 2001 From: William Hua Date: Wed, 7 Aug 2013 15:11:32 -0400 Subject: Split useful code into separate Source object. --- data/main.vala | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'data') 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; } } }); -- cgit v1.2.3