[haiku-commits] haiku: hrev50091 - src/preferences/locale

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 14 Feb 2016 16:19:43 +0100 (CET)

hrev50091 adds 1 changeset to branch 'master'
old head: 006a34e40e20edcc8a8230c0c437995b03f7bf6d
new head: 975ec13e71f8e303226e0263ab84038c49a7deca
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=975ec13e71f8+%5E006a34e40e20

----------------------------------------------------------------------------

975ec13e71f8: Locale prefs: skip script-specific entries
  
  Avoids showing the same language multiple times in the list, for example
  when there are cyrillic and latin variants. It is still possible to pick
  one of the variants, as they are also added as country-specific entries.
  
  Fixes #9144.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50091
Commit:      975ec13e71f8e303226e0263ab84038c49a7deca
URL:         http://cgit.haiku-os.org/haiku/commit/?id=975ec13e71f8
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Feb 14 15:19:43 2016 UTC

Ticket:      https://dev.haiku-os.org/ticket/9144

----------------------------------------------------------------------------

1 file changed, 11 insertions(+), 3 deletions(-)
src/preferences/locale/LocaleWindow.cpp | 14 +++++++++++---

----------------------------------------------------------------------------

diff --git a/src/preferences/locale/LocaleWindow.cpp 
b/src/preferences/locale/LocaleWindow.cpp
index d66d410..6d50151 100644
--- a/src/preferences/locale/LocaleWindow.cpp
+++ b/src/preferences/locale/LocaleWindow.cpp
@@ -113,9 +113,10 @@ LocaleWindow::LocaleWindow()
 
                        // TODO: the following block fails to detect a couple 
of language
                        // names as containing glyphs we can't render. Why's 
that?
-                       bool hasGlyphs[name.CountChars()];
-                       font.GetHasGlyphs(name.String(), name.CountChars(), 
hasGlyphs);
-                       for (int32 i = 0; i < name.CountChars(); ++i) {
+                       int nameLength = name.CountChars();
+                       bool hasGlyphs[nameLength];
+                       font.GetHasGlyphs(name.String(), nameLength, hasGlyphs);
+                       for (int32 i = 0; i < nameLength; ++i) {
                                if (!hasGlyphs[i]) {
                                        // replace by name translated to 
current language
                                        currentLanguage.GetName(name);
@@ -131,10 +132,17 @@ LocaleWindow::LocaleWindow()
                                item = new LanguageListItem(name, 
currentID.String(),
                                        currentLanguage.Code());
                        }
+
                        if (currentLanguage.IsCountrySpecific()
                                && currentToplevelItem != NULL
                                && currentToplevelItem->Code() == item->Code()) 
{
                                fLanguageListView->AddUnder(item, 
currentToplevelItem);
+                       } else if (currentLanguage.ScriptCode() != NULL
+                               && currentToplevelItem != NULL
+                               && currentToplevelItem->Code() == item->Code()) 
{
+                               // This is a script for some language, skip it 
and add the
+                               // country-specific variants to the parent 
directly
+                               delete item;
                        } else {
                                // This is a generic language, add it at 
top-level
                                fLanguageListView->AddItem(item);


Other related posts:

  • » [haiku-commits] haiku: hrev50091 - src/preferences/locale - pulkomandy