summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/newt-frontend.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-05-15 22:29:29 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-05-15 22:29:29 +0000
commit4c89ff791a13036e94ede0613b387e7e1af508de (patch)
tree3249ddb478d70032d24c264c953a22f9161e6f51 /mdk-stage1/newt-frontend.c
parent0748a0f4729d111dc7ed3b035efd90295dccdca5 (diff)
downloaddrakx-4c89ff791a13036e94ede0613b387e7e1af508de.tar
drakx-4c89ff791a13036e94ede0613b387e7e1af508de.tar.gz
drakx-4c89ff791a13036e94ede0613b387e7e1af508de.tar.bz2
drakx-4c89ff791a13036e94ede0613b387e7e1af508de.tar.xz
drakx-4c89ff791a13036e94ede0613b387e7e1af508de.zip
allow wait_message calls to be multi-lines
Diffstat (limited to 'mdk-stage1/newt-frontend.c')
-rw-r--r--mdk-stage1/newt-frontend.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/mdk-stage1/newt-frontend.c b/mdk-stage1/newt-frontend.c
index 867a6d7f1..a822227a3 100644
--- a/mdk-stage1/newt-frontend.c
+++ b/mdk-stage1/newt-frontend.c
@@ -78,11 +78,12 @@ void info_message(char *msg, ...)
void wait_message(char *msg, ...)
{
- int width = 8;
- int height = 3;
+ int width, height;
char * title = "Please wait...";
newtComponent c, f;
+ newtGrid grid;
char * buf = NULL;
+ char * flowed;
int size = 0;
int i = 0;
va_list args;
@@ -94,19 +95,23 @@ void wait_message(char *msg, ...)
if (buf) free(buf);
buf = malloc(size);
i = vsnprintf(buf, size, msg, args);
- width += i;
- } while (i == size);
+ } while (i >= size || i == -1);
+
+ flowed = newtReflowText(buf, 60, 5, 5, &width, &height);
va_end(args);
- newtCenteredWindow(width, height, title);
+ c = newtTextbox(-1, -1, width, height, NEWT_TEXTBOX_WRAP);
+ newtTextboxSetText(c, flowed);
- c = newtTextbox(1, 1, width - 2, height - 2, NEWT_TEXTBOX_WRAP);
- newtTextboxSetText(c, buf);
- f = newtForm(NULL, NULL, 0);
+ grid = newtCreateGrid(1, 1);
+ newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, c, 0, 0, 0, 0, 0, 0);
+ newtGridWrappedWindow(grid, title);
+ free(flowed);
free(buf);
+ f = newtForm(NULL, NULL, 0);
newtFormAddComponent(f, c);
newtDrawForm(f);