diff --git a/data/io.elementary.switchboard.locale.appdata.xml.in b/data/io.elementary.switchboard.locale.appdata.xml.in
index c319963f..472c76c1 100644
--- a/data/io.elementary.switchboard.locale.appdata.xml.in
+++ b/data/io.elementary.switchboard.locale.appdata.xml.in
@@ -7,6 +7,14 @@
preferences-desktop-locale
locale-plug
+
+
+ Fixes:
+
+ - Ensure "Formats" dropdown remains correct after installing or removing languages
+
+
+
Fixes:
@@ -18,7 +26,7 @@
Better support for non-Ubuntu based distributions
Updated translations
-
+
diff --git a/src/LocaleManager.vala b/src/LocaleManager.vala
index bf306dda..127cc27c 100644
--- a/src/LocaleManager.vala
+++ b/src/LocaleManager.vala
@@ -143,7 +143,7 @@ namespace SwitchboardPlugLocale {
public string get_user_format () {
// The `formats_locale` property is specific to Ubuntu, so check it exists before
// returning the value
- if (account_proxy.formats_locale != null) {
+ if (account_proxy.formats_locale != null && account_proxy.formats_locale != "") {
return account_proxy.formats_locale;
}
diff --git a/src/Plug.vala b/src/Plug.vala
index e07c28b2..a77732ab 100644
--- a/src/Plug.vala
+++ b/src/Plug.vala
@@ -80,12 +80,10 @@ namespace SwitchboardPlugLocale {
}
installer.install_finished.connect ((langcode) => {
- langs.add (langcode);
reload.begin ();
});
installer.remove_finished.connect ((langcode) => {
- langs.remove (langcode);
reload.begin ();
});
diff --git a/src/Widgets/LocaleSetting.vala b/src/Widgets/LocaleSetting.vala
index 07353e74..49ca813d 100644
--- a/src/Widgets/LocaleSetting.vala
+++ b/src/Widgets/LocaleSetting.vala
@@ -257,9 +257,9 @@ namespace SwitchboardPlugLocale.Widgets {
public void reload_formats (Gee.ArrayList? locales) {
format_store.clear ();
var user_format = lm.get_user_format ();
- int format_id = 0;
int i = 0;
+ string? active_id = null;
foreach (var locale in locales) {
string country = Gnome.Languages.get_country_from_locale (locale, null);
@@ -269,15 +269,20 @@ namespace SwitchboardPlugLocale.Widgets {
format_store.set (iter, 0, country, 1, locale);
if (locale == user_format) {
- format_id = i;
+ active_id = locale;
}
i++;
}
}
+ format_combobox.id_column = 1;
format_combobox.sensitive = i != 1; // set to unsensitive if only have one item
- format_combobox.active = format_id;
+ if (active_id != null) {
+ format_combobox.active_id = active_id;
+ } else {
+ format_combobox.active = 0;
+ }
format_store.set_sort_column_id (0, Gtk.SortType.ASCENDING);