Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion data/io.elementary.switchboard.locale.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
<icon type="stock">preferences-desktop-locale</icon>
<translation type="gettext">locale-plug</translation>
<releases>
<release version="2.5.6" date="2021-11-04" urgency="medium">
<description>
<p>Fixes:</p>
<ul>
<li>Ensure "Formats" dropdown remains correct after installing or removing languages</li>
</ul>
</description>
</release>
<release version="2.5.5" date="2021-10-26" urgency="medium">
<description>
<p>Fixes:</p>
Expand All @@ -18,7 +26,7 @@
<li>Better support for non-Ubuntu based distributions</li>
<li>Updated translations</li>
</ul>
</description>
</description>
</release>
<release version="2.5.4" date="2021-07-14" urgency="medium">
<description>
Expand Down
2 changes: 1 addition & 1 deletion src/LocaleManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 0 additions & 2 deletions src/Plug.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
});

Expand Down
11 changes: 8 additions & 3 deletions src/Widgets/LocaleSetting.vala
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ namespace SwitchboardPlugLocale.Widgets {
public void reload_formats (Gee.ArrayList<string>? 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);

Expand All @@ -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);

Expand Down