Optimize the display
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
diff --git a/clocks.c b/clocks.c
index 93dd4b3..59db8a7 100644
--- a/clocks.c
+++ b/clocks.c
@@ -295,7 +295,7 @@
"Name", "Flags", "Rate", "Usecount", "Children") < 0)
return -1;
- ret = display_header_footer(CLOCK, buf);
+ ret = display_column_name(buf);
free(buf);
diff --git a/display.c b/display.c
index 43f3797..be78ce0 100644
--- a/display.c
+++ b/display.c
@@ -293,12 +293,12 @@
case KEY_RIGHT:
case '\t':
- display_next_panel();
+ display_show_header(display_next_panel());
break;
case KEY_LEFT:
case KEY_BTAB:
- display_prev_panel();
+ display_show_header(display_prev_panel());
break;
case KEY_DOWN:
@@ -429,21 +429,15 @@
return display_refresh(wdefault);
}
-int display_header_footer(int win, const char *line)
+int display_column_name(const char *line)
{
- int ret;
-
werase(main_win);
wattron(main_win, A_BOLD);
mvwprintw(main_win, 0, 0, "%s", line);
wattroff(main_win, A_BOLD);
wrefresh(main_win);
- ret = display_show_header(win);
- if (ret)
- return ret;
-
- return display_show_footer(win);
+ return 0;
}
int display_register(int win, struct display_ops *ops)
diff --git a/display.h b/display.h
index 8586f5e..f9a762c 100644
--- a/display.h
+++ b/display.h
@@ -29,5 +29,5 @@
extern int display_init(int wdefault);
extern int display_register(int win, struct display_ops *ops);
-extern int display_header_footer(int win, const char *line);
extern int display_refresh(int win);
+extern int display_column_name(const char *line);
diff --git a/regulator.c b/regulator.c
index c8cbe2d..97ab15b 100644
--- a/regulator.c
+++ b/regulator.c
@@ -148,7 +148,7 @@
"Min u-volts", "Max u-volts") < 0)
return -1;
- ret = display_header_footer(REGULATOR, buf);
+ ret = display_column_name(buf);
free(buf);
diff --git a/sensor.c b/sensor.c
index 399605b..2a8f4bb 100644
--- a/sensor.c
+++ b/sensor.c
@@ -243,7 +243,7 @@
if (asprintf(&buf, "%-36s%s", "Name", "Value") < 0)
return -1;
- ret = display_header_footer(SENSOR, buf);
+ ret = display_column_name(buf);
free(buf);