From 88d1b9daf602506534b3c64a255c9f3556c36b56 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Fri, 27 Oct 2017 23:32:21 -0400 Subject: mq_resource_response(): Return a nicer HTML document on error --- (limited to 'src') diff --git a/src/resources.c b/src/resources.c index 77e1994..02283d6 100644 --- a/src/resources.c +++ b/src/resources.c @@ -26,6 +26,20 @@ #include "application.h" +static const gchar *error_document = + "\n" + "\n" + "\n" + "\n" + "Resource Error</title\n" + "\n" + "" + "

Resource Error

\n" + "

Failed to load resource “%s”

\n" + "

%s

\n" + "\n" + ""; + void mq_resource_response(MqApplication *application, const gchar *path, WebKitURISchemeRequest *request) @@ -44,9 +58,10 @@ mq_resource_response(MqApplication *application, const gchar *path, stream = G_INPUT_STREAM(g_file_read(file, NULL, &error)); if (!stream) { stream = g_memory_input_stream_new_from_data( - g_strdup_printf("Failed to load resource " - "“%s”: %s", path, error->message), - -1, g_free); + g_strdup_printf(error_document, + gtk_widget_get_default_direction() == + GTK_TEXT_DIR_RTL ? "rtl" : "ltr", + path, error->message), -1, g_free); g_error_free(error); } webkit_uri_scheme_request_finish(request, stream, -1, "text/html"); -- cgit v0.9.1