summaryrefslogtreecommitdiffstats
path: root/libsmartcols/samples/title.c
diff options
context:
space:
mode:
authorKarel Zak2016-02-09 11:21:21 +0100
committerKarel Zak2016-02-09 11:21:21 +0100
commite865838d6ddcb0fed74e3819b503c6f7ccad452b (patch)
treeca7c032bcdc799177db7ab5781cb6e95bdf756dc /libsmartcols/samples/title.c
parentlibfdisk: add missing break (diff)
downloadkernel-qcow2-util-linux-e865838d6ddcb0fed74e3819b503c6f7ccad452b.tar.gz
kernel-qcow2-util-linux-e865838d6ddcb0fed74e3819b503c6f7ccad452b.tar.xz
kernel-qcow2-util-linux-e865838d6ddcb0fed74e3819b503c6f7ccad452b.zip
libsmartcols: use libscols_cell for title
References: https://github.com/karelzak/util-linux/issues/270 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/samples/title.c')
-rw-r--r--libsmartcols/samples/title.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libsmartcols/samples/title.c b/libsmartcols/samples/title.c
index 14d0326ac..ec72093cc 100644
--- a/libsmartcols/samples/title.c
+++ b/libsmartcols/samples/title.c
@@ -56,6 +56,7 @@ int main(int argc, char *argv[])
{
struct libscols_table *tb;
struct libscols_symbols *sy;
+ struct libscols_cell *title;
setlocale(LC_ALL, ""); /* just to have enable UTF8 chars */
@@ -70,8 +71,12 @@ int main(int argc, char *argv[])
add_line(tb, "foo", "bla bla bla");
add_line(tb, "bar", "alb alb alb");
+ title = scols_table_get_title(tb);
+
/* right */
- scols_table_set_title(tb, "This is right title", SCOLS_TITLE_RIGHT, "red");
+ scols_cell_set_data(title, "This is right title");
+ scols_cell_set_color(title, "red");
+ scols_cell_set_flags(title, SCOLS_CELL_FL_RIGHT);
scols_print_table(tb);
/* center */
@@ -81,12 +86,16 @@ int main(int argc, char *argv[])
scols_table_set_symbols(tb, sy);
scols_symbols_set_title_padding(sy, "=");
- scols_table_set_title(tb, "This is center title (with padding)", SCOLS_TITLE_CENTER, "green");
+ scols_cell_set_data(title, "This is center title (with padding)");
+ scols_cell_set_color(title, "green");
+ scols_cell_set_flags(title, SCOLS_CELL_FL_CENTER);
scols_print_table(tb);
/* left */
scols_symbols_set_title_padding(sy, "-");
- scols_table_set_title(tb, "This is left title (with padding)", SCOLS_TITLE_LEFT, "blue");
+ scols_cell_set_data(title, "This is left title (with padding)");
+ scols_cell_set_color(title, "blue");
+ scols_cell_set_flags(title, SCOLS_CELL_FL_LEFT);
scols_print_table(tb);
scols_unref_table(tb);