Rename X_SETBACKTITLE command to INFO and improve documentation of what
frontends should do with it, per:
http://lists.debian.org/debian-boot/2005/01/msg01104.html
r26668
Colin Watson
19 years ago
0 | 0 | cdebconf (0.75) UNRELEASED; urgency=low |
1 | 1 | |
2 | 2 | * Colin Watson |
3 | - Add an X_SETBACKTITLE command, which sets the backdrop title. In the | |
4 | newt frontend, this appears as text at the top left-hand corner of the | |
5 | screen. This is to be used for top-level operational modes of the | |
6 | installer, such as rescue mode. | |
3 | - Add an INFO command, which may (depending on the frontend) display an | |
4 | out-of-band informative message. Unlike inputting a note, this doesn't | |
5 | require an acknowledgement from the user. Like PROGRESS INFO, | |
6 | frontends should display the info persistently until some other info | |
7 | comes along. In the newt frontend, this appears as text at the top | |
8 | left-hand corner of the screen; no other frontends implement it yet. | |
7 | 9 | - Fix text frontend segfault when encountering empty elements in Choices |
8 | 10 | field (closes: #256557). |
9 | - Fix memory leaks in METAGET, PROGRESS, SETTITLE, and X_SETBACKTITLE | |
10 | commands. | |
11 | - Fix memory leaks in METAGET, PROGRESS, and SETTITLE commands. | |
11 | 12 | - Make the text frontend output a blank line before the first title in |
12 | 13 | go() if it was already displaying a progress bar (closes: #271707). |
13 | 14 | - If possible, clean source directory in 'debian/rules clean' so that |
303 | 303 | * int set_title(struct frontend *, char *title): |
304 | 304 | Set the title variable. "title" is owned by caller, so you should |
305 | 305 | copy it. The default implementation sets the title attribute. |
306 | * int set_backtitle(struct frontend *, struct question *); | |
307 | Set the backdrop title variable. This takes a question rather than a | |
308 | string because the locale could be changed after this command, and the | |
309 | displayed text should be changed when that happens. The default | |
310 | implementation sets the backtitle attribute. | |
306 | * int info(struct frontend *, struct question *); | |
307 | Display an informative message, without requiring any acknowledgement | |
308 | from the user. Frontends may choose not to implement this. If they do | |
309 | implement it, they should display the info persistently until some | |
310 | other info comes along. | |
311 | This takes a question rather than a string because the locale could be | |
312 | changed after this command (while the info is still being persistently | |
313 | displayed), and the displayed text should be changed when that | |
314 | happens. | |
315 | The default implementation sets the info attribute. | |
311 | 316 | * cangoforward/cangoback -- XXX I don't understand what these do. |
312 | 317 | |
313 | 318 | Each of these methods have a signature defined in frontend.h. All methods |
7 | 7 | fset |
8 | 8 | get |
9 | 9 | go |
10 | info | |
10 | 11 | input |
11 | 12 | metaget |
12 | 13 | progress |
22 | 23 | version |
23 | 24 | x_loadtemplatefile |
24 | 25 | x_save |
25 | x_setbacktitle |
690 | 690 | } |
691 | 691 | |
692 | 692 | /* |
693 | * Set a backdrop title. Use this to describe top-level modes of the | |
694 | * system as a whole. | |
695 | * | |
696 | * Takes a template name and sets the backdrop title to the description | |
697 | * of the template. | |
693 | * Displays the given template as an out-of-band informative message. Unlike | |
694 | * inputting a note, this doesn't require an acknowledgement from the user, | |
695 | * and depending on the frontend it may not even be displayed at all. Like | |
696 | * PROGRESS INFO, frontends should display the info persistently until some | |
697 | * other info comes along. | |
698 | 698 | */ |
699 | 699 | char * |
700 | command_x_setbacktitle(struct confmodule *mod, char *arg) | |
700 | command_info(struct confmodule *mod, char *arg) | |
701 | 701 | { |
702 | 702 | struct question *q = NULL; |
703 | 703 | char *out; |
708 | 708 | asprintf(&out, "%u %s does not exist", CMDSTATUS_BADQUESTION, arg); |
709 | 709 | return out; |
710 | 710 | } |
711 | mod->frontend->methods.set_backtitle(mod->frontend, q); | |
711 | mod->frontend->methods.info(mod->frontend, q); | |
712 | 712 | |
713 | 713 | asprintf(&out, "%u OK", CMDSTATUS_SUCCESS); |
714 | 714 | return out; |
214 | 214 | char *command_settitle(struct confmodule *mod, char *arg); |
215 | 215 | |
216 | 216 | /** |
217 | * @brief handler for the X_SETBACKTITLE debconf command | |
218 | * | |
219 | * Set the debconf backdrop title to the description of the template | |
220 | * specified | |
221 | * | |
222 | * @warning This is not in the debconf spec | |
223 | */ | |
224 | char *command_x_setbacktitle(struct confmodule *mod, char *); | |
217 | * @brief handler for the INFO debconf command | |
218 | * | |
219 | * Displays the given template as an out-of-band informative message. Unlike | |
220 | * inputting a note, this doesn't require an acknowledgement from the user, | |
221 | * and depending on the frontend it may not even be displayed at all. | |
222 | * | |
223 | * @warning This is not in the debconf spec | |
224 | */ | |
225 | char *command_info(struct confmodule *mod, char *); | |
225 | 226 | |
226 | 227 | /** |
227 | 228 | * @brief handler for the DATA debconf command |
77 | 77 | f->title = STRDUP(title); |
78 | 78 | } |
79 | 79 | |
80 | static void frontend_set_backtitle(struct frontend *f, struct question *backtitle) | |
81 | { | |
82 | question_deref(f->backtitle); | |
83 | f->backtitle = backtitle; | |
80 | static void frontend_info(struct frontend *f, struct question *info) | |
81 | { | |
82 | question_deref(f->info); | |
83 | f->info = info; | |
84 | 84 | } |
85 | 85 | |
86 | 86 | static bool frontend_can_go_back(struct frontend *ui, struct question *q) |
183 | 183 | SETMETHOD(shutdown); |
184 | 184 | SETMETHOD(query_capability); |
185 | 185 | SETMETHOD(set_title); |
186 | SETMETHOD(set_backtitle); | |
186 | SETMETHOD(info); | |
187 | 187 | SETMETHOD(add); |
188 | 188 | SETMETHOD(go); |
189 | 189 | SETMETHOD(clear); |
217 | 217 | DELETE(obj->questions); |
218 | 218 | DELETE(obj->capb); |
219 | 219 | DELETE(obj->title); |
220 | DELETE(obj->backtitle); | |
220 | DELETE(obj->info); | |
221 | 221 | DELETE(obj->progress_title); |
222 | 222 | DELETE(obj); |
223 | 223 | } |
22 | 22 | int (*shutdown)(struct frontend *); |
23 | 23 | unsigned long (*query_capability)(struct frontend *); |
24 | 24 | void (*set_title)(struct frontend *, const char *title); |
25 | void (*set_backtitle)(struct frontend *, struct question *); | |
25 | void (*info)(struct frontend *, struct question *); | |
26 | 26 | int (*add)(struct frontend *, struct question *q); |
27 | 27 | int (*go)(struct frontend *); |
28 | 28 | void (*clear)(struct frontend *); |
57 | 57 | int interactive; |
58 | 58 | char *capb; |
59 | 59 | char *title; |
60 | struct question *backtitle; | |
60 | struct question *info; | |
61 | 61 | char *progress_title; |
62 | 62 | int progress_min, progress_max, progress_cur; |
63 | 63 |
1023 | 1023 | newtInit(); |
1024 | 1024 | newtCls(); |
1025 | 1025 | } |
1026 | if (obj->backtitle != NULL) { | |
1027 | char *text = question_get_field(obj->backtitle, "", "description"); | |
1026 | if (obj->info != NULL) { | |
1027 | char *text = question_get_field(obj->info, "", "description"); | |
1028 | 1028 | if (text) |
1029 | 1029 | newtDrawRootText(0, 0, text); |
1030 | 1030 | free(text); |
1074 | 1074 | obj->progress_cur = min; |
1075 | 1075 | newtInit(); |
1076 | 1076 | newtCls(); |
1077 | if (obj->backtitle != NULL) { | |
1078 | char *text = question_get_field(obj->backtitle, "", "description"); | |
1077 | if (obj->info != NULL) { | |
1078 | char *text = question_get_field(obj->info, "", "description"); | |
1079 | 1079 | if (text) |
1080 | 1080 | newtDrawRootText(0, 0, text); |
1081 | 1081 | free(text); |
1 | 1 | |
2 | 2 | . ../client/confmodule |
3 | 3 | |
4 | db_x_setbacktitle progress/backtitle | |
4 | db_info progress/info | |
5 | 5 | |
6 | 6 | db_progress start 0 100 progress/title |
7 | 7 |
0 | Template: progress/backtitle | |
0 | Template: progress/info | |
1 | 1 | Type: title |
2 | 2 | Description: cdebconf test suite (progress bars) |
3 | 3 |