summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-04 13:05:30 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-11-04 13:09:18 (EDT)
commit95f6d7b2b8f7530acd4da8c1ca30a57974763c6e (patch)
tree7ff80ad6c05f6760593b759e4ae8ff4488ab8b4c
parentc5c1b87571674a74db3697ec24c17fae09dedd7d (diff)
downloadmarquee-95f6d7b2b8f7530acd4da8c1ca30a57974763c6e.zip
marquee-95f6d7b2b8f7530acd4da8c1ca30a57974763c6e.tar.gz
marquee-95f6d7b2b8f7530acd4da8c1ca30a57974763c6e.tar.bz2
mq_html_input_text(): Allow label to be disabled
-rw-r--r--src/utils/html.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/utils/html.c b/src/utils/html.c
index 7c105d0..68af9a6 100644
--- a/src/utils/html.c
+++ b/src/utils/html.c
@@ -624,10 +624,19 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...)
gchar *
mq_html_input_text(const gchar *name, const gchar *label, const gchar *value)
{
- return g_strdup_printf("<label for=\"%s\">\n<span>%s:</span>\n"
- "<input type=\"text\" name=\"%s\" id=\"%s\" value=\"%s\">\n"
- "</label>\n",
- name, label, name, name, value ? value : "");
+ if (label && label[0]) {
+ return g_strdup_printf(
+ "<label for=\"%s\">\n<span>%s:</span>\n"
+ "<input type=\"text\" name=\"%s\" id=\"%s\" "
+ "value=\"%s\">\n"
+ "</label>\n",
+ name, label, name, name, value ? value : "");
+ } else {
+ return g_strdup_printf(
+ "<input type=\"text\" name=\"%s\" id=\"%s\" "
+ "value=\"%s\">\n",
+ name, name, value ? value : "");
+ }
}
gchar *