summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-04 17:40:14 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-11-04 17:48:16 (EDT)
commit80bded4f242373bb9b3ee39a84aaa3763d7b75f5 (patch)
tree2e87b2e54b855b2df13a0faf6f83f02f39dab199 /src
parent388669c0d7b99fb0398e3631799d507a7711cf78 (diff)
downloadmarquee-80bded4f242373bb9b3ee39a84aaa3763d7b75f5.zip
marquee-80bded4f242373bb9b3ee39a84aaa3763d7b75f5.tar.gz
marquee-80bded4f242373bb9b3ee39a84aaa3763d7b75f5.tar.bz2
about:profiles: Factor out document generation into new function
Diffstat (limited to 'src')
-rw-r--r--src/schemes/about/profiles.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/schemes/about/profiles.c b/src/schemes/about/profiles.c
index a4b6eb2..8587a12 100644
--- a/src/schemes/about/profiles.c
+++ b/src/schemes/about/profiles.c
@@ -70,19 +70,13 @@ generate_div(MqProfiles *profiles, gchar *id)
return div;
}
-void
-mq_about_profiles_response(MqApplication *application,
- GHashTable G_GNUC_UNUSED *query,
- WebKitURISchemeRequest *request)
+static gchar *
+generate_document(MqProfiles *profiles)
{
- MqProfiles *profiles;
- gchar *document;
- gchar **ids;
- gsize length;
- gchar **divs;
- gsize i;
-
- profiles = mq_application_get_profiles(application);
+ gchar **ids;
+ gsize length;
+ gchar **divs;
+ gsize i;
ids = mq_profiles_get_profiles(profiles, &length);
divs = g_new(gchar *, length);
@@ -92,8 +86,18 @@ mq_about_profiles_response(MqApplication *application,
divs[i] = NULL;
g_strfreev(ids);
- document = mq_html_document("Profiles",
+ return mq_html_document("Profiles",
mq_html_form_v("Add Profile", NULL, divs),
NULL);
- mq_about_response(request, document);
+}
+
+void
+mq_about_profiles_response(MqApplication *application,
+ GHashTable G_GNUC_UNUSED *query, WebKitURISchemeRequest *request)
+{
+ MqProfiles *profiles;
+
+ profiles = mq_application_get_profiles(application);
+
+ mq_about_response(request, generate_document(profiles));
}