aboutsummaryrefslogtreecommitdiffstats
path: root/ui.c
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2012-07-04 20:08:05 -0700
committerKoushik Dutta <koushd@gmail.com>2012-07-04 20:08:05 -0700
commitf8fc12e741d566af215407f35cfc52e5c1cc0023 (patch)
tree1fcf00fc7f52caf7d169afb6330cba3bf631c437 /ui.c
parentd9425b14a4d466ea00d6af5d8657334333015e39 (diff)
downloadbootable_recovery-f8fc12e741d566af215407f35cfc52e5c1cc0023.zip
bootable_recovery-f8fc12e741d566af215407f35cfc52e5c1cc0023.tar.gz
bootable_recovery-f8fc12e741d566af215407f35cfc52e5c1cc0023.tar.bz2
fixup backup and restore status
Change-Id: I2065755c26a2b49f09ac8592c61faa9474ce2f57
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/ui.c b/ui.c
index 97a8152..3ca9598 100644
--- a/ui.c
+++ b/ui.c
@@ -629,9 +629,24 @@ static long delta_milliseconds(struct timeval from, struct timeval to) {
static struct timeval lastupdate = (struct timeval) {0};
static int ui_nice = 0;
+static int ui_niced = 0;
void ui_set_nice(int enabled) {
ui_nice = enabled;
}
+#define NICE_INTERVAL 100
+int ui_was_niced() {
+ return ui_niced;
+}
+int ui_get_text_cols() {
+ return text_cols;
+}
+void ui_delete_line() {
+ pthread_mutex_lock(&gUpdateMutex);
+ text[text_row][0] = '\0';
+ text_row = (text_row - 1 + text_rows) % text_rows;
+ text_col = 0;
+ pthread_mutex_unlock(&gUpdateMutex);
+}
void ui_print(const char *fmt, ...)
{
@@ -646,11 +661,14 @@ void ui_print(const char *fmt, ...)
// if we are running 'ui nice' mode, we do not want to force a screen update
// for this line if not necessary.
+ ui_niced = 0;
if (ui_nice) {
struct timeval curtime;
gettimeofday(&curtime, NULL);
- if (delta_milliseconds(lastupdate, curtime) < 1000)
+ if (delta_milliseconds(lastupdate, curtime) < NICE_INTERVAL) {
+ ui_niced = 1;
return;
+ }
lastupdate = curtime;
}
@@ -695,13 +713,6 @@ void ui_printlogtail(int nb_lines) {
ui_log_stdout=1;
}
-void ui_reset_text_col()
-{
- pthread_mutex_lock(&gUpdateMutex);
- text_col = 0;
- pthread_mutex_unlock(&gUpdateMutex);
-}
-
#define MENU_ITEM_HEADER " - "
#define MENU_ITEM_HEADER_LENGTH strlen(MENU_ITEM_HEADER)