7 newtComponent form
, scale
;
10 struct ui_progress
*ui_progress__new(const char *title
, u64 total
)
12 struct ui_progress
*self
= malloc(sizeof(*self
));
19 newtGetScreenSize(&cols
, NULL
);
21 newtCenteredWindow(cols
, 1, title
);
22 self
->form
= newtForm(NULL
, NULL
, 0);
23 if (self
->form
== NULL
)
25 self
->scale
= newtScale(0, 0, cols
, total
);
26 if (self
->scale
== NULL
)
28 newtFormAddComponent(self
->form
, self
->scale
);
35 newtFormDestroy(self
->form
);
41 void ui_progress__update(struct ui_progress
*self
, u64 curr
)
44 * FIXME: We should have a per UI backend way of showing progress,
45 * stdio will just show a percentage as NN%, etc.
49 newtScaleSet(self
->scale
, curr
);
53 void ui_progress__delete(struct ui_progress
*self
)
55 if (use_browser
> 0) {
56 newtFormDestroy(self
->form
);