From 824472202a6480b62d65eb2b97142e5646455459 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 26 Oct 2017 21:52:16 -0400 Subject: Revert layout of preferences form in table This reverts commits 5e4efa9, 8f26235, 87d058f, fc1eaf8, 1e94c07, and b58eedd. --- diff --git a/src/about/preferences.c b/src/about/preferences.c index 3a16895..64633a7 100644 --- a/src/about/preferences.c +++ b/src/about/preferences.c @@ -52,8 +52,8 @@ save_pref(gchar *key, gchar *value, MqConfig *config) static gchar * gen_page_general(MqConfig *config) { - return mq_html_fieldset( - mq_html_th(NULL, "Web Browsing"), + return mq_html_container("div", + mq_html_h3(NULL, "Web Browsing"), GEN_SLCT("tabs.new", "New Tab Page", "home", "Home Page", @@ -65,7 +65,7 @@ gen_page_general(MqConfig *config) GEN_BOOL("tabs.warn-on-close", "Warn When Closing Multiple Tabs or Windows"), - mq_html_th(NULL, "Navigation and Accessibility"), + mq_html_h3(NULL, "Navigation and Accessibility"), GEN_BOOL("navigation.smooth-scrolling", "Enable Smooth Scrolling"), GEN_BOOL("navigation.tabbing", @@ -76,19 +76,19 @@ gen_page_general(MqConfig *config) "Enable Spatial Navigation Between Elements By Arrow " "Keys"), - mq_html_th(NULL, "Spell Checking"), + mq_html_h3(NULL, "Spell Checking"), GEN_BOOL("spell.enable", "Enable Spell Checking"), GEN_STRL("spell.langs", "Spell Checking Languages"), - mq_html_th(NULL, "Miscellaneous"), + mq_html_h3(NULL, "Miscellaneous"), GEN_BOOL("display.textarea.resize.enable", "Enable Resizable Text Areas"), GEN_BOOL("devtools.enable", "Enable Developer Tools"), - mq_html_th(NULL, "Compatibility"), + mq_html_h3(NULL, "Compatibility"), GEN_STR ("compatibility.user-agent", "User Agent Identity"), GEN_BOOL("compatibility.quirks", @@ -99,8 +99,8 @@ gen_page_general(MqConfig *config) static gchar * gen_page_display(MqConfig *config) { - return mq_html_fieldset( - mq_html_th(NULL, "Fonts"), + return mq_html_container("div", + mq_html_h3(NULL, "Fonts"), GEN_STR ("font.family.default", "Default Font Family"), GEN_STR ("font.family.monospace", @@ -122,13 +122,13 @@ gen_page_display(MqConfig *config) GEN_INT ("font.size.minimum", "Minimum Font Size", 0, 1, 72), - mq_html_th(NULL, "Languages"), + mq_html_h3(NULL, "Languages"), GEN_STRL("intl.accept-languages", "Preferred Web Site Languages"), GEN_STR ("intl.default-charset", "Default Character Set"), - mq_html_th(NULL, "Zoom"), + mq_html_h3(NULL, "Zoom"), GEN_DBL ("zoom.default", "Default Zoom Level", 0.00, 0.10, 10.00), GEN_BOOL("zoom.text-only", @@ -139,8 +139,8 @@ gen_page_display(MqConfig *config) static gchar * gen_page_permissions(MqConfig *config) { - return mq_html_fieldset( - mq_html_th(NULL, "General"), + return mq_html_container("div", + mq_html_h3(NULL, "General"), GEN_BOOL("permissions.images.auto-load", "Automatically Load Images"), GEN_BOOL("permissions.images.favicons.override", @@ -153,7 +153,7 @@ gen_page_permissions(MqConfig *config) GEN_BOOL("permissions.plugins.enable", "Enable Plugins"), - mq_html_th(NULL, "JavaScript"), + mq_html_h3(NULL, "JavaScript"), GEN_BOOL("permissions.javascript.open-windows", "Enable JavaScript to Open Windows"), GEN_BOOL("permissions.javascript.fullscreen", @@ -163,7 +163,7 @@ gen_page_permissions(MqConfig *config) GEN_BOOL("permissions.javascript.clipboard", "Enable JavaScript to Access the Clipboard"), - mq_html_th(NULL, "Data Storage"), + mq_html_h3(NULL, "Data Storage"), GEN_BOOL("permissions.javascript.database", "Enable Web Database"), GEN_BOOL("permissions.javascript.storage", @@ -171,7 +171,7 @@ gen_page_permissions(MqConfig *config) GEN_BOOL("permissions.appcache", "Enable Application Cache"), - mq_html_th(NULL, "Graphics and Multimedia"), + mq_html_h3(NULL, "Graphics and Multimedia"), GEN_BOOL("canvas.acceleration.enable", "Enable Hardware-Accelerated 2-D Canvas Drawing"), GEN_BOOL("permissions.javascript.webgl", @@ -192,8 +192,8 @@ gen_page_permissions(MqConfig *config) static gchar * gen_page_sec_and_priv(MqConfig *config) { - return mq_html_fieldset( - mq_html_th(NULL, "History"), + return mq_html_container("div", + mq_html_h3(NULL, "History"), GEN_BOOL("privacy.private-browsing.enabled", "Enable Private Prowsing (Disables History, Cache, and " "Form Auto-Filling)"), @@ -202,19 +202,19 @@ gen_page_sec_and_priv(MqConfig *config) GEN_BOOL("privacy.remember.downloads", "Remember Download History"), - mq_html_th(NULL, "Cookies"), + mq_html_h3(NULL, "Cookies"), GEN_SLCT("cookies.accept", "Accept Cookies", "always", "Always", "never", "Never", "no-third-party", "No Third-Party"), - mq_html_th(NULL, "Security"), + mq_html_h3(NULL, "Security"), GEN_BOOL("security.xss-auditor.enable", "Attempt to Detect and Block Cross-Site Scripting " "Attacks"), - mq_html_th(NULL, "Network"), + mq_html_h3(NULL, "Network"), GEN_BOOL("dns.prefetch.enable", "Prefetch Domain Name Resolutions for Better " "Performance"), diff --git a/src/html.c b/src/html.c index d4a08ab..9417db9 100644 --- a/src/html.c +++ b/src/html.c @@ -143,13 +143,6 @@ static const gchar *styles = "form {\n" "margin: 0;\n" "}" - "table {\n" - "border-collapse: collapse;\n" - "}\n" - "table th {\n" - "padding: 6px 0;\n" - "text-align: left;\n" - "}\n" "form input, form select {\n" "border: 1px solid #9F9F9F;\n" "border-radius: 3px;\n" @@ -165,14 +158,6 @@ static const gchar *styles = "margin: 0;\n" "float: right;\n" "}\n" - "form table label {\n" - "margin: 6px 0;\n" - "padding: 0 6px 0 0;\n" - "text-align: right;\n" - "}\n" - "form table input, form table select {\n" - "margin: 6px 0;\n" - "}\n" "form label {\n" "display: block;\n" "}\n" @@ -551,69 +536,11 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) } gchar * -mq_html_fieldset(gchar *first_child, ...) -{ - gsize len; - va_list ap; - gchar *child; - gchar *fieldset; - gchar *ptr; - - /* Calculate length. */ - len = strlen("
\n"); - len += strlen("\n"); - len += strlen(first_child); - va_start(ap, first_child); - while ((child = va_arg(ap, gchar *))) { - len += strlen(child); - } - va_end(ap); - len += strlen("
\n"); - len += strlen("
\n"); - ++len; /* NUL byte */ - - /* Build string. */ - fieldset = g_new(gchar, len); - ptr = g_stpcpy(fieldset, "
\n"); - ptr = g_stpcpy(ptr, "\n"); - ptr = g_stpcpy(ptr, first_child); - g_free(first_child); - va_start(ap, first_child); - while ((child = va_arg(ap, gchar *))) { - ptr = g_stpcpy(ptr, child); - g_free(child); - } - va_end(ap); - ptr = g_stpcpy(ptr, "
\n"); - ptr = g_stpcpy(ptr, "
\n"); /* g_stpcpy() adds the NUL. */ - - return fieldset; -} - -gchar * -mq_html_th(GDestroyNotify destroy, gchar *text) -{ - gchar *e; - e = g_strconcat("\n", text, "\n\n", - NULL); - if (destroy) { - destroy(text); - } - return e; -} - -gchar * mq_html_input_text(const gchar *name, const gchar *label, const gchar *value) { - return g_strdup_printf( - "\n" - "\n" - "\n" - "\n" - "\n" + return g_strdup_printf("\n", name, label, name, name, value ? value : ""); } @@ -621,16 +548,10 @@ gchar * mq_html_input_number_i(const gchar *name, const gchar *label, gint min, gint step, gint max, gint value) { - return g_strdup_printf( - "\n" - "\n" - "\n" - "\n" - "\n" + return g_strdup_printf("\n", name, label, name, name, min, step, max, value); } @@ -638,31 +559,18 @@ gchar * mq_html_input_number_d(const gchar *name, const gchar *label, gdouble min, gdouble step, gdouble max, gdouble value) { - return g_strdup_printf( - "\n" - "\n" - "\n" - "\n" - "\n" + return g_strdup_printf("\n", name, label, name, name, min, step, max, value); } gchar * mq_html_input_radio(const gchar *name, const gchar *label, gboolean checked) { - return g_strdup_printf( - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n", + return g_strdup_printf("\n", name, label, name, name, checked ? " checked=\"checked\"" : ""); } @@ -690,16 +598,9 @@ mq_html_input_checkbox(const gchar *name, const gchar *label, gboolean checked) * when the former is checked. */ - return g_strdup_printf( - "\n" - "\n" - "\n" - "\n" - "\n" + return g_strdup_printf("\n", name, label, name, name, name, checked ? " checked=\"checked\"" : ""); } @@ -719,16 +620,11 @@ mq_html_input_select(const gchar *name, const gchar *label, g_assert(selected && selected[0]); /* Would cause buffer overflow */ /* Calculate length. */ - len = strlen("\n"); - len += strlen("\n"); - len += strlen("\n"); - len += strlen("\n"); - len += strlen("\n"); - len += strlen("\n"); - len += strlen("\n"); - len += strlen("\n"); + len += strlen("\n\n"); ++len; /* NUL byte */ /* Build string. */ select = g_new(gchar, len); - ptr = g_stpcpy(select, "\n"); - ptr = g_stpcpy(ptr, "\n"); - ptr = g_stpcpy(ptr, "\n"); - ptr = g_stpcpy(ptr, "\n"); - ptr = g_stpcpy(ptr, "\n"); - ptr = g_stpcpy(ptr, "\n"); } va_end(ap); - ptr = g_stpcpy(ptr, "\n"); - ptr = g_stpcpy(ptr, "\n"); - ptr = g_stpcpy(ptr, "\n"); /* g_stpcpy() adds NUL */ + ptr = g_stpcpy(ptr, "\n\n"); /* g_stpcpy() adds NUL */ return select; } diff --git a/src/html.h b/src/html.h index f35b49b..8f5eada 100644 --- a/src/html.h +++ b/src/html.h @@ -58,12 +58,6 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) G_GNUC_NULL_TERMINATED; gchar * -mq_html_fieldset(gchar *first_child, ...); - -gchar * -mq_html_th(GDestroyNotify destroy, gchar *text); - -gchar * mq_html_input_text(const gchar *name, const gchar *label, const gchar *value); gchar * -- cgit v0.9.1