Merge lp:~midori/midori/nativeGTK+ErrorPages into lp:midori
- nativeGTK+ErrorPages
- Merge into trunk
Proposed by
Cris 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 |
Related bugs: |
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+
Description of the change
To post a comment you must log in.
Unmerged revisions
- 6914. By Cris 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 | 23 | extension: Nancy Runge <nancy@twotoasts.de> | 23 | extension: Nancy Runge <nancy@twotoasts.de> |
6 | 24 | midori: Nancy Runge <nancy@twotoasts.de> | 24 | midori: Nancy Runge <nancy@twotoasts.de> |
7 | 25 | news-feed: Nancy Runge <nancy@twotoasts.de> | 25 | news-feed: Nancy Runge <nancy@twotoasts.de> |
8 | 26 | logo-shade: Nancy Runge <nancy@twotoasts.de> | ||
9 | 27 | 26 | ||
10 | 28 | Translations: | 27 | Translations: |
11 | 29 | cs: David Stancl <dstancl@dstancl.cz> | 28 | cs: David Stancl <dstancl@dstancl.cz> |
12 | 30 | 29 | ||
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 | 73 | find . -iname CTestTestfile.cmake -exec rm {} \; | 73 | find . -iname CTestTestfile.cmake -exec rm {} \; |
18 | 74 | 74 | ||
19 | 75 | find . -iname *-folders -type d|xargs rm -fr | 75 | find . -iname *-folders -type d|xargs rm -fr |
20 | 76 | rm -fr data/logo-shade | ||
21 | 77 | fi | 76 | fi |
22 | 78 | 77 | ||
23 | 79 | mkdir -p $BUILD_DIR && cd $BUILD_DIR || exit 1 | 78 | mkdir -p $BUILD_DIR && cd $BUILD_DIR || exit 1 |
24 | 80 | 79 | ||
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 | 1 | <!-- | ||
30 | 2 | Error page template for Midori. | ||
31 | 3 | This file is licensed under the terms of the expat license, see the file EXPAT. | ||
32 | 4 | --> | ||
33 | 5 | <html dir="{dir}"> | ||
34 | 6 | <head> | ||
35 | 7 | <title>{title}</title> | ||
36 | 8 | {favicon} | ||
37 | 9 | <link rel="stylesheet" type="text/css" href="res://about.css" /> | ||
38 | 10 | </head> | ||
39 | 11 | <body> | ||
40 | 12 | <img id="logo" src="res://logo-shade.png" /> | ||
41 | 13 | <div id="main" style="background-image: url({error_icon});"> | ||
42 | 14 | <div id="text"> | ||
43 | 15 | <h1>{title}</h1> | ||
44 | 16 | <p class="message">{message}<br><i>{description}</i></p> | ||
45 | 17 | {suggestions} | ||
46 | 18 | </div> | ||
47 | 19 | <form method="GET" action="{uri}" id="button"> | ||
48 | 20 | <button type="submit" onclick="location.reload(); return false;" {autofocus}> | ||
49 | 21 | <img style="{hide-button-images}" src="stock://gtk-refresh"/> | ||
50 | 22 | <span>{tryagain}</span> | ||
51 | 23 | </button> | ||
52 | 24 | </form> | ||
53 | 25 | </div> | ||
54 | 26 | |||
55 | 27 | <br style="clear: both;"/> | ||
56 | 28 | </div> | ||
57 | 29 | </body> | ||
58 | 30 | </html> | ||
59 | 31 | 0 | ||
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 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
65 | 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
66 | 3 | <svg | ||
67 | 4 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
68 | 5 | xmlns:cc="http://creativecommons.org/ns#" | ||
69 | 6 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
70 | 7 | xmlns:svg="http://www.w3.org/2000/svg" | ||
71 | 8 | xmlns="http://www.w3.org/2000/svg" | ||
72 | 9 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
73 | 10 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
74 | 11 | width="307.65372" | ||
75 | 12 | height="350" | ||
76 | 13 | id="svg2418" | ||
77 | 14 | sodipodi:version="0.32" | ||
78 | 15 | inkscape:version="0.46" | ||
79 | 16 | version="1.0" | ||
80 | 17 | inkscape:export-filename="/home/user/logo-shade.png" | ||
81 | 18 | inkscape:export-xdpi="90" | ||
82 | 19 | inkscape:export-ydpi="90" | ||
83 | 20 | sodipodi:docname="logo-shade.svg" | ||
84 | 21 | inkscape:output_extension="org.inkscape.output.svg.inkscape"> | ||
85 | 22 | <sodipodi:namedview | ||
86 | 23 | id="base" | ||
87 | 24 | pagecolor="#ffffff" | ||
88 | 25 | bordercolor="#666666" | ||
89 | 26 | borderopacity="1.0" | ||
90 | 27 | gridtolerance="10000" | ||
91 | 28 | guidetolerance="10" | ||
92 | 29 | objecttolerance="10" | ||
93 | 30 | inkscape:pageopacity="0.0" | ||
94 | 31 | inkscape:pageshadow="2" | ||
95 | 32 | inkscape:zoom="1.03" | ||
96 | 33 | inkscape:cx="74.949357" | ||
97 | 34 | inkscape:cy="143.09941" | ||
98 | 35 | inkscape:document-units="px" | ||
99 | 36 | inkscape:current-layer="layer1" | ||
100 | 37 | showgrid="false" | ||
101 | 38 | inkscape:window-width="1253" | ||
102 | 39 | inkscape:window-height="682" | ||
103 | 40 | inkscape:window-x="0" | ||
104 | 41 | inkscape:window-y="22" /> | ||
105 | 42 | <defs | ||
106 | 43 | id="defs2420"> | ||
107 | 44 | <linearGradient | ||
108 | 45 | id="linearGradient3412"> | ||
109 | 46 | <stop | ||
110 | 47 | id="stop3414" | ||
111 | 48 | offset="0" | ||
112 | 49 | style="stop-color:#ffffff;stop-opacity:0.59836066;" /> | ||
113 | 50 | <stop | ||
114 | 51 | id="stop3416" | ||
115 | 52 | offset="1" | ||
116 | 53 | style="stop-color:#97f839;stop-opacity:0;" /> | ||
117 | 54 | </linearGradient> | ||
118 | 55 | <linearGradient | ||
119 | 56 | id="linearGradient3458"> | ||
120 | 57 | <stop | ||
121 | 58 | id="stop3460" | ||
122 | 59 | offset="0" | ||
123 | 60 | style="stop-color:#88fe38;stop-opacity:1;" /> | ||
124 | 61 | <stop | ||
125 | 62 | id="stop3462" | ||
126 | 63 | offset="1" | ||
127 | 64 | style="stop-color:#ffffff;stop-opacity:0;" /> | ||
128 | 65 | </linearGradient> | ||
129 | 66 | <inkscape:perspective | ||
130 | 67 | id="perspective2426" | ||
131 | 68 | inkscape:persp3d-origin="372.04724 : 350.78739 : 1" | ||
132 | 69 | inkscape:vp_z="744.09448 : 526.18109 : 1" | ||
133 | 70 | inkscape:vp_y="0 : 1000 : 0" | ||
134 | 71 | inkscape:vp_x="0 : 526.18109 : 1" | ||
135 | 72 | sodipodi:type="inkscape:persp3d" /> | ||
136 | 73 | <linearGradient | ||
137 | 74 | id="linearGradient3458-648"> | ||
138 | 75 | <stop | ||
139 | 76 | id="stop2423" | ||
140 | 77 | offset="0" | ||
141 | 78 | style="stop-color:#bababa;stop-opacity:1;" /> | ||
142 | 79 | <stop | ||
143 | 80 | id="stop2425" | ||
144 | 81 | offset="1" | ||
145 | 82 | style="stop-color:#ffffff;stop-opacity:0;" /> | ||
146 | 83 | </linearGradient> | ||
147 | 84 | <linearGradient | ||
148 | 85 | id="linearGradient3412-967"> | ||
149 | 86 | <stop | ||
150 | 87 | id="stop2429" | ||
151 | 88 | offset="0" | ||
152 | 89 | style="stop-color:#ffffff;stop-opacity:0.59836066;" /> | ||
153 | 90 | <stop | ||
154 | 91 | id="stop2431" | ||
155 | 92 | offset="1" | ||
156 | 93 | style="stop-color:#bababa;stop-opacity:0;" /> | ||
157 | 94 | </linearGradient> | ||
158 | 95 | </defs> | ||
159 | 96 | <metadata | ||
160 | 97 | id="metadata2423"> | ||
161 | 98 | <rdf:RDF> | ||
162 | 99 | <cc:Work | ||
163 | 100 | rdf:about=""> | ||
164 | 101 | <dc:format>image/svg+xml</dc:format> | ||
165 | 102 | <dc:type | ||
166 | 103 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
167 | 104 | <dc:creator> | ||
168 | 105 | <cc:Agent> | ||
169 | 106 | <dc:title>Nancy Runge <nancy@twotoasts.de></dc:title> | ||
170 | 107 | </cc:Agent> | ||
171 | 108 | </dc:creator> | ||
172 | 109 | <cc:license | ||
173 | 110 | rdf:resource="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" /> | ||
174 | 111 | </cc:Work> | ||
175 | 112 | </rdf:RDF> | ||
176 | 113 | </metadata> | ||
177 | 114 | <g | ||
178 | 115 | transform="translate(-280.66056,-644.09745)" | ||
179 | 116 | id="layer1" | ||
180 | 117 | inkscape:groupmode="layer" | ||
181 | 118 | inkscape:label="Layer 1"> | ||
182 | 119 | <g | ||
183 | 120 | id="g2546" | ||
184 | 121 | style="fill:#ffffff;fill-opacity:1;stroke:#bcbcbc;stroke-opacity:1" | ||
185 | 122 | transform="matrix(2.7318355,0,0,2.7318355,-731.07518,-1421.3016)"> | ||
186 | 123 | <path | ||
187 | 124 | sodipodi:nodetypes="ccsscccsc" | ||
188 | 125 | id="path3598" | ||
189 | 126 | 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 | 127 | 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 | 128 | <path | ||
192 | 129 | id="path3606" | ||
193 | 130 | d="M 394.6271,866.42646 C 389.11843,841.31269 395.51037,833.40754 398.10369,830.14819" | ||
194 | 131 | 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 | 132 | sodipodi:nodetypes="cc" /> | ||
196 | 133 | <path | ||
197 | 134 | id="path3608" | ||
198 | 135 | d="M 430.04511,875.57142 C 422.884,860.41673 424.07276,847.90995 429.16085,838.58891" | ||
199 | 136 | 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 | 137 | sodipodi:nodetypes="cc" /> | ||
201 | 138 | </g> | ||
202 | 139 | <g | ||
203 | 140 | id="g2551" | ||
204 | 141 | style="fill:#e8e8e8;fill-opacity:1;stroke:none" | ||
205 | 142 | transform="matrix(2.7318355,0,0,2.7318355,-731.59243,-1420.9344)"> | ||
206 | 143 | <path | ||
207 | 144 | sodipodi:nodetypes="cccccccccccc" | ||
208 | 145 | id="path2553" | ||
209 | 146 | 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 | 147 | 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 | 148 | </g> | ||
212 | 149 | </g> | ||
213 | 150 | </svg> | ||
214 | 151 | 0 | ||
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 | 110 | <body> | 110 | <body> |
220 | 111 | <h1>a<span style="position: absolute; left: -1000px; top: -1000px">lias a=b; echo Copy carefully #</span>bout:version</h1> | 111 | <h1>a<span style="position: absolute; left: -1000px; top: -1000px">lias a=b; echo Copy carefully #</span>bout:version</h1> |
221 | 112 | <p>%s</p> | 112 | <p>%s</p> |
222 | 113 | <img src="res://logo-shade.png" style="position: absolute; right: 15px; bottom: 15px; z-index: -9;"> | ||
223 | 114 | <table> | 113 | <table> |
224 | 115 | <tr><td>Command line %s</td></tr> | 114 | <tr><td>Command line %s</td></tr> |
225 | 116 | %s | 115 | %s |
226 | @@ -158,23 +157,7 @@ | |||
227 | 158 | private class Private : Page { | 157 | private class Private : Page { |
228 | 159 | public override string uri { get; set; default = "about:private"; } | 158 | public override string uri { get; set; default = "about:private"; } |
229 | 160 | public override void get_contents (Midori.View view, string uri) { | 159 | public override void get_contents (Midori.View view, string uri) { |
247 | 161 | this.load_html (view, """<html dir="ltr"> | 160 | string suggestions = "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s".printf ( |
231 | 162 | <head> | ||
232 | 163 | <title>%s</title> | ||
233 | 164 | <link rel="stylesheet" type="text/css" href="res://about.css"> | ||
234 | 165 | </head> | ||
235 | 166 | <body> | ||
236 | 167 | <img id="logo" src="res://logo-shade.png" /> | ||
237 | 168 | <div id="main" style="background-image: url(stock://dialog/gtk-dialog-info);"> | ||
238 | 169 | <div id="text"> | ||
239 | 170 | <h1>%s</h1> | ||
240 | 171 | <p class="message">%s</p><ul class=" suggestions"><li>%s</li><li>%s</li><li>%s</li></ul> | ||
241 | 172 | <p class="message">%s</p><ul class=" suggestions"><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul> | ||
242 | 173 | </div><br style="clear: both"></div> | ||
243 | 174 | </body> | ||
244 | 175 | </html>""".printf ( | ||
245 | 176 | _("Private Browsing"), _("Private Browsing"), | ||
246 | 177 | _("Midori doesn't store any personal data:"), | ||
248 | 178 | _("No history or web cookies are being saved."), | 161 | _("No history or web cookies are being saved."), |
249 | 179 | _("Extensions are disabled."), | 162 | _("Extensions are disabled."), |
250 | 180 | _("HTML5 storage, local database and application caches are disabled."), | 163 | _("HTML5 storage, local database and application caches are disabled."), |
251 | @@ -183,7 +166,9 @@ | |||
252 | 183 | _("DNS prefetching is disabled."), | 166 | _("DNS prefetching is disabled."), |
253 | 184 | _("The language and timezone are not revealed to websites."), | 167 | _("The language and timezone are not revealed to websites."), |
254 | 185 | _("Flash and other Netscape plugins cannot be listed by websites.") | 168 | _("Flash and other Netscape plugins cannot be listed by websites.") |
256 | 186 | ), uri); | 169 | ); |
257 | 170 | view.widget = new Midori.Oops (uri, "security-high", _("Private Browsing"), | ||
258 | 171 | _("Midori doesn't store any personal data:"), "", suggestions); | ||
259 | 187 | } | 172 | } |
260 | 188 | } | 173 | } |
261 | 189 | 174 | ||
262 | 190 | 175 | ||
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 | 1 | /* | ||
268 | 2 | Copyright (C) 2014 Christian Dywan <christian@twotoasts.de> | ||
269 | 3 | |||
270 | 4 | This library is free software; you can redistribute it and/or | ||
271 | 5 | modify it under the terms of the GNU Lesser General Public | ||
272 | 6 | License as published by the Free Software Foundation; either | ||
273 | 7 | version 2.1 of the License, or (at your option) any later version. | ||
274 | 8 | |||
275 | 9 | See the file COPYING for the full license text. | ||
276 | 10 | */ | ||
277 | 11 | |||
278 | 12 | namespace Midori { | ||
279 | 13 | public class Oops : Gtk.Box { | ||
280 | 14 | public string uri { get; private set; } | ||
281 | 15 | public string title { get; private set; } | ||
282 | 16 | public signal void retried (); | ||
283 | 17 | |||
284 | 18 | [CCode (type = "GtkWidget*")] | ||
285 | 19 | public Oops (string uri, string icon, string title, string message, string description, string? suggestions=null, string? retry=null) { | ||
286 | 20 | this.uri = uri; | ||
287 | 21 | this.title = title; | ||
288 | 22 | orientation = Gtk.Orientation.HORIZONTAL; | ||
289 | 23 | spacing = 4; | ||
290 | 24 | get_style_context ().add_class ("content-view"); | ||
291 | 25 | var image = new Gtk.Image.from_icon_name (icon, Gtk.IconSize.DIALOG); | ||
292 | 26 | var header = new Gtk.Label (Markup.printf_escaped ( | ||
293 | 27 | "<big>%s</big>\n%s\n<small>%s</small>\n%s", | ||
294 | 28 | title, message, description, suggestions ?? "")); | ||
295 | 29 | header.use_markup = true; | ||
296 | 30 | header.wrap = true; | ||
297 | 31 | header.selectable = true; | ||
298 | 32 | var actions = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL); | ||
299 | 33 | actions.layout_style = Gtk.ButtonBoxStyle.START; | ||
300 | 34 | if (retry != null) { | ||
301 | 35 | var reload = new Gtk.Button.with_label (retry); | ||
302 | 36 | reload.image = new Gtk.Image.from_stock (Gtk.Stock.REFRESH, Gtk.IconSize.BUTTON); | ||
303 | 37 | reload.clicked.connect (()=>{ retried (); }); | ||
304 | 38 | actions.add (reload); | ||
305 | 39 | } | ||
306 | 40 | |||
307 | 41 | var column = new Gtk.Box (Gtk.Orientation.VERTICAL, spacing); | ||
308 | 42 | var row = new Gtk.Box (Gtk.Orientation.HORIZONTAL, spacing); | ||
309 | 43 | row.pack_start (image, false, false, spacing); | ||
310 | 44 | var box = new Gtk.Box (Gtk.Orientation.VERTICAL, spacing); | ||
311 | 45 | box.pack_start (header, false, false, spacing); | ||
312 | 46 | box.pack_start (actions, false, false, spacing); | ||
313 | 47 | row.pack_start (box, false, false, spacing); | ||
314 | 48 | column.set_center_widget (row); | ||
315 | 49 | set_center_widget (column); | ||
316 | 50 | show_all (); | ||
317 | 51 | } | ||
318 | 52 | } | ||
319 | 53 | } | ||
320 | 0 | 54 | ||
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 | 45 | public class Tab : Gtk.VBox { | 45 | public class Tab : Gtk.VBox { |
326 | 46 | public Tab related { get; set construct; } | 46 | public Tab related { get; set construct; } |
327 | 47 | public WebKit.WebView web_view { get; private set; } | 47 | public WebKit.WebView web_view { get; private set; } |
328 | 48 | /* Since 0.6.0 */ | ||
329 | 49 | Gtk.Widget? native_widget = null; | ||
330 | 50 | public Gtk.Widget? widget { get { | ||
331 | 51 | return native_widget; | ||
332 | 52 | } set { | ||
333 | 53 | if (value is Midori.Oops) { | ||
334 | 54 | uri = (value as Midori.Oops).uri; | ||
335 | 55 | this.set ("title", (value as Midori.Oops).title); | ||
336 | 56 | } | ||
337 | 57 | native_widget = value; | ||
338 | 58 | web_view.hide (); | ||
339 | 59 | var content = (web_view.parent is Gtk.ScrolledWindow) | ||
340 | 60 | ? web_view.parent.parent : web_view.parent; | ||
341 | 61 | (content as Gtk.Box).pack_start (native_widget, true, false); | ||
342 | 62 | native_widget.show (); | ||
343 | 63 | } | ||
344 | 64 | } | ||
345 | 48 | 65 | ||
346 | 49 | private string current_uri = "about:blank"; | 66 | private string current_uri = "about:blank"; |
347 | 50 | public string uri { get { | 67 | public string uri { get { |
348 | @@ -52,6 +69,15 @@ | |||
349 | 52 | } | 69 | } |
350 | 53 | protected set { | 70 | protected set { |
351 | 54 | current_uri = Midori.URI.format_for_display (value); | 71 | current_uri = Midori.URI.format_for_display (value); |
352 | 72 | if (native_widget != null) { | ||
353 | 73 | native_widget.hide (); | ||
354 | 74 | var content = (web_view.parent is Gtk.ScrolledWindow) | ||
355 | 75 | ? web_view.parent.parent : web_view.parent; | ||
356 | 76 | content.remove (native_widget); | ||
357 | 77 | native_widget = null; | ||
358 | 78 | web_view.show (); | ||
359 | 79 | notify_property ("widget"); | ||
360 | 80 | } | ||
361 | 55 | } | 81 | } |
362 | 56 | } | 82 | } |
363 | 57 | 83 | ||
364 | 58 | 84 | ||
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 | 625 | gchar* slots = g_strjoinv (" , ", (gchar**)gcr_pkcs11_get_trust_lookup_uris ()); | 625 | gchar* slots = g_strjoinv (" , ", (gchar**)gcr_pkcs11_get_trust_lookup_uris ()); |
370 | 626 | gchar* title = g_strdup_printf ("Error granting trust: %s", error->message); | 626 | gchar* title = g_strdup_printf ("Error granting trust: %s", error->message); |
371 | 627 | midori_tab_stop_loading (MIDORI_TAB (view)); | 627 | midori_tab_stop_loading (MIDORI_TAB (view)); |
373 | 628 | midori_view_display_error (view, NULL, NULL, NULL, title, slots, NULL, | 628 | midori_view_display_error (view, NULL, "security-low", NULL, title, slots, NULL, |
374 | 629 | _("Trust this website"), NULL); | 629 | _("Trust this website"), NULL); |
375 | 630 | g_free (title); | 630 | g_free (title); |
376 | 631 | g_free (slots); | 631 | g_free (slots); |
377 | @@ -836,79 +836,6 @@ | |||
378 | 836 | #endif | 836 | #endif |
379 | 837 | g_free (filepath); | 837 | g_free (filepath); |
380 | 838 | } | 838 | } |
381 | 839 | else if (g_str_has_prefix (uri, "stock://")) | ||
382 | 840 | { | ||
383 | 841 | GdkPixbuf* pixbuf; | ||
384 | 842 | const gchar* icon_name = &uri[8] ? &uri[8] : ""; | ||
385 | 843 | gint icon_size = GTK_ICON_SIZE_MENU; | ||
386 | 844 | static gint icon_size_large_dialog = 0; | ||
387 | 845 | |||
388 | 846 | if (!icon_size_large_dialog) | ||
389 | 847 | { | ||
390 | 848 | gint width = 48, height = 48; | ||
391 | 849 | gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &width, &height); | ||
392 | 850 | icon_size_large_dialog = gtk_icon_size_register ("large-dialog", width * 2, height * 2); | ||
393 | 851 | } | ||
394 | 852 | |||
395 | 853 | if (g_ascii_isalpha (icon_name[0])) | ||
396 | 854 | { | ||
397 | 855 | if (g_str_has_prefix (icon_name, "dialog/")) | ||
398 | 856 | { | ||
399 | 857 | icon_name = &icon_name [strlen("dialog/")]; | ||
400 | 858 | icon_size = icon_size_large_dialog; | ||
401 | 859 | } | ||
402 | 860 | else | ||
403 | 861 | icon_size = GTK_ICON_SIZE_BUTTON; | ||
404 | 862 | } | ||
405 | 863 | else if (g_ascii_isdigit (icon_name[0])) | ||
406 | 864 | { | ||
407 | 865 | guint i = 0; | ||
408 | 866 | while (icon_name[i]) | ||
409 | 867 | if (icon_name[i++] == '/') | ||
410 | 868 | { | ||
411 | 869 | gchar* size = g_strndup (icon_name, i - 1); | ||
412 | 870 | icon_size = atoi (size); | ||
413 | 871 | /* Compatibility: map pixel to symbolic size */ | ||
414 | 872 | if (icon_size == 16) | ||
415 | 873 | icon_size = GTK_ICON_SIZE_MENU; | ||
416 | 874 | g_free (size); | ||
417 | 875 | icon_name = &icon_name[i]; | ||
418 | 876 | } | ||
419 | 877 | } | ||
420 | 878 | |||
421 | 879 | /* Render icon as a PNG at the desired size */ | ||
422 | 880 | pixbuf = gtk_widget_render_icon (GTK_WIDGET (view), icon_name, icon_size, NULL); | ||
423 | 881 | if (!pixbuf) | ||
424 | 882 | pixbuf = gtk_widget_render_icon (GTK_WIDGET (view), | ||
425 | 883 | GTK_STOCK_MISSING_IMAGE, icon_size, NULL); | ||
426 | 884 | if (pixbuf) | ||
427 | 885 | { | ||
428 | 886 | gboolean success; | ||
429 | 887 | gchar* buffer; | ||
430 | 888 | gsize buffer_size; | ||
431 | 889 | gchar* encoded; | ||
432 | 890 | gchar* data_uri; | ||
433 | 891 | |||
434 | 892 | success = gdk_pixbuf_save_to_buffer (pixbuf, &buffer, &buffer_size, "png", NULL, NULL); | ||
435 | 893 | g_object_unref (pixbuf); | ||
436 | 894 | if (!success) | ||
437 | 895 | return; | ||
438 | 896 | |||
439 | 897 | encoded = g_base64_encode ((guchar*)buffer, buffer_size); | ||
440 | 898 | data_uri = g_strconcat ("data:image/png;base64,", encoded, NULL); | ||
441 | 899 | g_free (encoded); | ||
442 | 900 | #ifdef HAVE_WEBKIT2 | ||
443 | 901 | GInputStream* stream = g_memory_input_stream_new_from_data (buffer, buffer_size, g_free); | ||
444 | 902 | webkit_uri_scheme_request_finish (request, stream, -1, "image/png"); | ||
445 | 903 | g_object_unref (stream); | ||
446 | 904 | #else | ||
447 | 905 | g_free (buffer); | ||
448 | 906 | webkit_network_request_set_uri (request, data_uri); | ||
449 | 907 | #endif | ||
450 | 908 | g_free (data_uri); | ||
451 | 909 | return; | ||
452 | 910 | } | ||
453 | 911 | } | ||
454 | 912 | } | 839 | } |
455 | 913 | 840 | ||
456 | 914 | static void | 841 | static void |
457 | @@ -1117,6 +1044,13 @@ | |||
458 | 1117 | #endif | 1044 | #endif |
459 | 1118 | } | 1045 | } |
460 | 1119 | 1046 | ||
461 | 1047 | static void | ||
462 | 1048 | midori_view_error_try_again_clicked_cb (MidoriOops* oops, | ||
463 | 1049 | MidoriView* view) | ||
464 | 1050 | { | ||
465 | 1051 | midori_view_reload (view, FALSE); | ||
466 | 1052 | } | ||
467 | 1053 | |||
468 | 1120 | static gboolean | 1054 | static gboolean |
469 | 1121 | midori_view_display_error (MidoriView* view, | 1055 | midori_view_display_error (MidoriView* view, |
470 | 1122 | const gchar* uri, | 1056 | const gchar* uri, |
471 | @@ -1132,65 +1066,15 @@ | |||
472 | 1132 | void* web_frame) | 1066 | void* web_frame) |
473 | 1133 | #endif | 1067 | #endif |
474 | 1134 | { | 1068 | { |
534 | 1135 | gchar* path = midori_paths_get_res_filename ("error.html"); | 1069 | if (uri == NULL) |
535 | 1136 | gchar* template; | 1070 | uri = midori_tab_get_uri (MIDORI_TAB (view)); |
536 | 1137 | 1071 | if (title == NULL) | |
537 | 1138 | if (g_file_get_contents (path, &template, NULL, NULL)) | 1072 | title = view->title ? view->title : uri; |
538 | 1139 | { | 1073 | const gchar* icon = error_icon ? error_icon : "dialog-error"; |
539 | 1140 | gchar* title_escaped; | 1074 | GtkWidget* error = midori_oops_new (uri, icon, title, message, description, suggestions, try_again); |
540 | 1141 | const gchar* icon; | 1075 | g_signal_connect (error, "retried", G_CALLBACK (midori_view_error_try_again_clicked_cb), view); |
541 | 1142 | gchar* favicon; | 1076 | midori_tab_set_widget (MIDORI_TAB (view), error); |
542 | 1143 | gchar* result; | 1077 | return TRUE; |
484 | 1144 | gboolean is_main_frame; | ||
485 | 1145 | |||
486 | 1146 | #ifdef HAVE_WEBKIT2 | ||
487 | 1147 | is_main_frame = TRUE; | ||
488 | 1148 | #else | ||
489 | 1149 | is_main_frame = web_frame && (webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view)) == web_frame); | ||
490 | 1150 | #endif | ||
491 | 1151 | |||
492 | 1152 | #if !GTK_CHECK_VERSION (3, 0, 0) | ||
493 | 1153 | /* g_object_get_valist: object class `GtkSettings' has no property named `gtk-button-images' */ | ||
494 | 1154 | g_type_class_unref (g_type_class_ref (GTK_TYPE_BUTTON)); | ||
495 | 1155 | #endif | ||
496 | 1156 | |||
497 | 1157 | GtkSettings* gtk_settings = gtk_widget_get_settings (view->web_view); | ||
498 | 1158 | gboolean show_button_images = gtk_settings != NULL | ||
499 | 1159 | && katze_object_get_boolean (gtk_settings, "gtk-button-images"); | ||
500 | 1160 | if (uri == NULL) | ||
501 | 1161 | uri = midori_tab_get_uri (MIDORI_TAB (view)); | ||
502 | 1162 | title_escaped = g_markup_escape_text (title ? title : view->title, -1); | ||
503 | 1163 | icon = katze_item_get_icon (view->item); | ||
504 | 1164 | favicon = icon && !g_str_has_prefix (icon, "stock://") | ||
505 | 1165 | ? g_strdup_printf ("<link rel=\"shortcut icon\" href=\"%s\" />", icon) : NULL; | ||
506 | 1166 | result = sokoke_replace_variables (template, | ||
507 | 1167 | "{dir}", gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL ? | ||
508 | 1168 | "rtl" : "ltr", | ||
509 | 1169 | "{title}", title_escaped, | ||
510 | 1170 | "{favicon}", katze_str_non_null (favicon), | ||
511 | 1171 | "{error_icon}", katze_str_non_null (error_icon), | ||
512 | 1172 | "{message}", message, | ||
513 | 1173 | "{description}", description, | ||
514 | 1174 | "{suggestions}", katze_str_non_null (suggestions), | ||
515 | 1175 | "{tryagain}", try_again, | ||
516 | 1176 | "{uri}", uri, | ||
517 | 1177 | "{hide-button-images}", show_button_images ? "" : "display:none", | ||
518 | 1178 | "{autofocus}", is_main_frame ? "autofocus=\"true\" " : "", | ||
519 | 1179 | NULL); | ||
520 | 1180 | g_free (favicon); | ||
521 | 1181 | g_free (title_escaped); | ||
522 | 1182 | g_free (template); | ||
523 | 1183 | |||
524 | 1184 | midori_view_set_html (view, result, uri, web_frame); | ||
525 | 1185 | |||
526 | 1186 | g_free (result); | ||
527 | 1187 | g_free (path); | ||
528 | 1188 | |||
529 | 1189 | return TRUE; | ||
530 | 1190 | } | ||
531 | 1191 | g_free (path); | ||
532 | 1192 | |||
533 | 1193 | return FALSE; | ||
543 | 1194 | } | 1078 | } |
544 | 1195 | 1079 | ||
545 | 1196 | static gboolean | 1080 | static gboolean |
546 | @@ -1252,7 +1136,7 @@ | |||
547 | 1252 | midori_uri_parse_hostname(uri, NULL)); | 1136 | midori_uri_parse_hostname(uri, NULL)); |
548 | 1253 | } | 1137 | } |
549 | 1254 | 1138 | ||
551 | 1255 | result = midori_view_display_error (view, uri, "stock://dialog/network-error", title, | 1139 | result = midori_view_display_error (view, uri, "network-error", title, |
552 | 1256 | message, error->message, NULL, | 1140 | message, error->message, NULL, |
553 | 1257 | _("Try Again"), web_frame); | 1141 | _("Try Again"), web_frame); |
554 | 1258 | 1142 | ||
555 | @@ -3672,18 +3556,18 @@ | |||
556 | 3672 | (GCallback)midori_view_web_view_crashed_cb, view); | 3556 | (GCallback)midori_view_web_view_crashed_cb, view); |
557 | 3673 | view->scrolled_window = view->web_view; | 3557 | view->scrolled_window = view->web_view; |
558 | 3674 | WebKitWebContext* context = webkit_web_view_get_context (WEBKIT_WEB_VIEW (view->web_view)); | 3558 | WebKitWebContext* context = webkit_web_view_get_context (WEBKIT_WEB_VIEW (view->web_view)); |
559 | 3675 | webkit_web_context_register_uri_scheme (context, | ||
560 | 3676 | "res", midori_view_uri_scheme_res, NULL, NULL); | ||
561 | 3677 | webkit_web_context_register_uri_scheme (context, | ||
562 | 3678 | "stock", midori_view_uri_scheme_res, NULL, NULL); | ||
563 | 3679 | g_signal_connect (context, "download-started", | 3559 | g_signal_connect (context, "download-started", |
564 | 3680 | G_CALLBACK (midori_view_download_started_cb), view); | 3560 | G_CALLBACK (midori_view_download_started_cb), view); |
565 | 3681 | #endif | 3561 | #endif |
566 | 3682 | 3562 | ||
567 | 3563 | GtkWidget* content = gtk_vbox_new (FALSE, 0); | ||
568 | 3564 | gtk_widget_show (content); | ||
569 | 3565 | gtk_box_pack_start (GTK_BOX (content), view->scrolled_window, TRUE, TRUE, 0); | ||
570 | 3566 | |||
571 | 3683 | #if GTK_CHECK_VERSION(3, 2, 0) | 3567 | #if GTK_CHECK_VERSION(3, 2, 0) |
572 | 3684 | view->overlay = gtk_overlay_new (); | 3568 | view->overlay = gtk_overlay_new (); |
573 | 3685 | gtk_widget_show (view->overlay); | 3569 | gtk_widget_show (view->overlay); |
575 | 3686 | gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window); | 3570 | gtk_container_add (GTK_CONTAINER (view->overlay), content); |
576 | 3687 | gtk_box_pack_start (GTK_BOX (view), view->overlay, TRUE, TRUE, 0); | 3571 | gtk_box_pack_start (GTK_BOX (view), view->overlay, TRUE, TRUE, 0); |
577 | 3688 | 3572 | ||
578 | 3689 | /* Overlays must be created before showing GtkOverlay as of GTK+ 3.2 */ | 3573 | /* Overlays must be created before showing GtkOverlay as of GTK+ 3.2 */ |
579 | @@ -3708,7 +3592,7 @@ | |||
580 | 3708 | view->overlay_find); | 3592 | view->overlay_find); |
581 | 3709 | gtk_widget_set_no_show_all (view->overlay_find, TRUE); | 3593 | gtk_widget_set_no_show_all (view->overlay_find, TRUE); |
582 | 3710 | #else | 3594 | #else |
584 | 3711 | gtk_box_pack_start (GTK_BOX (view), view->scrolled_window, TRUE, TRUE, 0); | 3595 | gtk_box_pack_start (GTK_BOX (view), content, TRUE, TRUE, 0); |
585 | 3712 | #endif | 3596 | #endif |
586 | 3713 | 3597 | ||
587 | 3714 | #ifndef HAVE_WEBKIT2 | 3598 | #ifndef HAVE_WEBKIT2 |
588 | @@ -3884,6 +3768,8 @@ | |||
589 | 3884 | 3768 | ||
590 | 3885 | if (handled) | 3769 | if (handled) |
591 | 3886 | { | 3770 | { |
592 | 3771 | if (midori_tab_get_widget (MIDORI_TAB (view)) != NULL) | ||
593 | 3772 | return; | ||
594 | 3887 | midori_tab_set_uri (MIDORI_TAB (view), uri); | 3773 | midori_tab_set_uri (MIDORI_TAB (view), uri); |
595 | 3888 | midori_tab_set_special (MIDORI_TAB (view), TRUE); | 3774 | midori_tab_set_special (MIDORI_TAB (view), TRUE); |
596 | 3889 | katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_UNDELAYED); | 3775 | katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_UNDELAYED); |
597 | @@ -3896,7 +3782,7 @@ | |||
598 | 3896 | midori_tab_set_uri (MIDORI_TAB (view), uri); | 3782 | midori_tab_set_uri (MIDORI_TAB (view), uri); |
599 | 3897 | midori_tab_set_special (MIDORI_TAB (view), TRUE); | 3783 | midori_tab_set_special (MIDORI_TAB (view), TRUE); |
600 | 3898 | katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_PENDING_UNDELAY); | 3784 | katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_PENDING_UNDELAY); |
602 | 3899 | midori_view_display_error (view, NULL, "stock://dialog/network-idle", NULL, | 3785 | midori_view_display_error (view, NULL, "network-idle", NULL, |
603 | 3900 | _("Page loading delayed:"), | 3786 | _("Page loading delayed:"), |
604 | 3901 | _("Loading delayed either due to a recent crash or startup preferences."), | 3787 | _("Loading delayed either due to a recent crash or startup preferences."), |
605 | 3902 | NULL, | 3788 | NULL, |
606 | 3903 | 3789 | ||
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 | 10 | midori/midori-database.vala | 10 | midori/midori-database.vala |
612 | 11 | midori/midori-extension.c | 11 | midori/midori-extension.c |
613 | 12 | midori/midori-locationaction.c | 12 | midori/midori-locationaction.c |
614 | 13 | midori/midori-oops.vala | ||
615 | 13 | midori/midori-panel.c | 14 | midori/midori-panel.c |
616 | 14 | midori/midori-settings.vala | 15 | midori/midori-settings.vala |
617 | 15 | midori/midori-websettings.c | 16 | midori/midori-websettings.c |
"view-refresh" is the name of the refresh icon ;)