Merge lp:~kalikiana/midori/errorpage into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6249
Merged at revision: 6242
Proposed branch: lp:~kalikiana/midori/errorpage
Merge into: lp:midori
Diff against target: 385 lines (+130/-102)
4 files modified
data/about.css (+69/-40)
data/error.html (+13/-13)
midori/midori-app.c (+3/-0)
midori/midori-view.c (+45/-49)
To merge this branch: bzr merge lp:~kalikiana/midori/errorpage
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+172394@code.launchpad.net

Commit message

Improve error page visuals, show suggestions on network errors

To post a comment you must log in.
Revision history for this message
Paweł Forysiuk (tuxator) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/about.css'
--- data/about.css 2013-03-21 17:09:08 +0000
+++ data/about.css 2013-07-01 19:00:34 +0000
@@ -3,48 +3,53 @@
3 This file is licensed under the terms of the expat license, see the file EXPAT.3 This file is licensed under the terms of the expat license, see the file EXPAT.
4 */4 */
5body {5body {
6 background-color: #eee;6 background-color: #dedede;
7 margin: 0;7 color: #222222;
8 padding: 0;8 font-family: 'Open Sans', 'Droid Sans', Arial, sans-serif;
9}9 font-size: 14px;
1010 font-style: normal;
11#container {11 font-variant: normal;
12 background: #f6fff3;12 font-weight: normal;
13 min-width: 70%;13 margin-top: 100px;
14 max-width: 70%;
15 margin: 2em auto 1em;
16 padding: 1em;
17 border: 0.2em solid #9acb7f;
18 -webkit-border-radius: 1em;
19}
20
21#icon {
22 float: left;
23 padding-left: 1%;
24 padding-top: 1%;
25}14}
2615
27html[dir="rtl"] #icon {16html[dir="rtl"] #icon {
28 float: right;17 float: right;
29 padding-right: 1%;18 padding-right: 1%;
19}
20
21.indent {
22 margin-left: 60px;
30}23}
3124
32#main {25#main {
33 float: right;26 max-width: 50%;
34 width: 75%;27 margin-left: auto;
28 margin-right: auto;
29 min-width: 480px;
30 background-repeat: no-repeat;
31 background-color: #ffffff;
32 border: 1px solid rgba(0, 0, 0, .3);
33 padding: 25px;
34 -webkit-border-radius: 4px;
35 -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
36 background-position-x: 22px;
37 background-position-y: 54px;
38}
39
40#text {
41 margin-left: 80px;
35}42}
3643
37h1 {44h1 {
38 font-size: 1.4em;45 font-family: 'Open Sans', 'Droid Sans', arial, sans-serif;
39 font-weight: bold;46 font-size: 32px;
40 white-space: nowrap;47 font-style: normal;
41 overflow: hidden;48 font-variant: normal;
42 text-overflow: ellipsis;49 font-weight: 300;
43}50 width: 100%;
4451 overflow: hidden;
45#logo {52 text-overflow: ellipsis;
46 position: absolute; bottom: 15px;
47 z-index: -1;
48}53}
4954
50html[dir="ltr"] #logo {55html[dir="ltr"] #logo {
@@ -61,11 +66,35 @@
61 padding: 2px 1px;66 padding: 2px 1px;
62}67}
6368
64#message {69button {
65 font-size: 1.1em;70 font-size: 14px;
66 word-wrap: break-word;71}
67}72
6873.message {
69#description {74 overflow: hidden;
70 font-size: 1em;75 text-overflow: ellipsis;
76}
77
78.description {
79 font-size: 1em;
80 overflow: hidden;
81 text-overflow: ellipsis;
82}
83
84#suggestions {
85 overflow: hidden;
86 text-overflow: ellipsis;
87}
88
89#button {
90 text-align: right;
91}
92
93#logo {
94 position: absolute; bottom: 15px;
95 z-index: -1;
96}
97
98form {
99 margin-bottom: 0px;
71}100}
72101
=== modified file 'data/error.html'
--- data/error.html 2013-02-25 23:51:48 +0000
+++ data/error.html 2013-07-01 19:00:34 +0000
@@ -9,21 +9,21 @@
9<link rel="stylesheet" type="text/css" href="res://about.css" />9<link rel="stylesheet" type="text/css" href="res://about.css" />
10</head>10</head>
11<body>11<body>
12 <div id="container">12<img id="logo" src="res://logo-shade.png" />
13 <img id="logo" src="res://logo-shade.png" />13<div id="main" style="background-image: url({error_icon});">
14 <img id="icon" src="stock://gtk-dialog-error" />14 <div id="text">
15 <div id="main">15 <h1>{title}</h1>
16 <h1>{title}</h1>16 <p class="message">{message}<br><i>{description}</i></p>
17 <p id="message">{message}</p>17 {suggestions}
18 <p id="description">{description}</p>18 </div>
19 <form method="GET" action="{uri}">19 <form method="GET" action="{uri}" id="button">
20 <button type="submit" onclick="location.reload(); return false;">20 <button type="submit" onclick="location.reload(); return false;" autofocus="true" >
21 <img style="{hide-button-images}" src="stock://gtk-refresh"/>
22 <span>{tryagain}</span>21 <span>{tryagain}</span>
23 </button>22 </button>
24 </form>23 </form>
25 </div>24 </div>
26 <br style="clear: both;"/>25
27 </div>26<br style="clear: both;"/>
28 </body>27</div>
28</body>
29</html>29</html>
3030
=== modified file 'midori/midori-app.c'
--- midori/midori-app.c 2013-06-26 21:54:50 +0000
+++ midori/midori-app.c 2013-07-01 19:00:34 +0000
@@ -1320,6 +1320,7 @@
1320 gchar** *argument_vector,1320 gchar** *argument_vector,
1321 const GOptionEntry *entries)1321 const GOptionEntry *entries)
1322{1322{
1323
1323 GtkIconSource* icon_source;1324 GtkIconSource* icon_source;
1324 GtkIconSet* icon_set;1325 GtkIconSet* icon_set;
1325 GtkIconFactory* factory;1326 GtkIconFactory* factory;
@@ -1329,6 +1330,8 @@
13291330
1330 static GtkStockItem items[] =1331 static GtkStockItem items[] =
1331 {1332 {
1333 { "network-error" },
1334 { "network-idle" },
1332 { STOCK_IMAGE },1335 { STOCK_IMAGE },
1333 { MIDORI_STOCK_WEB_BROWSER },1336 { MIDORI_STOCK_WEB_BROWSER },
1334 { STOCK_NEWS_FEED },1337 { STOCK_NEWS_FEED },
13351338
=== modified file 'midori/midori-view.c'
--- midori/midori-view.c 2013-06-25 22:32:12 +0000
+++ midori/midori-view.c 2013-07-01 19:00:34 +0000
@@ -79,9 +79,11 @@
79static gboolean79static gboolean
80midori_view_display_error (MidoriView* view,80midori_view_display_error (MidoriView* view,
81 const gchar* uri,81 const gchar* uri,
82 const gchar* error_icon,
82 const gchar* title,83 const gchar* title,
83 const gchar* message,84 const gchar* message,
84 const gchar* description,85 const gchar* description,
86 const gchar* suggestions,
85 const gchar* try_again,87 const gchar* try_again,
86#ifndef HAVE_WEBKIT288#ifndef HAVE_WEBKIT2
87 WebKitWebFrame* web_frame);89 WebKitWebFrame* web_frame);
@@ -667,7 +669,7 @@
667 gchar* slots = g_strjoinv (" , ", (gchar**)gcr_pkcs11_get_trust_lookup_uris ());669 gchar* slots = g_strjoinv (" , ", (gchar**)gcr_pkcs11_get_trust_lookup_uris ());
668 gchar* title = g_strdup_printf ("Error granting trust: %s", error->message);670 gchar* title = g_strdup_printf ("Error granting trust: %s", error->message);
669 midori_tab_stop_loading (MIDORI_TAB (view));671 midori_tab_stop_loading (MIDORI_TAB (view));
670 midori_view_display_error (view, NULL, NULL, title, slots,672 midori_view_display_error (view, NULL, NULL, NULL, title, slots, NULL,
671 _("Trust this website"), NULL);673 _("Trust this website"), NULL);
672 g_free (title);674 g_free (title);
673 g_free (slots);675 g_free (slots);
@@ -789,8 +791,8 @@
789 {791 {
790 midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_UNKNOWN);792 midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_UNKNOWN);
791 midori_tab_stop_loading (MIDORI_TAB (view));793 midori_tab_stop_loading (MIDORI_TAB (view));
792 midori_view_display_error (view, NULL, NULL, _("Security unknown"),794 midori_view_display_error (view, NULL, NULL, NULL, _("Security unknown"),
793 midori_location_action_tls_flags_to_string (tls_flags),795 midori_location_action_tls_flags_to_string (tls_flags), NULL,
794 _("Trust this website"),796 _("Trust this website"),
795 NULL);797 NULL);
796 }798 }
@@ -887,8 +889,15 @@
887 icon_size_large_dialog = gtk_icon_size_register ("large-dialog", 64, 64);889 icon_size_large_dialog = gtk_icon_size_register ("large-dialog", 64, 64);
888890
889 if (g_ascii_isalpha (icon_name[0]))891 if (g_ascii_isalpha (icon_name[0]))
890 icon_size = strstr (icon_name, "dialog") ?892 {
891 icon_size_large_dialog : GTK_ICON_SIZE_BUTTON;893 if (g_str_has_prefix (icon_name, "dialog/"))
894 {
895 icon_name = &icon_name [strlen("dialog/")];
896 icon_size = icon_size_large_dialog;
897 }
898 else
899 icon_size = GTK_ICON_SIZE_BUTTON;
900 }
892 else if (g_ascii_isdigit (icon_name[0]))901 else if (g_ascii_isdigit (icon_name[0]))
893 {902 {
894 guint i = 0;903 guint i = 0;
@@ -905,35 +914,6 @@
905 }914 }
906 }915 }
907916
908 /* If available, load SVG icon as SVG markup */
909 gtk_icon_size_lookup_for_settings (
910 gtk_widget_get_settings (GTK_WIDGET (view)),
911 icon_size, &real_icon_size, &real_icon_size);
912 icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name,
913 real_icon_size, GTK_ICON_LOOKUP_FORCE_SVG);
914 icon_filename = icon_info ? gtk_icon_info_get_filename (icon_info) : NULL;
915 if (icon_filename && g_str_has_suffix (icon_filename, ".svg"))
916 {
917 gchar* buffer;
918 gsize buffer_size;
919 if (g_file_get_contents (icon_filename, &buffer, &buffer_size, NULL))
920 {
921 #ifdef HAVE_WEBKIT2
922 GInputStream* stream = g_memory_input_stream_new_from_data (buffer, buffer_size, g_free);
923 webkit_uri_scheme_request_finish (request, stream, -1, "image/svg+xml");
924 g_object_unref (stream);
925 #else
926 gchar* encoded = g_base64_encode ((guchar*)buffer, buffer_size);
927 gchar* data_uri = g_strconcat ("data:image/svg+xml;base64,", encoded, NULL);
928 g_free (buffer);
929 g_free (encoded);
930 webkit_network_request_set_uri (request, data_uri);
931 g_free (data_uri);
932 #endif
933 return;
934 }
935 }
936
937 /* Render icon as a PNG at the desired size */917 /* Render icon as a PNG at the desired size */
938 pixbuf = gtk_widget_render_icon (GTK_WIDGET (view), icon_name, icon_size, NULL);918 pixbuf = gtk_widget_render_icon (GTK_WIDGET (view), icon_name, icon_size, NULL);
939 if (!pixbuf)919 if (!pixbuf)
@@ -1171,9 +1151,11 @@
1171static gboolean1151static gboolean
1172midori_view_display_error (MidoriView* view,1152midori_view_display_error (MidoriView* view,
1173 const gchar* uri,1153 const gchar* uri,
1154 const gchar* error_icon,
1174 const gchar* title,1155 const gchar* title,
1175 const gchar* message,1156 const gchar* message,
1176 const gchar* description,1157 const gchar* description,
1158 const gchar* suggestions,
1177 const gchar* try_again,1159 const gchar* try_again,
1178#ifndef HAVE_WEBKIT21160#ifndef HAVE_WEBKIT2
1179 WebKitWebFrame* web_frame)1161 WebKitWebFrame* web_frame)
@@ -1210,8 +1192,10 @@
1210 "rtl" : "ltr",1192 "rtl" : "ltr",
1211 "{title}", title_escaped,1193 "{title}", title_escaped,
1212 "{favicon}", katze_str_non_null (favicon),1194 "{favicon}", katze_str_non_null (favicon),
1195 "{error_icon}", katze_str_non_null (error_icon),
1213 "{message}", message,1196 "{message}", message,
1214 "{description}", description,1197 "{description}", description,
1198 "{suggestions}", katze_str_non_null (suggestions),
1215 "{tryagain}", try_again,1199 "{tryagain}", try_again,
1216 "{uri}", uri,1200 "{uri}", uri,
1217 "{hide-button-images}", show_button_images ? "" : "display:none",1201 "{hide-button-images}", show_button_images ? "" : "display:none",
@@ -1248,6 +1232,7 @@
1248 #endif1232 #endif
1249 gchar* title;1233 gchar* title;
1250 gchar* message;1234 gchar* message;
1235 GString* suggestions;
1251 gboolean result;1236 gboolean result;
12521237
1253 /* The unholy trinity; also ignored in Webkit's default error handler */1238 /* The unholy trinity; also ignored in Webkit's default error handler */
@@ -1262,10 +1247,18 @@
1262 return FALSE;1247 return FALSE;
1263 }1248 }
12641249
1265 title = g_strdup_printf (_("Error - %s"), uri);1250 title = g_strdup_printf (_("'%s' can't be found"), midori_uri_parse_hostname(uri, NULL));
1266 message = g_strdup_printf (_("The page '%s' couldn't be loaded."), uri);1251 message = g_strdup_printf (_("The page '%s' couldn't be loaded:"), midori_uri_parse_hostname(uri, NULL));
1267 result = midori_view_display_error (view, uri, title,1252
1268 message, error->message, _("Try again"), web_frame);1253 suggestions = g_string_new ("<ul id=\"suggestions\"><li>");
1254 g_string_append_printf (suggestions, "%s</li><li>%s</li><li>%s</li></ul>",
1255 _("Check the address for typos"),
1256 _("Make sure that an ethernet cable is plugged in or the wireless card is activated"),
1257 _("Verify that your network settings are correct"));
1258
1259 result = midori_view_display_error (view, uri, "stock://dialog/network-error", title,
1260 message, error->message, g_string_free (suggestions, FALSE),
1261 _("Try Again"), web_frame);
1269 g_free (message);1262 g_free (message);
1270 g_free (title);1263 g_free (title);
1271 return result;1264 return result;
@@ -1397,8 +1390,8 @@
1397 const gchar* uri = webkit_web_view_get_uri (web_view);1390 const gchar* uri = webkit_web_view_get_uri (web_view);
1398 gchar* title = g_strdup_printf (_("Oops - %s"), uri);1391 gchar* title = g_strdup_printf (_("Oops - %s"), uri);
1399 gchar* message = g_strdup_printf (_("Something went wrong with '%s'."), uri);1392 gchar* message = g_strdup_printf (_("Something went wrong with '%s'."), uri);
1400 midori_view_display_error (view, uri, title,1393 midori_view_display_error (view, uri, NULL, title,
1401 message, "", _("Try again"), NULL);1394 message, "", NULL, _("Try again"), NULL);
1402 g_free (message);1395 g_free (message);
1403 g_free (title);1396 g_free (title);
1404}1397}
@@ -4093,15 +4086,16 @@
4093 else if (!strcmp (uri, "about:private"))4086 else if (!strcmp (uri, "about:private"))
4094 {4087 {
4095 data = g_strdup_printf (4088 data = g_strdup_printf (
4096 "<html><head><title>%s</title>"4089 "<html dir=\"ltr\"><head><title>%s</title>"
4097 "<link rel=\"stylesheet\" type=\"text/css\" href=\"res://about.css\">"4090 "<link rel=\"stylesheet\" type=\"text/css\" href=\"res://about.css\">"
4098 "</head><body><div id=\"container\">"4091 "</head>"
4099 "<img id=\"logo\" src=\"res://logo-shade.png\" "4092 "<body>"
4100 "style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">"4093 "<img id=\"logo\" src=\"res://logo-shade.png\" />"
4101 "<img id=\"icon\" src=\"stock://gtk-dialog-info\">"4094 "<div id=\"main\" style=\"background-image: url(stock://dialog/gtk-dialog-info);\">"
4102 "<div id=\"main\"><h1>%s</h1>"4095 "<div id=\"text\">"
4103 "<p>%s</p><ul><li>%s</li><li>%s</li><li>%s</li></ul>"4096 "<h1>%s</h1>"
4104 "<p>%s</p><ul><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>"4097 "<p class=\"message\">%s</p><ul class=\" suggestions\"><li>%s</li><li>%s</li><li>%s</li></ul>"
4098 "<p class=\"message\">%s</p><ul class=\" suggestions\"><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>"
4105 "</div><br style=\"clear: both\"></div></body></html>",4099 "</div><br style=\"clear: both\"></div></body></html>",
4106 _("Private Browsing"), _("Private Browsing"),4100 _("Private Browsing"), _("Private Browsing"),
4107 _("Midori doesn't store any personal data:"),4101 _("Midori doesn't store any personal data:"),
@@ -4204,8 +4198,10 @@
4204 midori_tab_set_uri (MIDORI_TAB (view), uri);4198 midori_tab_set_uri (MIDORI_TAB (view), uri);
4205 midori_tab_set_special (MIDORI_TAB (view), TRUE);4199 midori_tab_set_special (MIDORI_TAB (view), TRUE);
4206 katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_PENDING_UNDELAY);4200 katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_PENDING_UNDELAY);
4207 midori_view_display_error (view, NULL, NULL, _("Page loading delayed"),4201 midori_view_display_error (view, NULL, "stock://dialog/network-idle", NULL,
4202 _("Page loading delayed:"),
4208 _("Loading delayed either due to a recent crash or startup preferences."),4203 _("Loading delayed either due to a recent crash or startup preferences."),
4204 NULL,
4209 _("Load Page"),4205 _("Load Page"),
4210 NULL);4206 NULL);
4211 }4207 }

Subscribers

People subscribed via source and target branches

to all changes: