From 136ba113ccf963b89b093d11388c5c473efb2799 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 30 Sep 2017 19:47:41 -0400 Subject: mq_html_notebook(): Accept and handle a current_page argument --- diff --git a/src/html.c b/src/html.c index 914a051..bf4f18c 100644 --- a/src/html.c +++ b/src/html.c @@ -68,7 +68,7 @@ mq_html_container(const gchar *element, ...) } gchar * -mq_html_notebook(gboolean vertical, const gchar *name, ...) +mq_html_notebook(gboolean vertical, const gchar *name, guint current_page, ...) { gsize name_len; gsize len; @@ -83,7 +83,7 @@ mq_html_notebook(gboolean vertical, const gchar *name, ...) /* Calculate length. */ name_len = strlen(name); len = strlen("
\n"); - va_start(ap, name); + va_start(ap, current_page); i = 0; while ((child = va_arg(ap, gchar *)) && (tab_label = va_arg(ap, gchar *))) { @@ -93,8 +93,11 @@ mq_html_notebook(gboolean vertical, const gchar *name, ...) len += strlen("_"); len += strlen(i_str); /* len += (gsize) log10(i) + 1; */ - len += strlen("\" type=\"radio\" checked=\"checked\" " - "name=\"_tabs\">\n"); + len += strlen("\" type=\"radio\""); + if (i == current_page) { + len += strlen(" checked=\"checked\""); + } + len += strlen(" name=\"_tabs\">\n"); len += strlen("