-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdisplay.h
51 lines (45 loc) · 1.56 KB
/
display.h
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
#ifndef _DISPLAY_H_
#define _DISPLAY_H_
#include <stdbool.h>
#include "service.h"
#include "bus.h"
#define KEY_RETURN 10
#define KEY_ESC 27
#define KEY_SPACE 32
#define D_ESCOFF_MS 300000LLU
#define D_VERSION "1.4.5"
#define D_FUNCTIONS "F1:START F2:STOP F3:RESTART F4:ENABLE F5:DISABLE F6:MASK F7:UNMASK F8:RELOAD"
#define D_SERVICE_TYPES "A:ALL D:DEV I:SLICE S:SERVICE O:SOCKET T:TARGET R:TIMER M:MOUNT C:SCOPE N:AMOUNT W:SWAP P:PATH H:SSHOT"
#define D_HEADLINE "ServiceMaster "D_VERSION""
#define D_NAVIGATION "Left/Right: Modus | Up/Down: Select | Return: Show status"
#define D_QUIT "Q/ESC:Quit"
#define D_XLOAD 104
#define D_XACTIVE 114
#define D_XSUB 124
#define D_XDESCRIPTION 134
#define D_MODE(m) {\
position = 0;\
index_start = 0;\
mode = m;\
clear();\
}
#define D_OP(bus, svc, mode, txt) {\
bool success = false;\
if(bus->type == SYSTEM && euid != 0) {\
display_status_window(" You must be root for this operation on system units. Press space to toggle: System/User.", "info:");\
break;\
}\
svc = service_ypos(bus, position + 4);\
success = bus_operation(bus, svc, mode);\
if (!success)\
display_status_window("Command could not be executed on this unit.", txt":");\
}
enum bus_type display_bus_type(void);
enum service_type display_mode(void);
void display_erase(void);
void display_init(void);
void display_redraw(Bus *bus);
void display_redraw_row(Service *svc);
void display_set_bus_type(enum bus_type);
void display_status_window(const char *status, const char *title);
#endif