Antergos/Cnchi — pull request #5 by chenxiaolong (2013-05-14 21:54:58+00:00)
Title: Fix problem where the locale is not saved if the locale is only used in one country

The code currently has a major problem where the locale does not get saved if the locale is only used in one country.

In location.py, the code skips the country selection page if the locale is only used in one country:

```python
if self.treeview_items == 1:
# If we have only one option, don't bother our beloved user
self.store_values()
if direction == 'forwards':
GLib.idle_add(self.forward_button.clicked)
else:
GLib.idle_add(self.backwards_button.clicked)
else:
self.select_first_treeview_item()
self.translate_ui()
```

The problem is that `iter = None` in `store_values()` because the user can't select something on a hidden page. As a result, the locale is not stored, causing problems after the system is installed.

```python
def store_values(self):
selected = self.treeview.get_selection()
if selected:
(ls, iter) = selected.get_selected()
if iter:
```

This pull request changes the code to choose the first country in the list by default. So, now it's like:

```python
def store_values(self):
selected = self.treeview.get_selection()
if selected:
(ls, iter) = selected.get_selected()

if not iter:
iter = ls.get_iter_first()
```

With this change, both single-country locales and multiple-country locales work perfectly. Could someone please merge this pull request? The current code causes major problems, such as every line being uncommented in /etc/locale.gen), with single-country locales like zh_CN.

Thanks!