Files
mcde/programs/dtbar/items.h
T
lotherkandClaude Opus 5.5 2c7ca200b0 mcde: dtbar's M menu: About This Computer, Favourites, Recent Items, Force Quit, power
The M menu has About This Computer (logo, system and version, processor,
memory, startup disk, More Info with machine, kernel, host name, disk space
and the desktop's version, all from mcde_sys_info), Software Update (greyed
until the update exists), System Settings, Favourites (~/.dt/favourites, with
Edit Favourites...) and Recent Items (~/.dt/recent, written when an item is
opened, with Clear Menu) -- items.c with its test (PASS test_items) --, Force
Quit (the programs with a window, XKillClient), Sleep, Restart..., Shut
Down... (McdeSys, the last two ask first), Lock Screen and Log Out <name>.
The bar's dialogs are centred on the screen (Motif centred them on the bar).
Tested on Xvfb: About, a favourite started and listed under Recent Items,
Force Quit ended dtcalc, the Shut Down question shows (not confirmed: on the
development host it could shut the computer down).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 08:03:48 +00:00

37 lines
1.1 KiB
C

/*
* items.h -- dtbar: the lists behind Favourites and Recent Items (items.c)
*
* Copyright (c) 2026 The Makronix project. GNU LGPL 2.0 or later, as CDE.
*
* One item a line, "LABEL<TAB>COMMAND"; a line without a tab is its own
* label and command; '#' starts a comment line. ~/.dt/favourites is
* written by the user (the menu has "Edit Favourites..."); ~/.dt/recent by
* dtbar, newest first. C99 and POSIX only: test_items.c tests it.
*/
#ifndef _dtbar_items_h
#define _dtbar_items_h
#include <stddef.h>
#define ITEMS_MAX 32
typedef struct {
char label[96];
char command[512];
} Item;
/* read FILE into ITEMS (at most MAX); returns the count, 0 if there is none */
extern int ItemsRead(const char *file, Item *items, int max);
/* write ITEMS to FILE (a new file, renamed over the old); 0 or -1 */
extern int ItemsWrite(const char *file, const Item *items, int n);
/*
* ITEM to the front of the list (it moves there if it was in it already), the
* list cut to MAX; returns the new count
*/
extern int ItemsPush(Item *items, int n, int max, const Item *item);
#endif /* _dtbar_items_h */