From c5c1b87571674a74db3697ec24c17fae09dedd7d Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 04 Nov 2017 12:57:21 -0400 Subject: mq_html_form(): Allow buttons to be individually disabled --- diff --git a/src/utils/html.c b/src/utils/html.c index c1075e8..7c105d0 100644 --- a/src/utils/html.c +++ b/src/utils/html.c @@ -581,12 +581,16 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) } va_end(ap); len += strlen("
\n"); - len += strlen("\n"); - len += strlen("\n"); + if (reset_label && reset_label[0]) { + len += strlen("\n"); + } + if (submit_label && submit_label[0]) { + len += strlen("\n"); + } len += strlen("
\n"); len += strlen("\n"); ++len; /* NUL byte */ @@ -601,12 +605,16 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) } va_end(ap); ptr = g_stpcpy(ptr, "
\n"); - ptr = g_stpcpy(ptr, "\n"); - ptr = g_stpcpy(ptr, "\n"); + if (reset_label && reset_label[0]) { + ptr = g_stpcpy(ptr, "\n"); + } + if (submit_label && submit_label[0]) { + ptr = g_stpcpy(ptr, "\n"); + } ptr = g_stpcpy(ptr, "
\n"); ptr = g_stpcpy(ptr, "\n"); /* g_stpcpy() adds the NUL. */ -- cgit v0.9.1