diff --git a/iridium_installer/ui/window.py b/iridium_installer/ui/window.py index cbe308c..21848aa 100644 --- a/iridium_installer/ui/window.py +++ b/iridium_installer/ui/window.py @@ -233,19 +233,31 @@ class InstallerWindow(Adw.ApplicationWindow): finish_page = Adw.StatusPage() finish_page.set_title(message) + + btn = Gtk.Button() + btn.set_halign(Gtk.Align.CENTER) + if success: finish_page.set_icon_name("emblem-ok-symbolic") finish_page.set_description("You can now restart your computer.") - btn_label = "Restart" + btn.set_label("Restart System") + btn.add_css_class("suggested-action") + btn.add_css_class("pill") + + def on_restart(b): + import subprocess + try: + subprocess.run(["systemctl", "reboot"]) + except Exception as e: + print(f"Failed to reboot: {e}") + self.close() + + btn.connect("clicked", on_restart) else: finish_page.set_icon_name("dialog-error-symbolic") finish_page.set_description("An error occurred during installation.") - btn_label = "Close" - - btn = Gtk.Button(label=btn_label) - btn.set_halign(Gtk.Align.CENTER) - btn.add_css_class("suggested-action") - btn.connect("clicked", lambda b: self.close()) + btn.set_label("Close Installer") + btn.connect("clicked", lambda b: self.close()) finish_page.set_child(btn)