Commit 36f5fe4b authored by segfault's avatar segfault

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.
parent f7d22588
......@@ -133,7 +133,7 @@ class GreeterMainWindow(Gtk.Window, TranslatableWindow):
# 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
......@@ -178,6 +178,10 @@ class GreeterMainWindow(Gtk.Window, TranslatableWindow):
# Actions
def apply_settings(self):
for setting in self.settings:
def load_settings(self):
# We have to load formats and keyboard before language, because
# changing the language also changes the other two, which causes
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):
if not os.listdir(settings_dir):
def cb_checkbutton_storage_show_passphrase_toggled(self, widget):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment