mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-24 08:23:33 +03:00
28 lines
693 B
Ruby
28 lines
693 B
Ruby
module GUI
|
|
class QuitWindow < LVGUI::BaseWindow
|
|
include LVGUI::ButtonPalette
|
|
|
|
def run(*cmd)
|
|
$stderr.puts " $ " + cmd.join(" ")
|
|
system(*cmd) unless LVGL::Introspection.simulator?
|
|
end
|
|
|
|
def initialize()
|
|
super()
|
|
LVGUI::BackButton.new(@toolbar, MainWindow.instance)
|
|
@container.refresh
|
|
|
|
add_buttons([
|
|
["Reboot", ->() { run("reboot") }],
|
|
["Reboot to recovery", ->() { run("reboot recovery") }],
|
|
["Reboot to bootloader", ->() { run("reboot bootloader") }],
|
|
["Power off", ->() { run("poweroff") }],
|
|
])
|
|
|
|
if LVGL::Introspection.simulator?
|
|
add_button("Quit") { exit(0) }
|
|
end
|
|
end
|
|
end
|
|
end
|