On Sun, Jan 12, 2003 at 09:45:57PM +0100, Martin Sjögren wrote: > sön 2003-01-12 klockan 21.16 skrev Denis Barbier: > > On Sun, Jan 12, 2003 at 11:47:46AM +0100, Martin Sjögren wrote: > > > sön 2003-01-12 klockan 11.29 skrev Petter Reinholdtsen: > > > > I believe it is time to upload some udebs: > > > > > > anna needs the new cdebconf, so as soon as cdebconf is uploaded, I can > > > upload anna. > > > > The progress bar stuff is cdebconf has to be changed in order to > > help l10n. It is IMO a bad idea to upload cdebconf without this > > fix. > > True. Then I won't upload anna for a while, the only changes since 0.019 > are the progress bars and some memory freeing that we can do without. > Memory issues in main-menu are more serious since it's running for a > long(er) time. I'll spend some energy on that instead.
Here is a trivial fix, it replaces hardcoded strings by a template name whose description field is used instead of these strings. The real fix would be to redesign the progress bar stuff by adding a new template type, but this should certainly be done by tausq or joeyh. Denis
Index: src/commands.c =================================================================== RCS file: /cvs/debian-boot/debian-installer/tools/cdebconf/src/commands.c,v retrieving revision 1.40 diff -u -r1.40 commands.c --- src/commands.c 18 Dec 2002 10:06:25 -0000 1.40 +++ src/commands.c 12 Jan 2003 21:38:50 -0000 @@ -523,15 +523,15 @@ int command_progress(struct confmodule *mod, int argc, char **argv, char *out, size_t outsize) { - char buf[1024]; - int i, min, max; + int min, max; + struct question *q = NULL; + const char *value; CHECKARGC(>= 1); - buf[0] = 0; if (strcasecmp(argv[1], "start") == 0) { - CHECKARGC(>= 4); + CHECKARGC(== 4); min = atoi(argv[2]); max = atoi(argv[3]); @@ -543,18 +543,42 @@ return DC_NOTOK; } - for (i = 4; i <= argc; i++) - strvacat(buf, sizeof(buf), argv[i], " ", NULL); + q = mod->questions->methods.get(mod->questions, argv[4]); + if (q == NULL) + { + snprintf(out, outsize, "%u %s does not exist", + CMDSTATUS_BADQUESTION, argv[4]); + return DC_NOTOK; + } + value = question_get_field(q, "", "description"); + if (value == NULL) + { + snprintf(out, outsize, "%u %s description field does not exist", + CMDSTATUS_BADQUESTION, argv[4]); + return DC_NOTOK; + } mod->frontend->methods.progress_start(mod->frontend, - min, max, buf); + min, max, value); } else if (strcasecmp(argv[1], "step") == 0) { - CHECKARGC(>= 3); - for (i = 3; i <= argc; i++) - strvacat(buf, sizeof(buf), argv[i], " ", NULL); + CHECKARGC(== 3); + q = mod->questions->methods.get(mod->questions, argv[3]); + if (q == NULL) + { + snprintf(out, outsize, "%u %s does not exist", + CMDSTATUS_BADQUESTION, argv[3]); + return DC_NOTOK; + } + value = question_get_field(q, "", "description"); + if (value == NULL) + { + snprintf(out, outsize, "%u %s description field does not exist", + CMDSTATUS_BADQUESTION, argv[3]); + return DC_NOTOK; + } mod->frontend->methods.progress_step(mod->frontend, - atoi(argv[2]), buf); + atoi(argv[2]), value); } else if (strcasecmp(argv[1], "stop") == 0) { Index: src/test/progress.config =================================================================== RCS file: /cvs/debian-boot/debian-installer/tools/cdebconf/src/test/progress.config,v retrieving revision 1.1 diff -u -r1.1 progress.config --- src/test/progress.config 8 Dec 2002 00:38:07 -0000 1.1 +++ src/test/progress.config 12 Jan 2003 21:38:50 -0000 @@ -1,11 +1,11 @@ #!/bin/sh -e -echo PROGRESS START 0 100 test title +echo PROGRESS START 0 100 progress/title read ans #for i in 1 2 3 4 5 6 7 8 9 10; do for i in 10 9 8 7 6 5 4 3 2 1; do - echo PROGRESS STEP 10 info abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz $i + echo PROGRESS STEP 10 progress/step read ans sleep 1 done --- src/test/progress.templates 12 Jan 2003 00:38:07 -0000 +++ src/test/progress.templates 12 Jan 2003 00:38:07 -0000 @@ -0,0 +1,7 @@ +Template: progress/title +Type: text +Description: Test title + +Template: progress/step +Type: text +Description: info +abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz