summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/html.c16
-rw-r--r--src/utils/html.h3
2 files changed, 15 insertions, 4 deletions
diff --git a/src/utils/html.c b/src/utils/html.c
index 47b2d7a..5716c07 100644
--- a/src/utils/html.c
+++ b/src/utils/html.c
@@ -340,7 +340,7 @@ mq_html_list_v(const gchar *type, gchar **children)
}
gchar *
-mq_html_container(const gchar *element, ...)
+mq_html_container(const gchar *element, const gchar *classes, ...)
{
gsize len;
va_list ap;
@@ -351,8 +351,13 @@ mq_html_container(const gchar *element, ...)
/* Calculate length. */
len = strlen("<");
len += strlen(element);
+ if (classes && classes[0]) {
+ len += strlen(" class=\"");
+ len += strlen(classes);
+ len += strlen("\"");
+ }
len += strlen(">\n");
- va_start(ap, element);
+ va_start(ap, classes);
while ((child = va_arg(ap, gchar *))) {
len += strlen(child);
}
@@ -366,8 +371,13 @@ mq_html_container(const gchar *element, ...)
container = g_new(gchar, len);
ptr = g_stpcpy(container, "<");
ptr = g_stpcpy(ptr, element);
+ if (classes && classes[0]) {
+ ptr = g_stpcpy(ptr, " class=\"");
+ ptr = g_stpcpy(ptr, classes);
+ ptr = g_stpcpy(ptr, "\"");
+ }
ptr = g_stpcpy(ptr, ">\n");
- va_start(ap, element);
+ va_start(ap, classes);
while ((child = va_arg(ap, gchar *))) {
ptr = g_stpcpy(ptr, child);
g_free(child);
diff --git a/src/utils/html.h b/src/utils/html.h
index f0b0345..3cff076 100644
--- a/src/utils/html.h
+++ b/src/utils/html.h
@@ -44,7 +44,8 @@ TEXT_ELEMENT(p)
#undef TEXT_ELEMENT
gchar *
-mq_html_container(const gchar *element, ...) G_GNUC_NULL_TERMINATED;
+mq_html_container(const gchar *element, const gchar *classes, ...)
+ G_GNUC_NULL_TERMINATED;
gchar *
mq_html_list(const gchar *type, GDestroyNotify destroy, ...)