diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-11-04 12:38:52 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-11-04 12:38:52 (EDT) |
commit | 9c9f466c17e227796c556b651c5ab71068b90db6 (patch) | |
tree | 9ace9063013ba0cfdc233fe02f60f41531a10e75 /src/utils | |
parent | b042bb332812b358d00ba89baaac13b7c2100f16 (diff) | |
download | marquee-9c9f466c17e227796c556b651c5ab71068b90db6.zip marquee-9c9f466c17e227796c556b651c5ab71068b90db6.tar.gz marquee-9c9f466c17e227796c556b651c5ab71068b90db6.tar.bz2 |
mq_html_container(): Add classes parameter
And update calls in <about:(version)> and <about:preferences>.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/html.c | 16 | ||||
-rw-r--r-- | src/utils/html.h | 3 |
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, ...) |