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 | |
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>.
-rw-r--r-- | src/schemes/about/preferences.c | 8 | ||||
-rw-r--r-- | src/schemes/about/version.c | 4 | ||||
-rw-r--r-- | src/utils/html.c | 16 | ||||
-rw-r--r-- | src/utils/html.h | 3 |
4 files changed, 21 insertions, 10 deletions
diff --git a/src/schemes/about/preferences.c b/src/schemes/about/preferences.c index 6563f48..bcf404f 100644 --- a/src/schemes/about/preferences.c +++ b/src/schemes/about/preferences.c @@ -52,7 +52,7 @@ save_pref(gchar *key, gchar *value, MqConfig *config) static gchar * gen_page_general(MqConfig *config) { - return mq_html_container("div", + return mq_html_container("div", NULL, mq_html_h3("Web Browsing"), GEN_SLCT("tabs.new", "New Tab Page", @@ -99,7 +99,7 @@ gen_page_general(MqConfig *config) static gchar * gen_page_display(MqConfig *config) { - return mq_html_container("div", + return mq_html_container("div", NULL, mq_html_h3("Fonts"), GEN_STR ("font.family.default", "Default Font Family"), @@ -139,7 +139,7 @@ gen_page_display(MqConfig *config) static gchar * gen_page_permissions(MqConfig *config) { - return mq_html_container("div", + return mq_html_container("div", NULL, mq_html_h3("General"), GEN_BOOL("permissions.images.auto-load", "Automatically Load Images"), @@ -192,7 +192,7 @@ gen_page_permissions(MqConfig *config) static gchar * gen_page_sec_and_priv(MqConfig *config) { - return mq_html_container("div", + return mq_html_container("div", NULL, mq_html_h3("History"), GEN_BOOL("privacy.private-browsing.enabled", "Enable Private Prowsing (Disables History, Cache, and " diff --git a/src/schemes/about/version.c b/src/schemes/about/version.c index 8045ade..fee367f 100644 --- a/src/schemes/about/version.c +++ b/src/schemes/about/version.c @@ -44,7 +44,7 @@ mq_about_version_response(MqApplication G_GNUC_UNUSED *application, title = g_strdup_printf("About %s", PACKAGE_NAME); document = mq_html_document(title, mq_html_notebook(FALSE, "notebook1", 0, - mq_html_container("div", + mq_html_container("div", NULL, mq_html_h3(PACKAGE_NAME), mq_html_p_free(g_strconcat(PACKAGE_VERSION, PACKAGE_VERSION_GIT, NULL)), @@ -57,7 +57,7 @@ mq_about_version_response(MqApplication G_GNUC_UNUSED *application, "See the license text for details."), NULL), "About", - mq_html_container("div", + mq_html_container("div", NULL, mq_html_h3("Authors"), mq_html_p("Patrick McDermott " "<pj@pehjota.net>"), 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, ...) |