From 75862c0d2071ac0ca804b18c0bc25009e48ae714 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 4 Nov 2021 15:26:05 +0000 Subject: [PATCH 1/2] Select correct format after install/remove Co-authored-by: awissu --- src/LocaleManager.vala | 2 +- src/Plug.vala | 2 -- src/Widgets/LocaleSetting.vala | 11 ++++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) 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); From e40b2b52af82e132e12337b97494eedc41a5b407 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 4 Nov 2021 18:00:49 +0000 Subject: [PATCH 2/2] Update AppData --- data/io.elementary.switchboard.locale.appdata.xml.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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
  • -
    +