Merge lp:~kalikiana/midori/errorpage into lp:midori
- errorpage
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paweł Forysiuk | Approve | ||
Review via email:
|
Commit message
Improve error page visuals, show suggestions on network errors
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Paweł Forysiuk (tuxator) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/about.css' |
2 | --- data/about.css 2013-03-21 17:09:08 +0000 |
3 | +++ data/about.css 2013-07-01 19:00:34 +0000 |
4 | @@ -3,48 +3,53 @@ |
5 | This file is licensed under the terms of the expat license, see the file EXPAT. |
6 | */ |
7 | body { |
8 | - background-color: #eee; |
9 | - margin: 0; |
10 | - padding: 0; |
11 | -} |
12 | - |
13 | -#container { |
14 | - background: #f6fff3; |
15 | - min-width: 70%; |
16 | - max-width: 70%; |
17 | - margin: 2em auto 1em; |
18 | - padding: 1em; |
19 | - border: 0.2em solid #9acb7f; |
20 | - -webkit-border-radius: 1em; |
21 | -} |
22 | - |
23 | -#icon { |
24 | - float: left; |
25 | - padding-left: 1%; |
26 | - padding-top: 1%; |
27 | + background-color: #dedede; |
28 | + color: #222222; |
29 | + font-family: 'Open Sans', 'Droid Sans', Arial, sans-serif; |
30 | + font-size: 14px; |
31 | + font-style: normal; |
32 | + font-variant: normal; |
33 | + font-weight: normal; |
34 | + margin-top: 100px; |
35 | } |
36 | |
37 | html[dir="rtl"] #icon { |
38 | - float: right; |
39 | - padding-right: 1%; |
40 | + float: right; |
41 | + padding-right: 1%; |
42 | +} |
43 | + |
44 | +.indent { |
45 | + margin-left: 60px; |
46 | } |
47 | |
48 | #main { |
49 | - float: right; |
50 | - width: 75%; |
51 | + max-width: 50%; |
52 | + margin-left: auto; |
53 | + margin-right: auto; |
54 | + min-width: 480px; |
55 | + background-repeat: no-repeat; |
56 | + background-color: #ffffff; |
57 | + border: 1px solid rgba(0, 0, 0, .3); |
58 | + padding: 25px; |
59 | + -webkit-border-radius: 4px; |
60 | + -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1); |
61 | + background-position-x: 22px; |
62 | + background-position-y: 54px; |
63 | +} |
64 | + |
65 | +#text { |
66 | + margin-left: 80px; |
67 | } |
68 | |
69 | h1 { |
70 | - font-size: 1.4em; |
71 | - font-weight: bold; |
72 | - white-space: nowrap; |
73 | - overflow: hidden; |
74 | - text-overflow: ellipsis; |
75 | -} |
76 | - |
77 | -#logo { |
78 | - position: absolute; bottom: 15px; |
79 | - z-index: -1; |
80 | + font-family: 'Open Sans', 'Droid Sans', arial, sans-serif; |
81 | + font-size: 32px; |
82 | + font-style: normal; |
83 | + font-variant: normal; |
84 | + font-weight: 300; |
85 | + width: 100%; |
86 | + overflow: hidden; |
87 | + text-overflow: ellipsis; |
88 | } |
89 | |
90 | html[dir="ltr"] #logo { |
91 | @@ -61,11 +66,35 @@ |
92 | padding: 2px 1px; |
93 | } |
94 | |
95 | -#message { |
96 | - font-size: 1.1em; |
97 | - word-wrap: break-word; |
98 | -} |
99 | - |
100 | -#description { |
101 | - font-size: 1em; |
102 | +button { |
103 | + font-size: 14px; |
104 | +} |
105 | + |
106 | +.message { |
107 | + overflow: hidden; |
108 | + text-overflow: ellipsis; |
109 | +} |
110 | + |
111 | +.description { |
112 | + font-size: 1em; |
113 | + overflow: hidden; |
114 | + text-overflow: ellipsis; |
115 | +} |
116 | + |
117 | +#suggestions { |
118 | + overflow: hidden; |
119 | + text-overflow: ellipsis; |
120 | +} |
121 | + |
122 | +#button { |
123 | + text-align: right; |
124 | +} |
125 | + |
126 | +#logo { |
127 | + position: absolute; bottom: 15px; |
128 | + z-index: -1; |
129 | +} |
130 | + |
131 | +form { |
132 | + margin-bottom: 0px; |
133 | } |
134 | |
135 | === modified file 'data/error.html' |
136 | --- data/error.html 2013-02-25 23:51:48 +0000 |
137 | +++ data/error.html 2013-07-01 19:00:34 +0000 |
138 | @@ -9,21 +9,21 @@ |
139 | <link rel="stylesheet" type="text/css" href="res://about.css" /> |
140 | </head> |
141 | <body> |
142 | - <div id="container"> |
143 | - <img id="logo" src="res://logo-shade.png" /> |
144 | - <img id="icon" src="stock://gtk-dialog-error" /> |
145 | - <div id="main"> |
146 | - <h1>{title}</h1> |
147 | - <p id="message">{message}</p> |
148 | - <p id="description">{description}</p> |
149 | - <form method="GET" action="{uri}"> |
150 | - <button type="submit" onclick="location.reload(); return false;"> |
151 | - <img style="{hide-button-images}" src="stock://gtk-refresh"/> |
152 | +<img id="logo" src="res://logo-shade.png" /> |
153 | +<div id="main" style="background-image: url({error_icon});"> |
154 | + <div id="text"> |
155 | + <h1>{title}</h1> |
156 | + <p class="message">{message}<br><i>{description}</i></p> |
157 | + {suggestions} |
158 | + </div> |
159 | + <form method="GET" action="{uri}" id="button"> |
160 | + <button type="submit" onclick="location.reload(); return false;" autofocus="true" > |
161 | <span>{tryagain}</span> |
162 | </button> |
163 | </form> |
164 | </div> |
165 | - <br style="clear: both;"/> |
166 | - </div> |
167 | - </body> |
168 | + |
169 | +<br style="clear: both;"/> |
170 | +</div> |
171 | +</body> |
172 | </html> |
173 | |
174 | === modified file 'midori/midori-app.c' |
175 | --- midori/midori-app.c 2013-06-26 21:54:50 +0000 |
176 | +++ midori/midori-app.c 2013-07-01 19:00:34 +0000 |
177 | @@ -1320,6 +1320,7 @@ |
178 | gchar** *argument_vector, |
179 | const GOptionEntry *entries) |
180 | { |
181 | + |
182 | GtkIconSource* icon_source; |
183 | GtkIconSet* icon_set; |
184 | GtkIconFactory* factory; |
185 | @@ -1329,6 +1330,8 @@ |
186 | |
187 | static GtkStockItem items[] = |
188 | { |
189 | + { "network-error" }, |
190 | + { "network-idle" }, |
191 | { STOCK_IMAGE }, |
192 | { MIDORI_STOCK_WEB_BROWSER }, |
193 | { STOCK_NEWS_FEED }, |
194 | |
195 | === modified file 'midori/midori-view.c' |
196 | --- midori/midori-view.c 2013-06-25 22:32:12 +0000 |
197 | +++ midori/midori-view.c 2013-07-01 19:00:34 +0000 |
198 | @@ -79,9 +79,11 @@ |
199 | static gboolean |
200 | midori_view_display_error (MidoriView* view, |
201 | const gchar* uri, |
202 | + const gchar* error_icon, |
203 | const gchar* title, |
204 | const gchar* message, |
205 | const gchar* description, |
206 | + const gchar* suggestions, |
207 | const gchar* try_again, |
208 | #ifndef HAVE_WEBKIT2 |
209 | WebKitWebFrame* web_frame); |
210 | @@ -667,7 +669,7 @@ |
211 | gchar* slots = g_strjoinv (" , ", (gchar**)gcr_pkcs11_get_trust_lookup_uris ()); |
212 | gchar* title = g_strdup_printf ("Error granting trust: %s", error->message); |
213 | midori_tab_stop_loading (MIDORI_TAB (view)); |
214 | - midori_view_display_error (view, NULL, NULL, title, slots, |
215 | + midori_view_display_error (view, NULL, NULL, NULL, title, slots, NULL, |
216 | _("Trust this website"), NULL); |
217 | g_free (title); |
218 | g_free (slots); |
219 | @@ -789,8 +791,8 @@ |
220 | { |
221 | midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_UNKNOWN); |
222 | midori_tab_stop_loading (MIDORI_TAB (view)); |
223 | - midori_view_display_error (view, NULL, NULL, _("Security unknown"), |
224 | - midori_location_action_tls_flags_to_string (tls_flags), |
225 | + midori_view_display_error (view, NULL, NULL, NULL, _("Security unknown"), |
226 | + midori_location_action_tls_flags_to_string (tls_flags), NULL, |
227 | _("Trust this website"), |
228 | NULL); |
229 | } |
230 | @@ -887,8 +889,15 @@ |
231 | icon_size_large_dialog = gtk_icon_size_register ("large-dialog", 64, 64); |
232 | |
233 | if (g_ascii_isalpha (icon_name[0])) |
234 | - icon_size = strstr (icon_name, "dialog") ? |
235 | - icon_size_large_dialog : GTK_ICON_SIZE_BUTTON; |
236 | + { |
237 | + if (g_str_has_prefix (icon_name, "dialog/")) |
238 | + { |
239 | + icon_name = &icon_name [strlen("dialog/")]; |
240 | + icon_size = icon_size_large_dialog; |
241 | + } |
242 | + else |
243 | + icon_size = GTK_ICON_SIZE_BUTTON; |
244 | + } |
245 | else if (g_ascii_isdigit (icon_name[0])) |
246 | { |
247 | guint i = 0; |
248 | @@ -905,35 +914,6 @@ |
249 | } |
250 | } |
251 | |
252 | - /* If available, load SVG icon as SVG markup */ |
253 | - gtk_icon_size_lookup_for_settings ( |
254 | - gtk_widget_get_settings (GTK_WIDGET (view)), |
255 | - icon_size, &real_icon_size, &real_icon_size); |
256 | - icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, |
257 | - real_icon_size, GTK_ICON_LOOKUP_FORCE_SVG); |
258 | - icon_filename = icon_info ? gtk_icon_info_get_filename (icon_info) : NULL; |
259 | - if (icon_filename && g_str_has_suffix (icon_filename, ".svg")) |
260 | - { |
261 | - gchar* buffer; |
262 | - gsize buffer_size; |
263 | - if (g_file_get_contents (icon_filename, &buffer, &buffer_size, NULL)) |
264 | - { |
265 | - #ifdef HAVE_WEBKIT2 |
266 | - GInputStream* stream = g_memory_input_stream_new_from_data (buffer, buffer_size, g_free); |
267 | - webkit_uri_scheme_request_finish (request, stream, -1, "image/svg+xml"); |
268 | - g_object_unref (stream); |
269 | - #else |
270 | - gchar* encoded = g_base64_encode ((guchar*)buffer, buffer_size); |
271 | - gchar* data_uri = g_strconcat ("data:image/svg+xml;base64,", encoded, NULL); |
272 | - g_free (buffer); |
273 | - g_free (encoded); |
274 | - webkit_network_request_set_uri (request, data_uri); |
275 | - g_free (data_uri); |
276 | - #endif |
277 | - return; |
278 | - } |
279 | - } |
280 | - |
281 | /* Render icon as a PNG at the desired size */ |
282 | pixbuf = gtk_widget_render_icon (GTK_WIDGET (view), icon_name, icon_size, NULL); |
283 | if (!pixbuf) |
284 | @@ -1171,9 +1151,11 @@ |
285 | static gboolean |
286 | midori_view_display_error (MidoriView* view, |
287 | const gchar* uri, |
288 | + const gchar* error_icon, |
289 | const gchar* title, |
290 | const gchar* message, |
291 | const gchar* description, |
292 | + const gchar* suggestions, |
293 | const gchar* try_again, |
294 | #ifndef HAVE_WEBKIT2 |
295 | WebKitWebFrame* web_frame) |
296 | @@ -1210,8 +1192,10 @@ |
297 | "rtl" : "ltr", |
298 | "{title}", title_escaped, |
299 | "{favicon}", katze_str_non_null (favicon), |
300 | + "{error_icon}", katze_str_non_null (error_icon), |
301 | "{message}", message, |
302 | "{description}", description, |
303 | + "{suggestions}", katze_str_non_null (suggestions), |
304 | "{tryagain}", try_again, |
305 | "{uri}", uri, |
306 | "{hide-button-images}", show_button_images ? "" : "display:none", |
307 | @@ -1248,6 +1232,7 @@ |
308 | #endif |
309 | gchar* title; |
310 | gchar* message; |
311 | + GString* suggestions; |
312 | gboolean result; |
313 | |
314 | /* The unholy trinity; also ignored in Webkit's default error handler */ |
315 | @@ -1262,10 +1247,18 @@ |
316 | return FALSE; |
317 | } |
318 | |
319 | - title = g_strdup_printf (_("Error - %s"), uri); |
320 | - message = g_strdup_printf (_("The page '%s' couldn't be loaded."), uri); |
321 | - result = midori_view_display_error (view, uri, title, |
322 | - message, error->message, _("Try again"), web_frame); |
323 | + title = g_strdup_printf (_("'%s' can't be found"), midori_uri_parse_hostname(uri, NULL)); |
324 | + message = g_strdup_printf (_("The page '%s' couldn't be loaded:"), midori_uri_parse_hostname(uri, NULL)); |
325 | + |
326 | + suggestions = g_string_new ("<ul id=\"suggestions\"><li>"); |
327 | + g_string_append_printf (suggestions, "%s</li><li>%s</li><li>%s</li></ul>", |
328 | + _("Check the address for typos"), |
329 | + _("Make sure that an ethernet cable is plugged in or the wireless card is activated"), |
330 | + _("Verify that your network settings are correct")); |
331 | + |
332 | + result = midori_view_display_error (view, uri, "stock://dialog/network-error", title, |
333 | + message, error->message, g_string_free (suggestions, FALSE), |
334 | + _("Try Again"), web_frame); |
335 | g_free (message); |
336 | g_free (title); |
337 | return result; |
338 | @@ -1397,8 +1390,8 @@ |
339 | const gchar* uri = webkit_web_view_get_uri (web_view); |
340 | gchar* title = g_strdup_printf (_("Oops - %s"), uri); |
341 | gchar* message = g_strdup_printf (_("Something went wrong with '%s'."), uri); |
342 | - midori_view_display_error (view, uri, title, |
343 | - message, "", _("Try again"), NULL); |
344 | + midori_view_display_error (view, uri, NULL, title, |
345 | + message, "", NULL, _("Try again"), NULL); |
346 | g_free (message); |
347 | g_free (title); |
348 | } |
349 | @@ -4093,15 +4086,16 @@ |
350 | else if (!strcmp (uri, "about:private")) |
351 | { |
352 | data = g_strdup_printf ( |
353 | - "<html><head><title>%s</title>" |
354 | + "<html dir=\"ltr\"><head><title>%s</title>" |
355 | "<link rel=\"stylesheet\" type=\"text/css\" href=\"res://about.css\">" |
356 | - "</head><body><div id=\"container\">" |
357 | - "<img id=\"logo\" src=\"res://logo-shade.png\" " |
358 | - "style=\"position: absolute; right: 15px; bottom: 15px; z-index: -9;\">" |
359 | - "<img id=\"icon\" src=\"stock://gtk-dialog-info\">" |
360 | - "<div id=\"main\"><h1>%s</h1>" |
361 | - "<p>%s</p><ul><li>%s</li><li>%s</li><li>%s</li></ul>" |
362 | - "<p>%s</p><ul><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>" |
363 | + "</head>" |
364 | + "<body>" |
365 | + "<img id=\"logo\" src=\"res://logo-shade.png\" />" |
366 | + "<div id=\"main\" style=\"background-image: url(stock://dialog/gtk-dialog-info);\">" |
367 | + "<div id=\"text\">" |
368 | + "<h1>%s</h1>" |
369 | + "<p class=\"message\">%s</p><ul class=\" suggestions\"><li>%s</li><li>%s</li><li>%s</li></ul>" |
370 | + "<p class=\"message\">%s</p><ul class=\" suggestions\"><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>" |
371 | "</div><br style=\"clear: both\"></div></body></html>", |
372 | _("Private Browsing"), _("Private Browsing"), |
373 | _("Midori doesn't store any personal data:"), |
374 | @@ -4204,8 +4198,10 @@ |
375 | midori_tab_set_uri (MIDORI_TAB (view), uri); |
376 | midori_tab_set_special (MIDORI_TAB (view), TRUE); |
377 | katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_PENDING_UNDELAY); |
378 | - midori_view_display_error (view, NULL, NULL, _("Page loading delayed"), |
379 | + midori_view_display_error (view, NULL, "stock://dialog/network-idle", NULL, |
380 | + _("Page loading delayed:"), |
381 | _("Loading delayed either due to a recent crash or startup preferences."), |
382 | + NULL, |
383 | _("Load Page"), |
384 | NULL); |
385 | } |