Codebase list cdebconf / f32a062
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
12 changed file(s) with 50 addition(s) and 43 deletion(s). Raw diff Collapse all Expand all
00 cdebconf (0.75) UNRELEASED; urgency=low
11
22 * 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.
79 - Fix text frontend segfault when encountering empty elements in Choices
810 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.
1112 - Make the text frontend output a blank line before the first title in
1213 go() if it was already displaying a progress bar (closes: #271707).
1314 - If possible, clean source directory in 'debian/rules clean' so that
303303 * int set_title(struct frontend *, char *title):
304304 Set the title variable. "title" is owned by caller, so you should
305305 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.
311316 * cangoforward/cangoback -- XXX I don't understand what these do.
312317
313318 Each of these methods have a signature defined in frontend.h. All methods
77 fset
88 get
99 go
10 info
1011 input
1112 metaget
1213 progress
2223 version
2324 x_loadtemplatefile
2425 x_save
25 x_setbacktitle
690690 }
691691
692692 /*
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.
698698 */
699699 char *
700 command_x_setbacktitle(struct confmodule *mod, char *arg)
700 command_info(struct confmodule *mod, char *arg)
701701 {
702702 struct question *q = NULL;
703703 char *out;
708708 asprintf(&out, "%u %s does not exist", CMDSTATUS_BADQUESTION, arg);
709709 return out;
710710 }
711 mod->frontend->methods.set_backtitle(mod->frontend, q);
711 mod->frontend->methods.info(mod->frontend, q);
712712
713713 asprintf(&out, "%u OK", CMDSTATUS_SUCCESS);
714714 return out;
214214 char *command_settitle(struct confmodule *mod, char *arg);
215215
216216 /**
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 *);
225226
226227 /**
227228 * @brief handler for the DATA debconf command
7777 f->title = STRDUP(title);
7878 }
7979
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;
8484 }
8585
8686 static bool frontend_can_go_back(struct frontend *ui, struct question *q)
183183 SETMETHOD(shutdown);
184184 SETMETHOD(query_capability);
185185 SETMETHOD(set_title);
186 SETMETHOD(set_backtitle);
186 SETMETHOD(info);
187187 SETMETHOD(add);
188188 SETMETHOD(go);
189189 SETMETHOD(clear);
217217 DELETE(obj->questions);
218218 DELETE(obj->capb);
219219 DELETE(obj->title);
220 DELETE(obj->backtitle);
220 DELETE(obj->info);
221221 DELETE(obj->progress_title);
222222 DELETE(obj);
223223 }
2222 int (*shutdown)(struct frontend *);
2323 unsigned long (*query_capability)(struct frontend *);
2424 void (*set_title)(struct frontend *, const char *title);
25 void (*set_backtitle)(struct frontend *, struct question *);
25 void (*info)(struct frontend *, struct question *);
2626 int (*add)(struct frontend *, struct question *q);
2727 int (*go)(struct frontend *);
2828 void (*clear)(struct frontend *);
5757 int interactive;
5858 char *capb;
5959 char *title;
60 struct question *backtitle;
60 struct question *info;
6161 char *progress_title;
6262 int progress_min, progress_max, progress_cur;
6363
10231023 newtInit();
10241024 newtCls();
10251025 }
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");
10281028 if (text)
10291029 newtDrawRootText(0, 0, text);
10301030 free(text);
10741074 obj->progress_cur = min;
10751075 newtInit();
10761076 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");
10791079 if (text)
10801080 newtDrawRootText(0, 0, text);
10811081 free(text);
11
22 . ../client/confmodule
33
4 db_x_setbacktitle progress/backtitle
4 db_info progress/info
55
66 db_progress start 0 100 progress/title
77
0 Template: progress/backtitle
0 Template: progress/info
11 Type: title
22 Description: cdebconf test suite (progress bars)
33
2323 read ans
2424 debug "ANS: $ans"
2525
26 echo "X_SETBACKTITLE test/backtitle"
26 echo "INFO test/info"
2727
2828 read ans
2929 debug "ANS: $ans"
11 Type: string
22 Description: Debconf's language
33
4 Template: test/backtitle
4 Template: test/info
55 Type: title
66 Description: cdebconf test suite
77 Description-de.UTF-8: cdebconf-Prüfung und einige andere Wörter