summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-04 13:33:22 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-11-04 13:33:22 (EDT)
commit7b46a6c58eb50c8952dc50d69279596c7bce7bd4 (patch)
tree641424fa874fc9b6cf5923327dccdc0ae0281560 /src/utils
parent5eb7fd6635d47317ecce261940bb6e951abdc5c8 (diff)
downloadmarquee-7b46a6c58eb50c8952dc50d69279596c7bce7bd4.zip
marquee-7b46a6c58eb50c8952dc50d69279596c7bce7bd4.tar.gz
marquee-7b46a6c58eb50c8952dc50d69279596c7bce7bd4.tar.bz2
mq_html_input_checkbox(): Allow label to be disabled
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/html.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/utils/html.c b/src/utils/html.c
index ac4ae9f..20a1c96 100644
--- a/src/utils/html.c
+++ b/src/utils/html.c
@@ -725,11 +725,25 @@ mq_html_input_checkbox(const gchar *name, const gchar *label, gboolean checked)
* <input> when the former <input> is checked.
*/
- return g_strdup_printf("<label for=\"%s\">\n<span>%s:</span>\n"
- "<input type=\"hidden\" name=\"%s\" value=\"off\">\n"
- "<input type=\"checkbox\" name=\"%s\" id=\"%s\"%s>\n</label>\n",
- name, label, name, name, name,
- checked ? " checked=\"checked\"" : "");
+ if (label && label[0]) {
+ return g_strdup_printf(
+ "<label for=\"%s\">\n<span>%s:</span>\n"
+ "<input type=\"hidden\" name=\"%s\" "
+ "value=\"off\">\n"
+ "<input type=\"checkbox\" name=\"%s\" "
+ "id=\"%s\"%s>\n"
+ "</label>\n",
+ name, label, name, name, name,
+ checked ? " checked=\"checked\"" : "");
+ } else {
+ return g_strdup_printf(
+ "<input type=\"hidden\" name=\"%s\" "
+ "value=\"off\">\n"
+ "<input type=\"checkbox\" name=\"%s\" "
+ "id=\"%s\"%s>\n",
+ name, name, name,
+ checked ? " checked=\"checked\"" : "");
+ }
}
gchar *