summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-08 11:50:41 (EST)
committer Patrick McDermott <pj@pehjota.net>2017-11-08 11:50:41 (EST)
commitb886c3998f96ac3b41781022f983446c2798f15b (patch)
tree75a5bc38c9f18969bdbf3a626a163c5a1ae5521a /src/utils
parentc7aa5b3cf18522031c7d80bc85779117d5f61adf (diff)
downloadmarquee-b886c3998f96ac3b41781022f983446c2798f15b.zip
marquee-b886c3998f96ac3b41781022f983446c2798f15b.tar.gz
marquee-b886c3998f96ac3b41781022f983446c2798f15b.tar.bz2
mq_html_input_text(): Add autofocus parameter
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/html.c13
-rw-r--r--src/utils/html.h3
2 files changed, 10 insertions, 6 deletions
diff --git a/src/utils/html.c b/src/utils/html.c
index c71d159..7dc067f 100644
--- a/src/utils/html.c
+++ b/src/utils/html.c
@@ -799,20 +799,23 @@ mq_html_form_v(const gchar *submit_name, const gchar *submit_label,
}
gchar *
-mq_html_input_text(const gchar *name, const gchar *label, const gchar *value)
+mq_html_input_text(const gchar *name, const gchar *label, const gchar *value,
+ gboolean autofocus)
{
if (label && label[0]) {
return g_strdup_printf(
"<label for=\"%s\">\n<span>%s:</span>\n"
"<input type=\"text\" name=\"%s\" id=\"%s\" "
- "value=\"%s\">\n"
+ "value=\"%s\"%s>\n"
"</label>\n",
- name, label, name, name, value ? value : "");
+ name, label, name, name, value ? value : "",
+ autofocus ? " autofocus=\"autofocus\"" : "");
} else {
return g_strdup_printf(
"<input type=\"text\" name=\"%s\" id=\"%s\" "
- "value=\"%s\">\n",
- name, name, value ? value : "");
+ "value=\"%s\"%s>\n",
+ name, name, value ? value : "",
+ autofocus ? " autofocus=\"autofocus\"" : "");
}
}
diff --git a/src/utils/html.h b/src/utils/html.h
index 7e8002c..3f515df 100644
--- a/src/utils/html.h
+++ b/src/utils/html.h
@@ -77,7 +77,8 @@ 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);
+mq_html_input_text(const gchar *name, const gchar *label, const gchar *value,
+ gboolean autofocus);
gchar *
mq_html_input_number_i(const gchar *name, const gchar *label,