New programs/dtsystemsettings/security.c with the reference's three tabs:
General "Require password to wake this computer from sleep or screen
saver" writes dtsession's lock time (_DtSetSmState with
SM_STATE_LOCKTIMEOUT; the Screen Saver page reads and writes the
same field, so the two pages show one setting). On: the lock at
the saver's time, or ten minutes without a saver. "Use secure
virtual memory" is NetBSD's vm.swap_encrypt through McdeSys
(now and in /etc/sysctl.conf, root). Automatic login and a
log-out after N minutes are shown as what the desktop has:
dtlogin always asks for a name and a password, and dtsession
has no idle logout -- the pane says so and greys the controls.
Encryption the cgd(4) volumes of /etc/cgd/cgd.conf, and the sentence that
encrypting a disk is a decision of the installation, not of a
running system; changing a passphrase is a follow-up.
Firewall the npf(7) state (rc.conf npf=YES, /etc/npf.conf); the rules
are a follow-up -- a fixed template with the shares of the
Sharing page, never free text.
McdeSys gained the security state: mcde_sys_swap_encrypt_get/_set,
mcde_sys_cgd_volumes, mcde_sys_firewall_get. netbsd.c implements them
(sysctl(8) vm.swap_encrypt, /etc/sysctl.conf through a KeySet() that rc.conf
now uses too, /etc/cgd/cgd.conf, rc.conf's npf), linux.c answers
MCDE_SYS_ENOTSUP with a sentence saying whose feature it is.
test_sysinfo prints all three.
The pane's icon is new: programs/icons/McdeLock.pm (a padlock, palette
colours); "security" is a real pane now, not a greyed entry.
Measured under Xvfb with xdotool (dtsession started in the session):
- the lock checkbox: _DT_SM_STATE_INFO on dtsession's window before the
click 0xfff, ... lockTimeout 0x0; after it 0x100 (SM_STATE_LOCKTIMEOUT),
lockTimeout 0x258 (600 s); a second click puts it back to 0x0;
- the three tabs and their content (docs/screenshots/leopard/
System-Preferences-Security-mcde.png with the lock on, ...-Encryption-
mcde.png, ...-Firewall-mcde.png);
- test_sysinfo on this (Linux) host prints the three MCDE_SYS_ENOTSUP
sentences -- the pane shows them instead of dead controls;
- make check programs/dtsystemsettings: test_panes PASS; the Sound and
Keyboard & Mouse panes still switch their tabs after the layout fix
below;
- make programs/dtsystemsettings, lib/McdeSys exit=0.
A Motif lesson, saved in AGENTS.md: a row column inside the pane area takes
the other orientation unless told, a child added later to a tight-packed
column goes into the next column, and a page managed for the first time after
its widgets were built keeps a height of one line. The pane therefore builds
its page fresh inside an XmPACK_COLUMN container on a tab change; the same
XmNorientation, XmVERTICAL went into the Sound and Keyboard & Mouse page
containers.
Not measured, because this host is not NetBSD or has no root: swapping
vm.swap_encrypt, reading cgd volumes, the npf state and writing npf rules.
They are the follow-up task for the VM.
82 lines
3.4 KiB
C
82 lines
3.4 KiB
C
/*
|
|
* ui.h -- dtsystemsettings: what the panes share (main.c)
|
|
*
|
|
* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
*/
|
|
|
|
#ifndef _dtsystemsettings_ui_h
|
|
#define _dtsystemsettings_ui_h
|
|
|
|
#include <X11/Intrinsic.h>
|
|
#include <Xm/Xm.h>
|
|
|
|
extern XtAppContext app;
|
|
|
|
XmRenderTable PaneFont(Widget w, int size, Boolean bold);
|
|
Widget Text(Widget parent, const char *name, const char *text);
|
|
void SetText(Widget w, const char *text);
|
|
Widget Button(Widget parent, const char *label, XtCallbackProc cb,
|
|
XtPointer data);
|
|
Widget PaneButton(Widget parent, const char *label, XtCallbackProc cb,
|
|
XtPointer data);
|
|
Widget Table(Widget parent, const char *const *rows, int n, Widget *values);
|
|
Pixmap Icon(Widget w, const char *file);
|
|
void Spawn(const char *command);
|
|
|
|
/* a message in a small window; ERROR: an error */
|
|
void Message(Widget parent, const char *text, int error);
|
|
/* the command line that runs COMMAND as root in a terminal, after su(1)
|
|
* asked for the password there ("Unlock..."); into BUF */
|
|
void AsRoot(const char *title, const char *command, char *buf, size_t len);
|
|
|
|
/* the panes in accounts.c and update.c */
|
|
Widget MakeAccounts(Widget parent);
|
|
Widget MakeUpdate(Widget parent);
|
|
/* the value of a resource in the server's RESOURCE_MANAGER, read anew
|
|
* (Xlib keeps the string of the connection's start); DEF when none */
|
|
void ServerResource(Display *dpy, const char *name, const char *class,
|
|
const char *def, char *buf, size_t len);
|
|
/* the Desktop & Screen Saver pane (desktop.c), opened on its desktop (0) or
|
|
* its screen saver page (1) */
|
|
Widget MakeDesktopPane(Widget parent, int saver);
|
|
/* the Network pane (network.c); dtsystemsettings -renew-dhcp IF */
|
|
Widget MakeNetwork(Widget parent);
|
|
int RenewDhcpCommand(const char *ifname);
|
|
/* the Wi-Fi tab of a card in the Network pane (wifi.c); IFNAME NULL: the
|
|
* first Wi-Fi card, NULL returned without one */
|
|
Widget MakeWifi(Widget parent, const char *ifname);
|
|
/* dtsystemsettings -join-wifi IF [SSID in hex]: the terminal of "Join..." */
|
|
int JoinWifiCommand(const char *ifname, const char *hexssid);
|
|
/* the Backup pane (backup.c) */
|
|
Widget MakeBackup(Widget parent);
|
|
/* the Sharing pane (sharing.c) */
|
|
Widget MakeSharing(Widget parent);
|
|
/* the Startup pane (startup.c) */
|
|
Widget MakeStartup(Widget parent);
|
|
/* the time zone in Date & Time (timezone.c) */
|
|
Widget MakeZoneChooser(Widget parent);
|
|
/* dtsystemsettings -set-timezone ZONE: what the terminal of "Set Time Zone"
|
|
* runs */
|
|
int SetTimezoneCommand(const char *zone);
|
|
/* the panes in appearance.c */
|
|
Widget MakeAppearance(Widget parent);
|
|
Widget MakeFonts(Widget parent);
|
|
/* the Language pane (language.c), ~/.dt/language at login
|
|
* (Xsession.d/0010.language) */
|
|
Widget MakeLanguage(Widget parent);
|
|
/* the Keyboard & Mouse pane (input.c): three tabs, WHICH is "keyboard"
|
|
* (the default), "mouse" or "shortcuts" */
|
|
Widget MakeInput(Widget parent, const char *which);
|
|
/* the Sound pane (sound.c): Sound Effects | Output | Input */
|
|
Widget MakeSound(Widget parent);
|
|
/* the Security pane (security.c): General | Encryption | Firewall */
|
|
Widget MakeSecurity(Widget parent);
|
|
/* the Displays pane (displays.c) and dtsystemsettings -apply-displays,
|
|
* ~/.dt/displays at login (Xsession.d/0071.displays) */
|
|
Widget MakeDisplays(Widget parent);
|
|
int ApplyDisplaysCommand(Display *dpy);
|
|
/* dtsystemsettings -apply-update: what the terminal of "Update Now" runs */
|
|
int ApplyUpdate(void);
|
|
|
|
#endif /* _dtsystemsettings_ui_h */
|