Move power confirmation below fingerprint label with own text
Confirmation prompt is now a self-contained box (label + buttons) appended at the bottom of the login box instead of reusing the error label above the fingerprint text.
This commit is contained in:
parent
fb11c551bd
commit
fe6421c582
@ -303,27 +303,29 @@ class LockscreenWindow(Gtk.ApplicationWindow):
|
||||
self._show_power_confirm(confirm_msg, action)
|
||||
|
||||
def _show_power_confirm(self, message: str, action: Callable[[], None]) -> None:
|
||||
"""Show inline confirmation buttons for a power action."""
|
||||
# Replace error label with confirmation prompt
|
||||
self._error_label.set_text(message)
|
||||
self._error_label.set_visible(True)
|
||||
self._error_label.remove_css_class("error-label")
|
||||
self._error_label.add_css_class("confirm-label")
|
||||
|
||||
# Add confirm buttons below the error label
|
||||
self._confirm_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)
|
||||
"""Show inline confirmation below the login box."""
|
||||
self._confirm_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8)
|
||||
self._confirm_box.set_halign(Gtk.Align.CENTER)
|
||||
self._confirm_box.set_margin_top(16)
|
||||
|
||||
confirm_label = Gtk.Label(label=message)
|
||||
confirm_label.add_css_class("confirm-label")
|
||||
self._confirm_box.append(confirm_label)
|
||||
|
||||
button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)
|
||||
button_box.set_halign(Gtk.Align.CENTER)
|
||||
|
||||
yes_btn = Gtk.Button(label=self._strings.confirm_yes)
|
||||
yes_btn.add_css_class("confirm-yes")
|
||||
yes_btn.connect("clicked", lambda _: self._execute_power_action(action))
|
||||
self._confirm_box.append(yes_btn)
|
||||
button_box.append(yes_btn)
|
||||
|
||||
no_btn = Gtk.Button(label=self._strings.confirm_no)
|
||||
no_btn.add_css_class("confirm-no")
|
||||
no_btn.connect("clicked", lambda _: self._dismiss_power_confirm())
|
||||
self._confirm_box.append(no_btn)
|
||||
button_box.append(no_btn)
|
||||
|
||||
self._confirm_box.append(button_box)
|
||||
self._login_box.append(self._confirm_box)
|
||||
|
||||
def _execute_power_action(self, action: Callable[[], None]) -> None:
|
||||
@ -345,6 +347,3 @@ class LockscreenWindow(Gtk.ApplicationWindow):
|
||||
if hasattr(self, "_confirm_box"):
|
||||
self._login_box.remove(self._confirm_box)
|
||||
del self._confirm_box
|
||||
self._error_label.set_visible(False)
|
||||
self._error_label.remove_css_class("confirm-label")
|
||||
self._error_label.add_css_class("error-label")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user