Add a preference to temporarily disable Nightscout readings, for example if connectivity goes down

This commit is contained in:
2024-05-23 13:16:01 +02:00
parent 3f4b473c25
commit de85d1867f
3 changed files with 26 additions and 4 deletions

View File

@@ -19,6 +19,16 @@ export default class NightscoutPreferences extends ExtensionPreferences {
page.add(group);
const update_row = new Adw.SwitchRow({
title: _('Connect to Nightscout'),
subtitle: _('Update current data from Nightscout'),
});
group.add(update_row);
window._settings.bind('update-data', update_row, 'active',
Gio.SettingsBindFlags.DEFAULT);
const url_row = new Adw.EntryRow({
title: _('Nightscout URL'),
});
@@ -26,8 +36,6 @@ export default class NightscoutPreferences extends ExtensionPreferences {
url_row.set_show_apply_button(true);
group.add(url_row);
//window._settings.bind('url', url_row, 'text',
// Gio.SettingsBindFlags.DEFAULT);
url_row.set_text(window._settings.get_string('url'));
url_row.connect('apply', () => {
window._settings.set_string('url', url_row.text);