From 2c96093cd1622e22c11b50d939cce33d752ce3ee Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 04 Nov 2017 21:20:58 -0400 Subject: mq_html_form*(): Add optional button names --- diff --git a/src/schemes/about/preferences.c b/src/schemes/about/preferences.c index 6e65c3c..59ac9c6 100644 --- a/src/schemes/about/preferences.c +++ b/src/schemes/about/preferences.c @@ -243,7 +243,7 @@ mq_about_preferences_response(MqApplication *application, GHashTable *query, mq_about_redirect(request, "mq-about:preferences"); } else { document = mq_html_document("Preferences", - mq_html_form("Save", "Cancel", + mq_html_form(NULL, "Save", NULL, "Cancel", mq_html_notebook(FALSE, "notebook1", 0, gen_page_general(config), "General", diff --git a/src/schemes/about/profiles.c b/src/schemes/about/profiles.c index 3fc5fd9..c1e3d09 100644 --- a/src/schemes/about/profiles.c +++ b/src/schemes/about/profiles.c @@ -89,7 +89,7 @@ generate_document(MqProfiles *profiles) g_strfreev(ids); return mq_html_document("Profiles", - mq_html_form_v("Add Profile", NULL, divs), + mq_html_form_v("add", "Add Profile", NULL, NULL, divs), NULL); } diff --git a/src/utils/html.c b/src/utils/html.c index 0549457..35e6e65 100644 --- a/src/utils/html.c +++ b/src/utils/html.c @@ -673,7 +673,8 @@ mq_html_notebook(gboolean vertical, const gchar *name, guint current_page, ...) } gchar * -mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) +mq_html_form(const gchar *submit_name, const gchar *submit_label, + const gchar *reset_name, const gchar *reset_label, ...) { gsize len; va_list ap; @@ -690,12 +691,24 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) va_end(ap); len += strlen("
\n"); if (reset_label && reset_label[0]) { - len += strlen("\n"); } if (submit_label && submit_label[0]) { - len += strlen("\n"); } @@ -714,12 +727,24 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) va_end(ap); ptr = g_stpcpy(ptr, "
\n"); if (reset_label && reset_label[0]) { - ptr = g_stpcpy(ptr, "\n"); } if (submit_label && submit_label[0]) { - ptr = g_stpcpy(ptr, "\n"); } @@ -730,8 +755,8 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) } gchar * -mq_html_form_v(const gchar *submit_label, const gchar *reset_label, - gchar **children) +mq_html_form_v(const gchar *submit_name, const gchar *submit_label, + const gchar *reset_name, const gchar *reset_label, gchar **children) { gsize len; gsize i; @@ -745,12 +770,24 @@ mq_html_form_v(const gchar *submit_label, const gchar *reset_label, } len += strlen("
\n"); if (reset_label && reset_label[0]) { - len += strlen("\n"); } if (submit_label && submit_label[0]) { - len += strlen("\n"); } @@ -766,12 +803,24 @@ mq_html_form_v(const gchar *submit_label, const gchar *reset_label, } ptr = g_stpcpy(ptr, "
\n"); if (reset_label && reset_label[0]) { - ptr = g_stpcpy(ptr, "\n"); } if (submit_label && submit_label[0]) { - ptr = g_stpcpy(ptr, "\n"); } diff --git a/src/utils/html.h b/src/utils/html.h index 53d4216..16129be 100644 --- a/src/utils/html.h +++ b/src/utils/html.h @@ -66,12 +66,13 @@ mq_html_notebook(gboolean vertical, const gchar *name, guint current_page, ...) G_GNUC_NULL_TERMINATED; gchar * -mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) +mq_html_form(const gchar *submit_name, const gchar *submit_label, + const gchar *reset_name, const gchar *reset_label, ...) G_GNUC_NULL_TERMINATED; gchar * -mq_html_form_v(const gchar *submit_label, const gchar *reset_label, - gchar **children); +mq_html_form_v(const gchar *submit_name, const gchar *submit_label, + const gchar *reset_name, const gchar *reset_label, gchar **children); gchar * mq_html_input_text(const gchar *name, const gchar *label, const gchar *value); -- cgit v0.9.1