diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-11-05 14:39:32 (EST) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-11-05 14:39:32 (EST) |
commit | c7bf27ff65f5eb163785ee3f481993995a44b07d (patch) | |
tree | 5379147899d5cc339705b8f7520b7219b41d486c | |
parent | d162678bac0161195bc86ccb03792248a7d1eba6 (diff) | |
download | marquee-c7bf27ff65f5eb163785ee3f481993995a44b07d.zip marquee-c7bf27ff65f5eb163785ee3f481993995a44b07d.tar.gz marquee-c7bf27ff65f5eb163785ee3f481993995a44b07d.tar.bz2 |
mq_html_document*(): Add styles parameter
-rw-r--r-- | src/utils/html.c | 12 | ||||
-rw-r--r-- | src/utils/html.h | 5 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/utils/html.c b/src/utils/html.c index 5dc4c7b..0f49ef1 100644 --- a/src/utils/html.c +++ b/src/utils/html.c @@ -27,7 +27,7 @@ #include <glib.h> #include <gtk/gtk.h> -static const gchar *styles = +static const gchar *global_styles = /* * General styles */ @@ -274,7 +274,7 @@ static const gchar *styles = ; gchar * -mq_html_document(const gchar *title, ...) +mq_html_document(const gchar *title, const gchar *styles, ...) { gsize len; va_list ap; @@ -288,9 +288,10 @@ mq_html_document(const gchar *title, ...) len += strlen("\">\n<head>\n<meta charset=\"utf-8\">\n<title>"); len += strlen(title); len += strlen("</title>\n<style>\n"); + len += strlen(global_styles); len += strlen(styles); len += strlen("</style>\n</head>\n<body>\n"); - va_start(ap, title); + va_start(ap, styles); while ((child = va_arg(ap, gchar *))) { len += strlen(child); } @@ -306,9 +307,10 @@ mq_html_document(const gchar *title, ...) ptr = g_stpcpy(ptr, "\">\n<head>\n<meta charset=\"utf-8\">\n<title>"); ptr = g_stpcpy(ptr, title); ptr = g_stpcpy(ptr, "</title>\n<style>\n"); + ptr = g_stpcpy(ptr, global_styles); ptr = g_stpcpy(ptr, styles); ptr = g_stpcpy(ptr, "</style>\n</head>\n<body>\n"); - va_start(ap, title); + va_start(ap, styles); while ((child = va_arg(ap, gchar *))) { ptr = g_stpcpy(ptr, child); g_free(child); @@ -320,7 +322,7 @@ mq_html_document(const gchar *title, ...) } gchar * -mq_html_document_v(const gchar *title, gchar **children) +mq_html_document_v(const gchar *title, const gchar *styles, gchar **children) { gsize len; gsize i; diff --git a/src/utils/html.h b/src/utils/html.h index 16129be..ffdddc2 100644 --- a/src/utils/html.h +++ b/src/utils/html.h @@ -27,10 +27,11 @@ G_BEGIN_DECLS gchar * -mq_html_document(const gchar *title, ...) G_GNUC_NULL_TERMINATED; +mq_html_document(const gchar *title, const gchar *styles, ...) + G_GNUC_NULL_TERMINATED; gchar * -mq_html_document_v(const gchar *title, gchar **children); +mq_html_document_v(const gchar *title, const gchar *styles, gchar **children); #define TEXT_ELEMENT(ELEM) \ gchar * \ |