diff options
-rw-r--r-- | src/resources.c | 21 |
1 files changed, 18 insertions, 3 deletions
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 = + "<!doctype html>\n" + "<html dir=\"%s\">\n" + "<head>\n" + "<meta charset=\"utf-8\">\n" + "<title>Resource Error</title</title>\n" + "</head>\n" + "<body>" + "<h1>Resource Error</h1>\n" + "<p>Failed to load resource “%s”</p>\n" + "<p>%s</p>\n" + "</body>\n" + "</html>"; + 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"); |