public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v3 08/13] client: separate property header and values into two functions
Date: Mon, 12 Aug 2024 08:46:08 -0700	[thread overview]
Message-ID: <20240812154613.126522-8-prestwoj@gmail.com> (raw)
In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com>

There are certain cases where we may not want to display the entire
header for a given set of properties. For example displaying a list
of proxy interfaces. Add finer control by separating out the header
and the prop/value display into two functions.
---
 client/dbus-proxy.c | 38 +++++++++++++++++++++++++++++---------
 client/dbus-proxy.h |  7 +++++++
 2 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index 42b8427f..1e50d902 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -47,10 +47,10 @@ static struct l_dbus *dbus;
 static struct l_queue *proxy_interfaces;
 static struct l_queue *proxy_interface_types;
 
-void proxy_properties_display(const struct proxy_interface *proxy,
-				const char *caption, const char *margin,
-				unsigned int name_column_width,
-				unsigned int value_column_width)
+void proxy_properties_display_inline(const struct proxy_interface *proxy,
+					const char *margin,
+					unsigned int name_column_width,
+					unsigned int value_column_width)
 {
 	const void *data;
 	const struct proxy_interface_property *properties;
@@ -59,11 +59,6 @@ void proxy_properties_display(const struct proxy_interface *proxy,
 	if (!proxy->type->properties)
 		return;
 
-	display_table_header(caption, "%s%-*s  %-*s  %-*s", margin,
-				8, "Settable",
-				name_column_width, "Property",
-				value_column_width, "Value");
-
 	data = proxy_interface_get_data(proxy);
 	properties = proxy->type->properties;
 
@@ -82,6 +77,31 @@ void proxy_properties_display(const struct proxy_interface *proxy,
 	}
 }
 
+void proxy_properties_display_header(const char *caption, const char *margin,
+					unsigned int name_column_width,
+					unsigned int value_column_width)
+{
+	display_table_header(caption, "%s%-*s  %-*s  %-*s", margin,
+				8, "Settable",
+				name_column_width, "Property",
+				value_column_width, "Value");
+}
+
+void proxy_properties_display(const struct proxy_interface *proxy,
+				const char *caption, const char *margin,
+				unsigned int name_column_width,
+				unsigned int value_column_width)
+{
+	if (!proxy->type->properties)
+		return;
+
+	proxy_properties_display_header(caption, margin, name_column_width,
+					value_column_width);
+
+	proxy_properties_display_inline(proxy, margin, name_column_width,
+					value_column_width);
+}
+
 static const void *proxy_interface_property_tostr(
 					const struct proxy_interface *proxy,
 					const char *name)
diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h
index 98b0a2a4..f0a5d38a 100644
--- a/client/dbus-proxy.h
+++ b/client/dbus-proxy.h
@@ -95,6 +95,13 @@ void proxy_properties_display(const struct proxy_interface *proxy,
 				const char *caption, const char *margin,
 				unsigned int name_column_width,
 				unsigned int value_column_width);
+void proxy_properties_display_inline(const struct proxy_interface *proxy,
+					const char *margin,
+					unsigned int name_column_width,
+					unsigned int value_column_width);
+void proxy_properties_display_header(const char *caption, const char *margin,
+					unsigned int name_column_width,
+					unsigned int value_column_width);
 
 char *proxy_property_str_completion(const struct proxy_interface_type *type,
 					proxy_property_match_func_t function,
-- 
2.34.1


  parent reply	other threads:[~2024-08-12 15:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 15:46 [PATCH v3 01/13] dbus: Add net.connman.iwd.BasicServiceSet interface James Prestwood
2024-08-12 15:46 ` [PATCH v3 02/13] network: Add BasicServiceSet object James Prestwood
2024-08-12 15:46 ` [PATCH v3 03/13] station: use network_bss_{start,stop}_update James Prestwood
2024-08-12 15:46 ` [PATCH v3 04/13] network: add ExtendedServiceSet DBus property James Prestwood
2024-08-12 15:46 ` [PATCH v3 05/13] network: remove network_bss_list_clear James Prestwood
2024-08-12 15:46 ` [PATCH v3 06/13] station: add ConnectedAccessPoint property James Prestwood
2024-08-12 15:46 ` [PATCH v3 07/13] doc: document BasicServiceSet API James Prestwood
2024-08-12 15:46 ` James Prestwood [this message]
2024-08-12 15:46 ` [PATCH v3 09/13] client: add net.connman.iwd.BasicServiceSet definition James Prestwood
2024-08-12 15:46 ` [PATCH v3 10/13] client: Add BasicServiceSets property to network James Prestwood
2024-08-12 15:46 ` [PATCH v3 11/13] client: add BasicServiceSet interface James Prestwood
2024-08-12 15:46 ` [PATCH v3 12/13] client: refactor cmd_connect() and add find_network() James Prestwood
2024-08-12 15:46 ` [PATCH v3 13/13] client: add station command "get-bsses" James Prestwood
2024-08-12 17:11 ` [PATCH v3 01/13] dbus: Add net.connman.iwd.BasicServiceSet interface Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240812154613.126522-8-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox