diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/about.c | 24 | ||||
-rw-r--r-- | src/about.h | 3 | ||||
-rw-r--r-- | src/about/marquee.c | 11 | ||||
-rw-r--r-- | src/about/paths.h | 5 |
4 files changed, 27 insertions, 16 deletions
diff --git a/src/about.c b/src/about.c index a4b4d39..c0ede12 100644 --- a/src/about.c +++ b/src/about.c @@ -53,12 +53,9 @@ parse_query_string(gchar *str) void mq_about_request(WebKitURISchemeRequest *request, MqApplication *application) { - const gchar *path; - gchar *query_str; - GHashTable *query; - gchar *contents; - gsize stream_length; - GInputStream *stream; + const gchar *path; + gchar *query_str; + GHashTable *query; path = webkit_uri_scheme_request_get_path(request); query_str = strchr(webkit_uri_scheme_request_get_uri(request), '?'); @@ -70,16 +67,23 @@ mq_about_request(WebKitURISchemeRequest *request, MqApplication *application) } if (g_strcmp0(path, "marquee") == 0) { - contents = mq_about_marquee_response(application, query); - stream_length = strlen(contents); - stream = g_memory_input_stream_new_from_data(contents, - stream_length, g_free); + mq_about_marquee_response(application, query, request); } else { return; } g_free(query_str); +} + +void +mq_about_response(WebKitURISchemeRequest *request, gchar *contents) +{ + gsize stream_length; + GInputStream *stream; + stream_length = strlen(contents); + stream = g_memory_input_stream_new_from_data(contents, + stream_length, g_free); webkit_uri_scheme_request_finish(request, stream, stream_length, "text/html"); g_object_unref(stream); diff --git a/src/about.h b/src/about.h index a502cd9..f28d9fe 100644 --- a/src/about.h +++ b/src/about.h @@ -29,4 +29,7 @@ void mq_about_request(WebKitURISchemeRequest *request, MqApplication *application); +void +mq_about_response(WebKitURISchemeRequest *request, gchar *contents); + #endif diff --git a/src/about/marquee.c b/src/about/marquee.c index 70413aa..c076e24 100644 --- a/src/about/marquee.c +++ b/src/about/marquee.c @@ -20,9 +20,11 @@ */ #include <glib.h> +#include <webkit2/webkit2.h> #include "paths.h" #include "../application.h" +#include "../about.h" const gchar *document = "<!doctype html>" @@ -38,8 +40,9 @@ const gchar *document = "</body>" "</html>"; -gchar * -mq_about_marquee_response(MqApplication *application, GHashTable *query) +void +mq_about_marquee_response(MqApplication *application, GHashTable *query, + WebKitURISchemeRequest *request) { if (query && g_hash_table_lookup(query, "toggle")) { if (mq_application_marquee_mode_on(application)) { @@ -49,6 +52,6 @@ mq_about_marquee_response(MqApplication *application, GHashTable *query) } } - return g_strdup_printf(document, - "DANGER", "DO NOT PRESS"); + mq_about_response(request, g_strdup_printf(document, + "DANGER", "DO NOT PRESS")); } diff --git a/src/about/paths.h b/src/about/paths.h index ec365d1..e3c2434 100644 --- a/src/about/paths.h +++ b/src/about/paths.h @@ -26,7 +26,8 @@ #include "../application.h" -gchar * -mq_about_marquee_response(MqApplication *application, GHashTable *query); +void +mq_about_marquee_response(MqApplication *application, GHashTable *query, + WebKitURISchemeRequest *request); #endif |