-
Notifications
You must be signed in to change notification settings - Fork 5
/
Settings.c
138 lines (124 loc) · 3.18 KB
/
Settings.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include "EFIDroidUi.h"
STATIC
EFI_STATUS
SettingsMenuBackCallback (
MENU_OPTION* This
)
{
MenuStackPop();
MenuFree(This);
return EFI_SUCCESS;
}
STATIC
EFI_STATUS
ShowFileExplorerCallback (
MENU_ENTRY* This
)
{
SettingBoolSet("ui-show-file-explorer", !This->ToggleEnabled);
This->ToggleEnabled = SettingBoolGet("ui-show-file-explorer");
InvalidateActiveMenu();
MainMenuUpdateUi();
return EFI_SUCCESS;
}
STATIC
EFI_STATUS
ShowUEFIOptionsCallback (
MENU_ENTRY* This
)
{
SettingBoolSet("ui-show-uefi-options", !This->ToggleEnabled);
This->ToggleEnabled = SettingBoolGet("ui-show-uefi-options");
InvalidateActiveMenu();
MainMenuUpdateUi();
return EFI_SUCCESS;
}
STATIC
EFI_STATUS
ShowFastbootCallback (
MENU_ENTRY* This
)
{
SettingBoolSet("ui-show-fastboot", !This->ToggleEnabled);
This->ToggleEnabled = SettingBoolGet("ui-show-fastboot");
InvalidateActiveMenu();
MainMenuUpdateUi();
return EFI_SUCCESS;
}
STATIC
EFI_STATUS
AutoselectLastBootCallback (
MENU_ENTRY* This
)
{
SettingBoolSet("ui-autoselect-last-boot", !This->ToggleEnabled);
This->ToggleEnabled = SettingBoolGet("ui-autoselect-last-boot");
InvalidateActiveMenu();
return EFI_SUCCESS;
}
STATIC
EFI_STATUS
ShowPermissiveCallback (
MENU_ENTRY* This
)
{
SettingBoolSet("boot-force-permissive", !This->ToggleEnabled);
This->ToggleEnabled = SettingBoolGet("boot-force-permissive");
InvalidateActiveMenu();
MainMenuUpdateUi();
return EFI_SUCCESS;
}
EFI_STATUS
SettingsMenuShow (
VOID
)
{
MENU_ENTRY *Entry;
MENU_OPTION* Menu;
// create menu
Menu = MenuCreate();
Menu->Title = AsciiStrDup("Settings");
Menu->BackCallback = SettingsMenuBackCallback;
// UEFI options
Entry = MenuCreateEntry();
Entry->Name = AsciiStrDup("Show UEFI boot options");
Entry->ShowToggle = TRUE;
Entry->ToggleEnabled = SettingBoolGet("ui-show-uefi-options");
Entry->HideBootMessage = TRUE;
Entry->Callback = ShowUEFIOptionsCallback;
MenuAddEntry(Menu, Entry);
// file explorer
Entry = MenuCreateEntry();
Entry->Name = AsciiStrDup("Show File Explorer");
Entry->ShowToggle = TRUE;
Entry->ToggleEnabled = SettingBoolGet("ui-show-file-explorer");
Entry->HideBootMessage = TRUE;
Entry->Callback = ShowFileExplorerCallback;
MenuAddEntry(Menu, Entry);
// fastboot
Entry = MenuCreateEntry();
Entry->Name = AsciiStrDup("Show Fastboot");
Entry->ShowToggle = TRUE;
Entry->ToggleEnabled = SettingBoolGet("ui-show-fastboot");
Entry->HideBootMessage = TRUE;
Entry->Callback = ShowFastbootCallback;
MenuAddEntry(Menu, Entry);
// autoselect last booted entry
Entry = MenuCreateEntry();
Entry->Name = AsciiStrDup("Autoselect last booted OS");
Entry->ShowToggle = TRUE;
Entry->ToggleEnabled = SettingBoolGet("ui-autoselect-last-boot");
Entry->HideBootMessage = TRUE;
Entry->Callback = AutoselectLastBootCallback;
MenuAddEntry(Menu, Entry);
// selinux
Entry = MenuCreateEntry();
Entry->Name = AsciiStrDup("Force selinux to permissive");
Entry->ShowToggle = TRUE;
Entry->ToggleEnabled = SettingBoolGet("boot-force-permissive");
Entry->HideBootMessage = TRUE;
Entry->Callback = ShowPermissiveCallback;
MenuAddEntry(Menu, Entry);
MenuStackPush(Menu);
return EFI_SUCCESS;
}