summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsegfault <segfault@riseup.net>2020-06-18 10:27:21 +0200
committersegfault <segfault@riseup.net>2020-06-18 10:28:58 +0200
commit0907a9ca2a3086e4c6165e89e96673b8dfd28ef9 (patch)
tree149e3311c8501b4d63a51ee55cb8dfdc16e1527f
parentab38050a499eb4e17f167e7f55c7e48104d76f21 (diff)
Don't load settings if the greeter settings directory is empty (refs: #17136)
This allows us to avoid showing the "Settings were loaded" notification on the first boot after configuring the persistent volume. This will not be required anymore once #11529 is done, i.e. settings are persisted immediately after configuring the persistent volume.
-rw-r--r--config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py6
-rw-r--r--config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/persistent_storage.py10
2 files changed, 13 insertions, 3 deletions
diff --git a/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py b/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py
index 92c0d1b..720779d 100644
--- a/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py
+++ b/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py
@@ -133,7 +133,7 @@ class GreeterMainWindow(Gtk.Window, TranslatableWindow):
self.listbox_settings.set_placeholder(self.label_settings_default)
# Persistent storage
- self.persistent_storage = PersistentStorage(self.persistence_setting, self.load_settings, builder)
+ self.persistent_storage = PersistentStorage(self.persistence_setting, self.load_settings, self.apply_settings, builder)
# Add children to ApplicationWindow
self.add(self.box_main)
@@ -178,6 +178,10 @@ class GreeterMainWindow(Gtk.Window, TranslatableWindow):
# Actions
+ def apply_settings(self):
+ for setting in self.settings:
+ setting.apply()
+
def load_settings(self):
# We have to load formats and keyboard before language, because
# changing the language also changes the other two, which causes
diff --git a/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/persistent_storage.py b/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/persistent_storage.py
index 62a0887..2955908 100644
--- a/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/persistent_storage.py
+++ b/config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/persistent_storage.py
@@ -1,9 +1,11 @@
import logging
import gi
+import os
import threading
from typing import TYPE_CHECKING, Callable
from tailsgreeter.ui import _
+from tailsgreeter.config import settings_dir
gi.require_version('GLib', '2.0')
gi.require_version('Gtk', '3.0')
@@ -14,9 +16,10 @@ if TYPE_CHECKING:
class PersistentStorage(object):
- def __init__(self, persistence_setting: "PersistenceSettings", load_settings_cb: Callable, builder):
+ def __init__(self, persistence_setting: "PersistenceSettings", load_settings_cb, apply_settings_cb: Callable, builder):
self.persistence_setting = persistence_setting
self.load_settings_cb = load_settings_cb
+ self.apply_settings_cb = apply_settings_cb
self.box_storage = builder.get_object('box_storage')
self.box_storage_unlock = builder.get_object('box_storage_unlock')
@@ -110,7 +113,10 @@ class PersistentStorage(object):
self.box_storage_unlocked.set_visible(True)
self.button_start.set_sensitive(True)
- self.load_settings_cb()
+ if not os.listdir(settings_dir):
+ self.apply_settings_cb()
+ else:
+ self.load_settings_cb()
def cb_checkbutton_storage_show_passphrase_toggled(self, widget):
self.entry_storage_passphrase.set_visibility(widget.get_active())