Merge lp:~midori/midori/nativeGTK+ErrorPages into lp:midori

Proposed by Christian Dywan
Status: Work in progress
Proposed branch: lp:~midori/midori/nativeGTK+ErrorPages
Merge into: lp:midori
Diff against target: 617 lines (+111/-342)
9 files modified
AUTHORS (+0/-1)
configure (+0/-1)
data/error.html (+0/-30)
data/logo-shade.svg (+0/-150)
extensions/about.vala (+4/-19)
midori/midori-oops.vala (+53/-0)
midori/midori-tab.vala (+26/-0)
midori/midori-view.c (+27/-141)
po/POTFILES.in (+1/-0)
To merge this branch: bzr merge lp:~midori/midori/nativeGTK+ErrorPages
Reviewer Review Type Date Requested Status
Midori Devs Pending
Review via email: mp+254486@code.launchpad.net

Commit message

Implement Native error pages in GTK+

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

"view-refresh" is the name of the refresh icon ;)

Unmerged revisions

6914. By Christian Dywan

Implement Native error pages in GTK+

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AUTHORS'
2--- AUTHORS 2009-11-03 16:59:27 +0000
3+++ AUTHORS 2015-03-28 17:27:15 +0000
4@@ -23,7 +23,6 @@
5 extension: Nancy Runge <nancy@twotoasts.de>
6 midori: Nancy Runge <nancy@twotoasts.de>
7 news-feed: Nancy Runge <nancy@twotoasts.de>
8- logo-shade: Nancy Runge <nancy@twotoasts.de>
9
10 Translations:
11 cs: David Stancl <dstancl@dstancl.cz>
12
13=== modified file 'configure'
14--- configure 2013-11-05 18:00:59 +0000
15+++ configure 2015-03-28 17:27:15 +0000
16@@ -73,7 +73,6 @@
17 find . -iname CTestTestfile.cmake -exec rm {} \;
18
19 find . -iname *-folders -type d|xargs rm -fr
20- rm -fr data/logo-shade
21 fi
22
23 mkdir -p $BUILD_DIR && cd $BUILD_DIR || exit 1
24
25=== removed file 'data/error.html'
26--- data/error.html 2013-10-06 16:41:01 +0000
27+++ data/error.html 1970-01-01 00:00:00 +0000
28@@ -1,30 +0,0 @@
29-<!--
30- Error page template for Midori.
31- This file is licensed under the terms of the expat license, see the file EXPAT.
32--->
33-<html dir="{dir}">
34-<head>
35-<title>{title}</title>
36-{favicon}
37-<link rel="stylesheet" type="text/css" href="res://about.css" />
38-</head>
39-<body>
40-<img id="logo" src="res://logo-shade.png" />
41-<div id="main" style="background-image: url({error_icon});">
42- <div id="text">
43- <h1>{title}</h1>
44- <p class="message">{message}<br><i>{description}</i></p>
45- {suggestions}
46- </div>
47- <form method="GET" action="{uri}" id="button">
48- <button type="submit" onclick="location.reload(); return false;" {autofocus}>
49- <img style="{hide-button-images}" src="stock://gtk-refresh"/>
50- <span>{tryagain}</span>
51- </button>
52- </form>
53- </div>
54-
55-<br style="clear: both;"/>
56-</div>
57-</body>
58-</html>
59
60=== removed file 'data/logo-shade.svg'
61--- data/logo-shade.svg 2008-10-16 01:51:39 +0000
62+++ data/logo-shade.svg 1970-01-01 00:00:00 +0000
63@@ -1,150 +0,0 @@
64-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
65-<!-- Created with Inkscape (http://www.inkscape.org/) -->
66-<svg
67- xmlns:dc="http://purl.org/dc/elements/1.1/"
68- xmlns:cc="http://creativecommons.org/ns#"
69- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
70- xmlns:svg="http://www.w3.org/2000/svg"
71- xmlns="http://www.w3.org/2000/svg"
72- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
73- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
74- width="307.65372"
75- height="350"
76- id="svg2418"
77- sodipodi:version="0.32"
78- inkscape:version="0.46"
79- version="1.0"
80- inkscape:export-filename="/home/user/logo-shade.png"
81- inkscape:export-xdpi="90"
82- inkscape:export-ydpi="90"
83- sodipodi:docname="logo-shade.svg"
84- inkscape:output_extension="org.inkscape.output.svg.inkscape">
85- <sodipodi:namedview
86- id="base"
87- pagecolor="#ffffff"
88- bordercolor="#666666"
89- borderopacity="1.0"
90- gridtolerance="10000"
91- guidetolerance="10"
92- objecttolerance="10"
93- inkscape:pageopacity="0.0"
94- inkscape:pageshadow="2"
95- inkscape:zoom="1.03"
96- inkscape:cx="74.949357"
97- inkscape:cy="143.09941"
98- inkscape:document-units="px"
99- inkscape:current-layer="layer1"
100- showgrid="false"
101- inkscape:window-width="1253"
102- inkscape:window-height="682"
103- inkscape:window-x="0"
104- inkscape:window-y="22" />
105- <defs
106- id="defs2420">
107- <linearGradient
108- id="linearGradient3412">
109- <stop
110- id="stop3414"
111- offset="0"
112- style="stop-color:#ffffff;stop-opacity:0.59836066;" />
113- <stop
114- id="stop3416"
115- offset="1"
116- style="stop-color:#97f839;stop-opacity:0;" />
117- </linearGradient>
118- <linearGradient
119- id="linearGradient3458">
120- <stop
121- id="stop3460"
122- offset="0"
123- style="stop-color:#88fe38;stop-opacity:1;" />
124- <stop
125- id="stop3462"
126- offset="1"
127- style="stop-color:#ffffff;stop-opacity:0;" />
128- </linearGradient>
129- <inkscape:perspective
130- id="perspective2426"
131- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
132- inkscape:vp_z="744.09448 : 526.18109 : 1"
133- inkscape:vp_y="0 : 1000 : 0"
134- inkscape:vp_x="0 : 526.18109 : 1"
135- sodipodi:type="inkscape:persp3d" />
136- <linearGradient
137- id="linearGradient3458-648">
138- <stop
139- id="stop2423"
140- offset="0"
141- style="stop-color:#bababa;stop-opacity:1;" />
142- <stop
143- id="stop2425"
144- offset="1"
145- style="stop-color:#ffffff;stop-opacity:0;" />
146- </linearGradient>
147- <linearGradient
148- id="linearGradient3412-967">
149- <stop
150- id="stop2429"
151- offset="0"
152- style="stop-color:#ffffff;stop-opacity:0.59836066;" />
153- <stop
154- id="stop2431"
155- offset="1"
156- style="stop-color:#bababa;stop-opacity:0;" />
157- </linearGradient>
158- </defs>
159- <metadata
160- id="metadata2423">
161- <rdf:RDF>
162- <cc:Work
163- rdf:about="">
164- <dc:format>image/svg+xml</dc:format>
165- <dc:type
166- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
167- <dc:creator>
168- <cc:Agent>
169- <dc:title>Nancy Runge &lt;nancy@twotoasts.de&gt;</dc:title>
170- </cc:Agent>
171- </dc:creator>
172- <cc:license
173- rdf:resource="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" />
174- </cc:Work>
175- </rdf:RDF>
176- </metadata>
177- <g
178- transform="translate(-280.66056,-644.09745)"
179- id="layer1"
180- inkscape:groupmode="layer"
181- inkscape:label="Layer 1">
182- <g
183- id="g2546"
184- style="fill:#ffffff;fill-opacity:1;stroke:#bcbcbc;stroke-opacity:1"
185- transform="matrix(2.7318355,0,0,2.7318355,-731.07518,-1421.3016)">
186- <path
187- sodipodi:nodetypes="ccsscccsc"
188- id="path3598"
189- d="M 479.0149,757.44485 C 463.33929,760.3524 390.05715,768.6009 373.75783,823.05659 C 368.99751,841.48441 371.67629,866.55457 392.88608,865.62945 C 394.38911,865.56465 394.54399,866.0597 395.07871,867.32475 C 403.8111,887.98406 426.11314,884.657 430.13518,876.12801 C 430.41248,875.53998 429.75994,876.1331 430.13518,876.12801 C 452.01909,891.1113 463.94687,870.37434 470.8404,851.89287 C 479.26032,835.85799 484.40756,769.09622 479.90163,773.41411 C 403.13312,846.97906 403.28006,782.18757 479.0149,757.44485"
190- style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#bcbcbc;stroke-width:2.79349113000000004;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
191- <path
192- id="path3606"
193- d="M 394.6271,866.42646 C 389.11843,841.31269 395.51037,833.40754 398.10369,830.14819"
194- style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#bcbcbc;stroke-width:2.79349113000000004;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
195- sodipodi:nodetypes="cc" />
196- <path
197- id="path3608"
198- d="M 430.04511,875.57142 C 422.884,860.41673 424.07276,847.90995 429.16085,838.58891"
199- style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#bcbcbc;stroke-width:2.79349113000000004;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
200- sodipodi:nodetypes="cc" />
201- </g>
202- <g
203- id="g2551"
204- style="fill:#e8e8e8;fill-opacity:1;stroke:none"
205- transform="matrix(2.7318355,0,0,2.7318355,-731.59243,-1420.9344)">
206- <path
207- sodipodi:nodetypes="cccccccccccc"
208- id="path2553"
209- d="M 447.08573,768.31725 C 436.04919,774.1595 397.92257,781.58705 381.33359,820.27881 C 377.02863,833.88105 375.31278,851.44676 387.44516,857.54862 C 385.16801,848.06163 387.57514,834.11288 393.43272,827.57808 C 397.5473,821.96506 405.70797,826.00823 403.09775,831.29165 C 401.29067,836.46522 394.76631,843.8643 399.87669,863.28435 C 404.09154,874.85534 415.25599,879.58634 422.43347,873.92723 C 414.92666,858.12585 420.32228,825.17457 433.92305,832.69366 C 440.70334,836.82119 424.80942,848.38632 435.43821,869.81488 C 448.73626,880.75776 460.15899,863.55615 464.02222,850.63024 C 472.18961,832.82769 477.16809,790.8233 475.1786,786.29359 C 410.97397,845.50147 395.61545,794.24336 447.07098,768.23969"
210- style="fill:#e8e8e8;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.79349113;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
211- </g>
212- </g>
213-</svg>
214
215=== modified file 'extensions/about.vala'
216--- extensions/about.vala 2014-02-26 20:07:51 +0000
217+++ extensions/about.vala 2015-03-28 17:27:15 +0000
218@@ -110,7 +110,6 @@
219 <body>
220 <h1>a<span style="position: absolute; left: -1000px; top: -1000px">lias a=b; echo Copy carefully #</span>bout:version</h1>
221 <p>%s</p>
222- <img src="res://logo-shade.png" style="position: absolute; right: 15px; bottom: 15px; z-index: -9;">
223 <table>
224 <tr><td>Command line %s</td></tr>
225 %s
226@@ -158,23 +157,7 @@
227 private class Private : Page {
228 public override string uri { get; set; default = "about:private"; }
229 public override void get_contents (Midori.View view, string uri) {
230- this.load_html (view, """<html dir="ltr">
231- <head>
232- <title>%s</title>
233- <link rel="stylesheet" type="text/css" href="res://about.css">
234- </head>
235- <body>
236- <img id="logo" src="res://logo-shade.png" />
237- <div id="main" style="background-image: url(stock://dialog/gtk-dialog-info);">
238- <div id="text">
239- <h1>%s</h1>
240- <p class="message">%s</p><ul class=" suggestions"><li>%s</li><li>%s</li><li>%s</li></ul>
241- <p class="message">%s</p><ul class=" suggestions"><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>
242- </div><br style="clear: both"></div>
243- </body>
244- </html>""".printf (
245- _("Private Browsing"), _("Private Browsing"),
246- _("Midori doesn't store any personal data:"),
247+ string suggestions = "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s".printf (
248 _("No history or web cookies are being saved."),
249 _("Extensions are disabled."),
250 _("HTML5 storage, local database and application caches are disabled."),
251@@ -183,7 +166,9 @@
252 _("DNS prefetching is disabled."),
253 _("The language and timezone are not revealed to websites."),
254 _("Flash and other Netscape plugins cannot be listed by websites.")
255- ), uri);
256+ );
257+ view.widget = new Midori.Oops (uri, "security-high", _("Private Browsing"),
258+ _("Midori doesn't store any personal data:"), "", suggestions);
259 }
260 }
261
262
263=== added file 'midori/midori-oops.vala'
264--- midori/midori-oops.vala 1970-01-01 00:00:00 +0000
265+++ midori/midori-oops.vala 2015-03-28 17:27:15 +0000
266@@ -0,0 +1,53 @@
267+/*
268+ Copyright (C) 2014 Christian Dywan <christian@twotoasts.de>
269+
270+ This library is free software; you can redistribute it and/or
271+ modify it under the terms of the GNU Lesser General Public
272+ License as published by the Free Software Foundation; either
273+ version 2.1 of the License, or (at your option) any later version.
274+
275+ See the file COPYING for the full license text.
276+*/
277+
278+namespace Midori {
279+ public class Oops : Gtk.Box {
280+ public string uri { get; private set; }
281+ public string title { get; private set; }
282+ public signal void retried ();
283+
284+ [CCode (type = "GtkWidget*")]
285+ public Oops (string uri, string icon, string title, string message, string description, string? suggestions=null, string? retry=null) {
286+ this.uri = uri;
287+ this.title = title;
288+ orientation = Gtk.Orientation.HORIZONTAL;
289+ spacing = 4;
290+ get_style_context ().add_class ("content-view");
291+ var image = new Gtk.Image.from_icon_name (icon, Gtk.IconSize.DIALOG);
292+ var header = new Gtk.Label (Markup.printf_escaped (
293+ "<big>%s</big>\n%s\n<small>%s</small>\n%s",
294+ title, message, description, suggestions ?? ""));
295+ header.use_markup = true;
296+ header.wrap = true;
297+ header.selectable = true;
298+ var actions = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
299+ actions.layout_style = Gtk.ButtonBoxStyle.START;
300+ if (retry != null) {
301+ var reload = new Gtk.Button.with_label (retry);
302+ reload.image = new Gtk.Image.from_stock (Gtk.Stock.REFRESH, Gtk.IconSize.BUTTON);
303+ reload.clicked.connect (()=>{ retried (); });
304+ actions.add (reload);
305+ }
306+
307+ var column = new Gtk.Box (Gtk.Orientation.VERTICAL, spacing);
308+ var row = new Gtk.Box (Gtk.Orientation.HORIZONTAL, spacing);
309+ row.pack_start (image, false, false, spacing);
310+ var box = new Gtk.Box (Gtk.Orientation.VERTICAL, spacing);
311+ box.pack_start (header, false, false, spacing);
312+ box.pack_start (actions, false, false, spacing);
313+ row.pack_start (box, false, false, spacing);
314+ column.set_center_widget (row);
315+ set_center_widget (column);
316+ show_all ();
317+ }
318+ }
319+}
320
321=== modified file 'midori/midori-tab.vala'
322--- midori/midori-tab.vala 2014-05-24 23:20:44 +0000
323+++ midori/midori-tab.vala 2015-03-28 17:27:15 +0000
324@@ -45,6 +45,23 @@
325 public class Tab : Gtk.VBox {
326 public Tab related { get; set construct; }
327 public WebKit.WebView web_view { get; private set; }
328+ /* Since 0.6.0 */
329+ Gtk.Widget? native_widget = null;
330+ public Gtk.Widget? widget { get {
331+ return native_widget;
332+ } set {
333+ if (value is Midori.Oops) {
334+ uri = (value as Midori.Oops).uri;
335+ this.set ("title", (value as Midori.Oops).title);
336+ }
337+ native_widget = value;
338+ web_view.hide ();
339+ var content = (web_view.parent is Gtk.ScrolledWindow)
340+ ? web_view.parent.parent : web_view.parent;
341+ (content as Gtk.Box).pack_start (native_widget, true, false);
342+ native_widget.show ();
343+ }
344+ }
345
346 private string current_uri = "about:blank";
347 public string uri { get {
348@@ -52,6 +69,15 @@
349 }
350 protected set {
351 current_uri = Midori.URI.format_for_display (value);
352+ if (native_widget != null) {
353+ native_widget.hide ();
354+ var content = (web_view.parent is Gtk.ScrolledWindow)
355+ ? web_view.parent.parent : web_view.parent;
356+ content.remove (native_widget);
357+ native_widget = null;
358+ web_view.show ();
359+ notify_property ("widget");
360+ }
361 }
362 }
363
364
365=== modified file 'midori/midori-view.c'
366--- midori/midori-view.c 2015-03-24 23:03:26 +0000
367+++ midori/midori-view.c 2015-03-28 17:27:15 +0000
368@@ -625,7 +625,7 @@
369 gchar* slots = g_strjoinv (" , ", (gchar**)gcr_pkcs11_get_trust_lookup_uris ());
370 gchar* title = g_strdup_printf ("Error granting trust: %s", error->message);
371 midori_tab_stop_loading (MIDORI_TAB (view));
372- midori_view_display_error (view, NULL, NULL, NULL, title, slots, NULL,
373+ midori_view_display_error (view, NULL, "security-low", NULL, title, slots, NULL,
374 _("Trust this website"), NULL);
375 g_free (title);
376 g_free (slots);
377@@ -836,79 +836,6 @@
378 #endif
379 g_free (filepath);
380 }
381- else if (g_str_has_prefix (uri, "stock://"))
382- {
383- GdkPixbuf* pixbuf;
384- const gchar* icon_name = &uri[8] ? &uri[8] : "";
385- gint icon_size = GTK_ICON_SIZE_MENU;
386- static gint icon_size_large_dialog = 0;
387-
388- if (!icon_size_large_dialog)
389- {
390- gint width = 48, height = 48;
391- gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &width, &height);
392- icon_size_large_dialog = gtk_icon_size_register ("large-dialog", width * 2, height * 2);
393- }
394-
395- if (g_ascii_isalpha (icon_name[0]))
396- {
397- if (g_str_has_prefix (icon_name, "dialog/"))
398- {
399- icon_name = &icon_name [strlen("dialog/")];
400- icon_size = icon_size_large_dialog;
401- }
402- else
403- icon_size = GTK_ICON_SIZE_BUTTON;
404- }
405- else if (g_ascii_isdigit (icon_name[0]))
406- {
407- guint i = 0;
408- while (icon_name[i])
409- if (icon_name[i++] == '/')
410- {
411- gchar* size = g_strndup (icon_name, i - 1);
412- icon_size = atoi (size);
413- /* Compatibility: map pixel to symbolic size */
414- if (icon_size == 16)
415- icon_size = GTK_ICON_SIZE_MENU;
416- g_free (size);
417- icon_name = &icon_name[i];
418- }
419- }
420-
421- /* Render icon as a PNG at the desired size */
422- pixbuf = gtk_widget_render_icon (GTK_WIDGET (view), icon_name, icon_size, NULL);
423- if (!pixbuf)
424- pixbuf = gtk_widget_render_icon (GTK_WIDGET (view),
425- GTK_STOCK_MISSING_IMAGE, icon_size, NULL);
426- if (pixbuf)
427- {
428- gboolean success;
429- gchar* buffer;
430- gsize buffer_size;
431- gchar* encoded;
432- gchar* data_uri;
433-
434- success = gdk_pixbuf_save_to_buffer (pixbuf, &buffer, &buffer_size, "png", NULL, NULL);
435- g_object_unref (pixbuf);
436- if (!success)
437- return;
438-
439- encoded = g_base64_encode ((guchar*)buffer, buffer_size);
440- data_uri = g_strconcat ("data:image/png;base64,", encoded, NULL);
441- g_free (encoded);
442- #ifdef HAVE_WEBKIT2
443- GInputStream* stream = g_memory_input_stream_new_from_data (buffer, buffer_size, g_free);
444- webkit_uri_scheme_request_finish (request, stream, -1, "image/png");
445- g_object_unref (stream);
446- #else
447- g_free (buffer);
448- webkit_network_request_set_uri (request, data_uri);
449- #endif
450- g_free (data_uri);
451- return;
452- }
453- }
454 }
455
456 static void
457@@ -1117,6 +1044,13 @@
458 #endif
459 }
460
461+static void
462+midori_view_error_try_again_clicked_cb (MidoriOops* oops,
463+ MidoriView* view)
464+{
465+ midori_view_reload (view, FALSE);
466+}
467+
468 static gboolean
469 midori_view_display_error (MidoriView* view,
470 const gchar* uri,
471@@ -1132,65 +1066,15 @@
472 void* web_frame)
473 #endif
474 {
475- gchar* path = midori_paths_get_res_filename ("error.html");
476- gchar* template;
477-
478- if (g_file_get_contents (path, &template, NULL, NULL))
479- {
480- gchar* title_escaped;
481- const gchar* icon;
482- gchar* favicon;
483- gchar* result;
484- gboolean is_main_frame;
485-
486- #ifdef HAVE_WEBKIT2
487- is_main_frame = TRUE;
488- #else
489- is_main_frame = web_frame && (webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view)) == web_frame);
490- #endif
491-
492- #if !GTK_CHECK_VERSION (3, 0, 0)
493- /* g_object_get_valist: object class `GtkSettings' has no property named `gtk-button-images' */
494- g_type_class_unref (g_type_class_ref (GTK_TYPE_BUTTON));
495- #endif
496-
497- GtkSettings* gtk_settings = gtk_widget_get_settings (view->web_view);
498- gboolean show_button_images = gtk_settings != NULL
499- && katze_object_get_boolean (gtk_settings, "gtk-button-images");
500- if (uri == NULL)
501- uri = midori_tab_get_uri (MIDORI_TAB (view));
502- title_escaped = g_markup_escape_text (title ? title : view->title, -1);
503- icon = katze_item_get_icon (view->item);
504- favicon = icon && !g_str_has_prefix (icon, "stock://")
505- ? g_strdup_printf ("<link rel=\"shortcut icon\" href=\"%s\" />", icon) : NULL;
506- result = sokoke_replace_variables (template,
507- "{dir}", gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL ?
508- "rtl" : "ltr",
509- "{title}", title_escaped,
510- "{favicon}", katze_str_non_null (favicon),
511- "{error_icon}", katze_str_non_null (error_icon),
512- "{message}", message,
513- "{description}", description,
514- "{suggestions}", katze_str_non_null (suggestions),
515- "{tryagain}", try_again,
516- "{uri}", uri,
517- "{hide-button-images}", show_button_images ? "" : "display:none",
518- "{autofocus}", is_main_frame ? "autofocus=\"true\" " : "",
519- NULL);
520- g_free (favicon);
521- g_free (title_escaped);
522- g_free (template);
523-
524- midori_view_set_html (view, result, uri, web_frame);
525-
526- g_free (result);
527- g_free (path);
528-
529- return TRUE;
530- }
531- g_free (path);
532-
533- return FALSE;
534+ if (uri == NULL)
535+ uri = midori_tab_get_uri (MIDORI_TAB (view));
536+ if (title == NULL)
537+ title = view->title ? view->title : uri;
538+ const gchar* icon = error_icon ? error_icon : "dialog-error";
539+ GtkWidget* error = midori_oops_new (uri, icon, title, message, description, suggestions, try_again);
540+ g_signal_connect (error, "retried", G_CALLBACK (midori_view_error_try_again_clicked_cb), view);
541+ midori_tab_set_widget (MIDORI_TAB (view), error);
542+ return TRUE;
543 }
544
545 static gboolean
546@@ -1252,7 +1136,7 @@
547 midori_uri_parse_hostname(uri, NULL));
548 }
549
550- result = midori_view_display_error (view, uri, "stock://dialog/network-error", title,
551+ result = midori_view_display_error (view, uri, "network-error", title,
552 message, error->message, NULL,
553 _("Try Again"), web_frame);
554
555@@ -3672,18 +3556,18 @@
556 (GCallback)midori_view_web_view_crashed_cb, view);
557 view->scrolled_window = view->web_view;
558 WebKitWebContext* context = webkit_web_view_get_context (WEBKIT_WEB_VIEW (view->web_view));
559- webkit_web_context_register_uri_scheme (context,
560- "res", midori_view_uri_scheme_res, NULL, NULL);
561- webkit_web_context_register_uri_scheme (context,
562- "stock", midori_view_uri_scheme_res, NULL, NULL);
563 g_signal_connect (context, "download-started",
564 G_CALLBACK (midori_view_download_started_cb), view);
565 #endif
566
567+ GtkWidget* content = gtk_vbox_new (FALSE, 0);
568+ gtk_widget_show (content);
569+ gtk_box_pack_start (GTK_BOX (content), view->scrolled_window, TRUE, TRUE, 0);
570+
571 #if GTK_CHECK_VERSION(3, 2, 0)
572 view->overlay = gtk_overlay_new ();
573 gtk_widget_show (view->overlay);
574- gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window);
575+ gtk_container_add (GTK_CONTAINER (view->overlay), content);
576 gtk_box_pack_start (GTK_BOX (view), view->overlay, TRUE, TRUE, 0);
577
578 /* Overlays must be created before showing GtkOverlay as of GTK+ 3.2 */
579@@ -3708,7 +3592,7 @@
580 view->overlay_find);
581 gtk_widget_set_no_show_all (view->overlay_find, TRUE);
582 #else
583- gtk_box_pack_start (GTK_BOX (view), view->scrolled_window, TRUE, TRUE, 0);
584+ gtk_box_pack_start (GTK_BOX (view), content, TRUE, TRUE, 0);
585 #endif
586
587 #ifndef HAVE_WEBKIT2
588@@ -3884,6 +3768,8 @@
589
590 if (handled)
591 {
592+ if (midori_tab_get_widget (MIDORI_TAB (view)) != NULL)
593+ return;
594 midori_tab_set_uri (MIDORI_TAB (view), uri);
595 midori_tab_set_special (MIDORI_TAB (view), TRUE);
596 katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_UNDELAYED);
597@@ -3896,7 +3782,7 @@
598 midori_tab_set_uri (MIDORI_TAB (view), uri);
599 midori_tab_set_special (MIDORI_TAB (view), TRUE);
600 katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_PENDING_UNDELAY);
601- midori_view_display_error (view, NULL, "stock://dialog/network-idle", NULL,
602+ midori_view_display_error (view, NULL, "network-idle", NULL,
603 _("Page loading delayed:"),
604 _("Loading delayed either due to a recent crash or startup preferences."),
605 NULL,
606
607=== modified file 'po/POTFILES.in'
608--- po/POTFILES.in 2014-04-28 16:32:22 +0000
609+++ po/POTFILES.in 2015-03-28 17:27:15 +0000
610@@ -10,6 +10,7 @@
611 midori/midori-database.vala
612 midori/midori-extension.c
613 midori/midori-locationaction.c
614+midori/midori-oops.vala
615 midori/midori-panel.c
616 midori/midori-settings.vala
617 midori/midori-websettings.c

Subscribers

People subscribed via source and target branches

to all changes: