diff mbox series

[v3,03/14] client: update dbus-proxy to use display_table_row

Message ID 20220707175511.224597-3-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [v3,01/14] client: add generic display function for table rows | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood July 7, 2022, 5:55 p.m. UTC
---
 client/dbus-proxy.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index 9f05c0e7..bbb97eb5 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -59,7 +59,7 @@  void proxy_properties_display(const struct proxy_interface *proxy,
 	if (!proxy->type->properties)
 		return;
 
-	display_table_header(caption, "%s%-*s  %-*s%-*s", margin,
+	display_table_header(caption, "%s%-*s  %-*s  %-*s", margin,
 				8, "Settable",
 				name_column_width, "Property",
 				value_column_width, "Value");
@@ -69,29 +69,16 @@  void proxy_properties_display(const struct proxy_interface *proxy,
 
 	for (i = 0; properties[i].name; i++) {
 		const char *str;
-		size_t len;
-		size_t j;
 
 		if (!properties[i].tostr)
 			continue;
 
 		str = properties[i].tostr(data);
-		len = str ? strlen(str) : 0;
 
-		display("%s%*s  %-*s%-.*s\n", margin,
-			8, properties[i].is_read_write ?
+		display_table_row(MARGIN, 3, 8, properties[i].is_read_write ?
 				COLOR_BOLDGRAY "       *" COLOR_OFF : "",
-			name_column_width, properties[i].name,
-			value_column_width, str ? : "");
-
-		if (len <= value_column_width)
-			continue;
-
-		/* Display remaining data */
-		for (j = value_column_width; j < len; j += value_column_width)
-			display("%s%*s  %-*s%-.*s\n", margin, 8, "",
-				name_column_width, "", value_column_width,
-				str + j);
+				name_column_width, properties[i].name,
+				value_column_width, str ? : "");
 	}
 }