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

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
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 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
=== modified file 'AUTHORS'
--- AUTHORS 2009-11-03 16:59:27 +0000
+++ AUTHORS 2015-03-28 17:27:15 +0000
@@ -23,7 +23,6 @@
23 extension: Nancy Runge <nancy@twotoasts.de>23 extension: Nancy Runge <nancy@twotoasts.de>
24 midori: Nancy Runge <nancy@twotoasts.de>24 midori: Nancy Runge <nancy@twotoasts.de>
25 news-feed: Nancy Runge <nancy@twotoasts.de>25 news-feed: Nancy Runge <nancy@twotoasts.de>
26 logo-shade: Nancy Runge <nancy@twotoasts.de>
2726
28Translations:27Translations:
29 cs: David Stancl <dstancl@dstancl.cz>28 cs: David Stancl <dstancl@dstancl.cz>
3029
=== modified file 'configure'
--- configure 2013-11-05 18:00:59 +0000
+++ configure 2015-03-28 17:27:15 +0000
@@ -73,7 +73,6 @@
73 find . -iname CTestTestfile.cmake -exec rm {} \;73 find . -iname CTestTestfile.cmake -exec rm {} \;
7474
75 find . -iname *-folders -type d|xargs rm -fr75 find . -iname *-folders -type d|xargs rm -fr
76 rm -fr data/logo-shade
77fi76fi
7877
79mkdir -p $BUILD_DIR && cd $BUILD_DIR || exit 178mkdir -p $BUILD_DIR && cd $BUILD_DIR || exit 1
8079
=== removed file 'data/error.html'
--- data/error.html 2013-10-06 16:41:01 +0000
+++ data/error.html 1970-01-01 00:00:00 +0000
@@ -1,30 +0,0 @@
1<!--
2 Error page template for Midori.
3 This file is licensed under the terms of the expat license, see the file EXPAT.
4-->
5<html dir="{dir}">
6<head>
7<title>{title}</title>
8{favicon}
9<link rel="stylesheet" type="text/css" href="res://about.css" />
10</head>
11<body>
12<img id="logo" src="res://logo-shade.png" />
13<div id="main" style="background-image: url({error_icon});">
14 <div id="text">
15 <h1>{title}</h1>
16 <p class="message">{message}<br><i>{description}</i></p>
17 {suggestions}
18 </div>
19 <form method="GET" action="{uri}" id="button">
20 <button type="submit" onclick="location.reload(); return false;" {autofocus}>
21 <img style="{hide-button-images}" src="stock://gtk-refresh"/>
22 <span>{tryagain}</span>
23 </button>
24 </form>
25 </div>
26
27<br style="clear: both;"/>
28</div>
29</body>
30</html>
310
=== removed file 'data/logo-shade.svg'
--- data/logo-shade.svg 2008-10-16 01:51:39 +0000
+++ data/logo-shade.svg 1970-01-01 00:00:00 +0000
@@ -1,150 +0,0 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3<svg
4 xmlns:dc="http://purl.org/dc/elements/1.1/"
5 xmlns:cc="http://creativecommons.org/ns#"
6 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7 xmlns:svg="http://www.w3.org/2000/svg"
8 xmlns="http://www.w3.org/2000/svg"
9 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
10 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
11 width="307.65372"
12 height="350"
13 id="svg2418"
14 sodipodi:version="0.32"
15 inkscape:version="0.46"
16 version="1.0"
17 inkscape:export-filename="/home/user/logo-shade.png"
18 inkscape:export-xdpi="90"
19 inkscape:export-ydpi="90"
20 sodipodi:docname="logo-shade.svg"
21 inkscape:output_extension="org.inkscape.output.svg.inkscape">
22 <sodipodi:namedview
23 id="base"
24 pagecolor="#ffffff"
25 bordercolor="#666666"
26 borderopacity="1.0"
27 gridtolerance="10000"
28 guidetolerance="10"
29 objecttolerance="10"
30 inkscape:pageopacity="0.0"
31 inkscape:pageshadow="2"
32 inkscape:zoom="1.03"
33 inkscape:cx="74.949357"
34 inkscape:cy="143.09941"
35 inkscape:document-units="px"
36 inkscape:current-layer="layer1"
37 showgrid="false"
38 inkscape:window-width="1253"
39 inkscape:window-height="682"
40 inkscape:window-x="0"
41 inkscape:window-y="22" />
42 <defs
43 id="defs2420">
44 <linearGradient
45 id="linearGradient3412">
46 <stop
47 id="stop3414"
48 offset="0"
49 style="stop-color:#ffffff;stop-opacity:0.59836066;" />
50 <stop
51 id="stop3416"
52 offset="1"
53 style="stop-color:#97f839;stop-opacity:0;" />
54 </linearGradient>
55 <linearGradient
56 id="linearGradient3458">
57 <stop
58 id="stop3460"
59 offset="0"
60 style="stop-color:#88fe38;stop-opacity:1;" />
61 <stop
62 id="stop3462"
63 offset="1"
64 style="stop-color:#ffffff;stop-opacity:0;" />
65 </linearGradient>
66 <inkscape:perspective
67 id="perspective2426"
68 inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
69 inkscape:vp_z="744.09448 : 526.18109 : 1"
70 inkscape:vp_y="0 : 1000 : 0"
71 inkscape:vp_x="0 : 526.18109 : 1"
72 sodipodi:type="inkscape:persp3d" />
73 <linearGradient
74 id="linearGradient3458-648">
75 <stop
76 id="stop2423"
77 offset="0"
78 style="stop-color:#bababa;stop-opacity:1;" />
79 <stop
80 id="stop2425"
81 offset="1"
82 style="stop-color:#ffffff;stop-opacity:0;" />
83 </linearGradient>
84 <linearGradient
85 id="linearGradient3412-967">
86 <stop
87 id="stop2429"
88 offset="0"
89 style="stop-color:#ffffff;stop-opacity:0.59836066;" />
90 <stop
91 id="stop2431"
92 offset="1"
93 style="stop-color:#bababa;stop-opacity:0;" />
94 </linearGradient>
95 </defs>
96 <metadata
97 id="metadata2423">
98 <rdf:RDF>
99 <cc:Work
100 rdf:about="">
101 <dc:format>image/svg+xml</dc:format>
102 <dc:type
103 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
104 <dc:creator>
105 <cc:Agent>
106 <dc:title>Nancy Runge &lt;nancy@twotoasts.de&gt;</dc:title>
107 </cc:Agent>
108 </dc:creator>
109 <cc:license
110 rdf:resource="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" />
111 </cc:Work>
112 </rdf:RDF>
113 </metadata>
114 <g
115 transform="translate(-280.66056,-644.09745)"
116 id="layer1"
117 inkscape:groupmode="layer"
118 inkscape:label="Layer 1">
119 <g
120 id="g2546"
121 style="fill:#ffffff;fill-opacity:1;stroke:#bcbcbc;stroke-opacity:1"
122 transform="matrix(2.7318355,0,0,2.7318355,-731.07518,-1421.3016)">
123 <path
124 sodipodi:nodetypes="ccsscccsc"
125 id="path3598"
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"
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" />
128 <path
129 id="path3606"
130 d="M 394.6271,866.42646 C 389.11843,841.31269 395.51037,833.40754 398.10369,830.14819"
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"
132 sodipodi:nodetypes="cc" />
133 <path
134 id="path3608"
135 d="M 430.04511,875.57142 C 422.884,860.41673 424.07276,847.90995 429.16085,838.58891"
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"
137 sodipodi:nodetypes="cc" />
138 </g>
139 <g
140 id="g2551"
141 style="fill:#e8e8e8;fill-opacity:1;stroke:none"
142 transform="matrix(2.7318355,0,0,2.7318355,-731.59243,-1420.9344)">
143 <path
144 sodipodi:nodetypes="cccccccccccc"
145 id="path2553"
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"
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" />
148 </g>
149 </g>
150</svg>
1510
=== modified file 'extensions/about.vala'
--- extensions/about.vala 2014-02-26 20:07:51 +0000
+++ extensions/about.vala 2015-03-28 17:27:15 +0000
@@ -110,7 +110,6 @@
110 <body>110 <body>
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>
112 <p>%s</p>112 <p>%s</p>
113 <img src="res://logo-shade.png" style="position: absolute; right: 15px; bottom: 15px; z-index: -9;">
114 <table>113 <table>
115 <tr><td>Command line %s</td></tr>114 <tr><td>Command line %s</td></tr>
116 %s115 %s
@@ -158,23 +157,7 @@
158 private class Private : Page {157 private class Private : Page {
159 public override string uri { get; set; default = "about:private"; }158 public override string uri { get; set; default = "about:private"; }
160 public override void get_contents (Midori.View view, string uri) {159 public override void get_contents (Midori.View view, string uri) {
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 (
162 <head>
163 <title>%s</title>
164 <link rel="stylesheet" type="text/css" href="res://about.css">
165 </head>
166 <body>
167 <img id="logo" src="res://logo-shade.png" />
168 <div id="main" style="background-image: url(stock://dialog/gtk-dialog-info);">
169 <div id="text">
170 <h1>%s</h1>
171 <p class="message">%s</p><ul class=" suggestions"><li>%s</li><li>%s</li><li>%s</li></ul>
172 <p class="message">%s</p><ul class=" suggestions"><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>
173 </div><br style="clear: both"></div>
174 </body>
175 </html>""".printf (
176 _("Private Browsing"), _("Private Browsing"),
177 _("Midori doesn't store any personal data:"),
178 _("No history or web cookies are being saved."),161 _("No history or web cookies are being saved."),
179 _("Extensions are disabled."),162 _("Extensions are disabled."),
180 _("HTML5 storage, local database and application caches are disabled."),163 _("HTML5 storage, local database and application caches are disabled."),
@@ -183,7 +166,9 @@
183 _("DNS prefetching is disabled."),166 _("DNS prefetching is disabled."),
184 _("The language and timezone are not revealed to websites."),167 _("The language and timezone are not revealed to websites."),
185 _("Flash and other Netscape plugins cannot be listed by websites.")168 _("Flash and other Netscape plugins cannot be listed by websites.")
186 ), uri);169 );
170 view.widget = new Midori.Oops (uri, "security-high", _("Private Browsing"),
171 _("Midori doesn't store any personal data:"), "", suggestions);
187 }172 }
188 }173 }
189174
190175
=== added file 'midori/midori-oops.vala'
--- midori/midori-oops.vala 1970-01-01 00:00:00 +0000
+++ midori/midori-oops.vala 2015-03-28 17:27:15 +0000
@@ -0,0 +1,53 @@
1/*
2 Copyright (C) 2014 Christian Dywan <christian@twotoasts.de>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 See the file COPYING for the full license text.
10*/
11
12namespace Midori {
13 public class Oops : Gtk.Box {
14 public string uri { get; private set; }
15 public string title { get; private set; }
16 public signal void retried ();
17
18 [CCode (type = "GtkWidget*")]
19 public Oops (string uri, string icon, string title, string message, string description, string? suggestions=null, string? retry=null) {
20 this.uri = uri;
21 this.title = title;
22 orientation = Gtk.Orientation.HORIZONTAL;
23 spacing = 4;
24 get_style_context ().add_class ("content-view");
25 var image = new Gtk.Image.from_icon_name (icon, Gtk.IconSize.DIALOG);
26 var header = new Gtk.Label (Markup.printf_escaped (
27 "<big>%s</big>\n%s\n<small>%s</small>\n%s",
28 title, message, description, suggestions ?? ""));
29 header.use_markup = true;
30 header.wrap = true;
31 header.selectable = true;
32 var actions = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
33 actions.layout_style = Gtk.ButtonBoxStyle.START;
34 if (retry != null) {
35 var reload = new Gtk.Button.with_label (retry);
36 reload.image = new Gtk.Image.from_stock (Gtk.Stock.REFRESH, Gtk.IconSize.BUTTON);
37 reload.clicked.connect (()=>{ retried (); });
38 actions.add (reload);
39 }
40
41 var column = new Gtk.Box (Gtk.Orientation.VERTICAL, spacing);
42 var row = new Gtk.Box (Gtk.Orientation.HORIZONTAL, spacing);
43 row.pack_start (image, false, false, spacing);
44 var box = new Gtk.Box (Gtk.Orientation.VERTICAL, spacing);
45 box.pack_start (header, false, false, spacing);
46 box.pack_start (actions, false, false, spacing);
47 row.pack_start (box, false, false, spacing);
48 column.set_center_widget (row);
49 set_center_widget (column);
50 show_all ();
51 }
52 }
53}
054
=== modified file 'midori/midori-tab.vala'
--- midori/midori-tab.vala 2014-05-24 23:20:44 +0000
+++ midori/midori-tab.vala 2015-03-28 17:27:15 +0000
@@ -45,6 +45,23 @@
45 public class Tab : Gtk.VBox {45 public class Tab : Gtk.VBox {
46 public Tab related { get; set construct; }46 public Tab related { get; set construct; }
47 public WebKit.WebView web_view { get; private set; }47 public WebKit.WebView web_view { get; private set; }
48 /* Since 0.6.0 */
49 Gtk.Widget? native_widget = null;
50 public Gtk.Widget? widget { get {
51 return native_widget;
52 } set {
53 if (value is Midori.Oops) {
54 uri = (value as Midori.Oops).uri;
55 this.set ("title", (value as Midori.Oops).title);
56 }
57 native_widget = value;
58 web_view.hide ();
59 var content = (web_view.parent is Gtk.ScrolledWindow)
60 ? web_view.parent.parent : web_view.parent;
61 (content as Gtk.Box).pack_start (native_widget, true, false);
62 native_widget.show ();
63 }
64 }
4865
49 private string current_uri = "about:blank";66 private string current_uri = "about:blank";
50 public string uri { get {67 public string uri { get {
@@ -52,6 +69,15 @@
52 }69 }
53 protected set {70 protected set {
54 current_uri = Midori.URI.format_for_display (value);71 current_uri = Midori.URI.format_for_display (value);
72 if (native_widget != null) {
73 native_widget.hide ();
74 var content = (web_view.parent is Gtk.ScrolledWindow)
75 ? web_view.parent.parent : web_view.parent;
76 content.remove (native_widget);
77 native_widget = null;
78 web_view.show ();
79 notify_property ("widget");
80 }
55 }81 }
56 }82 }
5783
5884
=== modified file 'midori/midori-view.c'
--- midori/midori-view.c 2015-03-24 23:03:26 +0000
+++ midori/midori-view.c 2015-03-28 17:27:15 +0000
@@ -625,7 +625,7 @@
625 gchar* slots = g_strjoinv (" , ", (gchar**)gcr_pkcs11_get_trust_lookup_uris ());625 gchar* slots = g_strjoinv (" , ", (gchar**)gcr_pkcs11_get_trust_lookup_uris ());
626 gchar* title = g_strdup_printf ("Error granting trust: %s", error->message);626 gchar* title = g_strdup_printf ("Error granting trust: %s", error->message);
627 midori_tab_stop_loading (MIDORI_TAB (view));627 midori_tab_stop_loading (MIDORI_TAB (view));
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,
629 _("Trust this website"), NULL);629 _("Trust this website"), NULL);
630 g_free (title);630 g_free (title);
631 g_free (slots);631 g_free (slots);
@@ -836,79 +836,6 @@
836 #endif836 #endif
837 g_free (filepath);837 g_free (filepath);
838 }838 }
839 else if (g_str_has_prefix (uri, "stock://"))
840 {
841 GdkPixbuf* pixbuf;
842 const gchar* icon_name = &uri[8] ? &uri[8] : "";
843 gint icon_size = GTK_ICON_SIZE_MENU;
844 static gint icon_size_large_dialog = 0;
845
846 if (!icon_size_large_dialog)
847 {
848 gint width = 48, height = 48;
849 gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &width, &height);
850 icon_size_large_dialog = gtk_icon_size_register ("large-dialog", width * 2, height * 2);
851 }
852
853 if (g_ascii_isalpha (icon_name[0]))
854 {
855 if (g_str_has_prefix (icon_name, "dialog/"))
856 {
857 icon_name = &icon_name [strlen("dialog/")];
858 icon_size = icon_size_large_dialog;
859 }
860 else
861 icon_size = GTK_ICON_SIZE_BUTTON;
862 }
863 else if (g_ascii_isdigit (icon_name[0]))
864 {
865 guint i = 0;
866 while (icon_name[i])
867 if (icon_name[i++] == '/')
868 {
869 gchar* size = g_strndup (icon_name, i - 1);
870 icon_size = atoi (size);
871 /* Compatibility: map pixel to symbolic size */
872 if (icon_size == 16)
873 icon_size = GTK_ICON_SIZE_MENU;
874 g_free (size);
875 icon_name = &icon_name[i];
876 }
877 }
878
879 /* Render icon as a PNG at the desired size */
880 pixbuf = gtk_widget_render_icon (GTK_WIDGET (view), icon_name, icon_size, NULL);
881 if (!pixbuf)
882 pixbuf = gtk_widget_render_icon (GTK_WIDGET (view),
883 GTK_STOCK_MISSING_IMAGE, icon_size, NULL);
884 if (pixbuf)
885 {
886 gboolean success;
887 gchar* buffer;
888 gsize buffer_size;
889 gchar* encoded;
890 gchar* data_uri;
891
892 success = gdk_pixbuf_save_to_buffer (pixbuf, &buffer, &buffer_size, "png", NULL, NULL);
893 g_object_unref (pixbuf);
894 if (!success)
895 return;
896
897 encoded = g_base64_encode ((guchar*)buffer, buffer_size);
898 data_uri = g_strconcat ("data:image/png;base64,", encoded, NULL);
899 g_free (encoded);
900 #ifdef HAVE_WEBKIT2
901 GInputStream* stream = g_memory_input_stream_new_from_data (buffer, buffer_size, g_free);
902 webkit_uri_scheme_request_finish (request, stream, -1, "image/png");
903 g_object_unref (stream);
904 #else
905 g_free (buffer);
906 webkit_network_request_set_uri (request, data_uri);
907 #endif
908 g_free (data_uri);
909 return;
910 }
911 }
912}839}
913840
914static void841static void
@@ -1117,6 +1044,13 @@
1117#endif1044#endif
1118}1045}
11191046
1047static void
1048midori_view_error_try_again_clicked_cb (MidoriOops* oops,
1049 MidoriView* view)
1050{
1051 midori_view_reload (view, FALSE);
1052}
1053
1120static gboolean1054static gboolean
1121midori_view_display_error (MidoriView* view,1055midori_view_display_error (MidoriView* view,
1122 const gchar* uri,1056 const gchar* uri,
@@ -1132,65 +1066,15 @@
1132 void* web_frame)1066 void* web_frame)
1133#endif1067#endif
1134{1068{
1135 gchar* path = midori_paths_get_res_filename ("error.html");1069 if (uri == NULL)
1136 gchar* template;1070 uri = midori_tab_get_uri (MIDORI_TAB (view));
11371071 if (title == NULL)
1138 if (g_file_get_contents (path, &template, NULL, NULL))1072 title = view->title ? view->title : uri;
1139 {1073 const gchar* icon = error_icon ? error_icon : "dialog-error";
1140 gchar* title_escaped;1074 GtkWidget* error = midori_oops_new (uri, icon, title, message, description, suggestions, try_again);
1141 const gchar* icon;1075 g_signal_connect (error, "retried", G_CALLBACK (midori_view_error_try_again_clicked_cb), view);
1142 gchar* favicon;1076 midori_tab_set_widget (MIDORI_TAB (view), error);
1143 gchar* result;1077 return TRUE;
1144 gboolean is_main_frame;
1145
1146 #ifdef HAVE_WEBKIT2
1147 is_main_frame = TRUE;
1148 #else
1149 is_main_frame = web_frame && (webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view)) == web_frame);
1150 #endif
1151
1152 #if !GTK_CHECK_VERSION (3, 0, 0)
1153 /* g_object_get_valist: object class `GtkSettings' has no property named `gtk-button-images' */
1154 g_type_class_unref (g_type_class_ref (GTK_TYPE_BUTTON));
1155 #endif
1156
1157 GtkSettings* gtk_settings = gtk_widget_get_settings (view->web_view);
1158 gboolean show_button_images = gtk_settings != NULL
1159 && katze_object_get_boolean (gtk_settings, "gtk-button-images");
1160 if (uri == NULL)
1161 uri = midori_tab_get_uri (MIDORI_TAB (view));
1162 title_escaped = g_markup_escape_text (title ? title : view->title, -1);
1163 icon = katze_item_get_icon (view->item);
1164 favicon = icon && !g_str_has_prefix (icon, "stock://")
1165 ? g_strdup_printf ("<link rel=\"shortcut icon\" href=\"%s\" />", icon) : NULL;
1166 result = sokoke_replace_variables (template,
1167 "{dir}", gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL ?
1168 "rtl" : "ltr",
1169 "{title}", title_escaped,
1170 "{favicon}", katze_str_non_null (favicon),
1171 "{error_icon}", katze_str_non_null (error_icon),
1172 "{message}", message,
1173 "{description}", description,
1174 "{suggestions}", katze_str_non_null (suggestions),
1175 "{tryagain}", try_again,
1176 "{uri}", uri,
1177 "{hide-button-images}", show_button_images ? "" : "display:none",
1178 "{autofocus}", is_main_frame ? "autofocus=\"true\" " : "",
1179 NULL);
1180 g_free (favicon);
1181 g_free (title_escaped);
1182 g_free (template);
1183
1184 midori_view_set_html (view, result, uri, web_frame);
1185
1186 g_free (result);
1187 g_free (path);
1188
1189 return TRUE;
1190 }
1191 g_free (path);
1192
1193 return FALSE;
1194}1078}
11951079
1196static gboolean1080static gboolean
@@ -1252,7 +1136,7 @@
1252 midori_uri_parse_hostname(uri, NULL));1136 midori_uri_parse_hostname(uri, NULL));
1253 }1137 }
12541138
1255 result = midori_view_display_error (view, uri, "stock://dialog/network-error", title,1139 result = midori_view_display_error (view, uri, "network-error", title,
1256 message, error->message, NULL,1140 message, error->message, NULL,
1257 _("Try Again"), web_frame);1141 _("Try Again"), web_frame);
12581142
@@ -3672,18 +3556,18 @@
3672 (GCallback)midori_view_web_view_crashed_cb, view);3556 (GCallback)midori_view_web_view_crashed_cb, view);
3673 view->scrolled_window = view->web_view;3557 view->scrolled_window = view->web_view;
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));
3675 webkit_web_context_register_uri_scheme (context,
3676 "res", midori_view_uri_scheme_res, NULL, NULL);
3677 webkit_web_context_register_uri_scheme (context,
3678 "stock", midori_view_uri_scheme_res, NULL, NULL);
3679 g_signal_connect (context, "download-started",3559 g_signal_connect (context, "download-started",
3680 G_CALLBACK (midori_view_download_started_cb), view);3560 G_CALLBACK (midori_view_download_started_cb), view);
3681 #endif3561 #endif
36823562
3563 GtkWidget* content = gtk_vbox_new (FALSE, 0);
3564 gtk_widget_show (content);
3565 gtk_box_pack_start (GTK_BOX (content), view->scrolled_window, TRUE, TRUE, 0);
3566
3683 #if GTK_CHECK_VERSION(3, 2, 0)3567 #if GTK_CHECK_VERSION(3, 2, 0)
3684 view->overlay = gtk_overlay_new ();3568 view->overlay = gtk_overlay_new ();
3685 gtk_widget_show (view->overlay);3569 gtk_widget_show (view->overlay);
3686 gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window);3570 gtk_container_add (GTK_CONTAINER (view->overlay), content);
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);
36883572
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 */
@@ -3708,7 +3592,7 @@
3708 view->overlay_find);3592 view->overlay_find);
3709 gtk_widget_set_no_show_all (view->overlay_find, TRUE);3593 gtk_widget_set_no_show_all (view->overlay_find, TRUE);
3710 #else3594 #else
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);
3712 #endif3596 #endif
37133597
3714 #ifndef HAVE_WEBKIT23598 #ifndef HAVE_WEBKIT2
@@ -3884,6 +3768,8 @@
38843768
3885 if (handled)3769 if (handled)
3886 {3770 {
3771 if (midori_tab_get_widget (MIDORI_TAB (view)) != NULL)
3772 return;
3887 midori_tab_set_uri (MIDORI_TAB (view), uri);3773 midori_tab_set_uri (MIDORI_TAB (view), uri);
3888 midori_tab_set_special (MIDORI_TAB (view), TRUE);3774 midori_tab_set_special (MIDORI_TAB (view), TRUE);
3889 katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_UNDELAYED);3775 katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_UNDELAYED);
@@ -3896,7 +3782,7 @@
3896 midori_tab_set_uri (MIDORI_TAB (view), uri);3782 midori_tab_set_uri (MIDORI_TAB (view), uri);
3897 midori_tab_set_special (MIDORI_TAB (view), TRUE);3783 midori_tab_set_special (MIDORI_TAB (view), TRUE);
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);
3899 midori_view_display_error (view, NULL, "stock://dialog/network-idle", NULL,3785 midori_view_display_error (view, NULL, "network-idle", NULL,
3900 _("Page loading delayed:"),3786 _("Page loading delayed:"),
3901 _("Loading delayed either due to a recent crash or startup preferences."),3787 _("Loading delayed either due to a recent crash or startup preferences."),
3902 NULL,3788 NULL,
39033789
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2014-04-28 16:32:22 +0000
+++ po/POTFILES.in 2015-03-28 17:27:15 +0000
@@ -10,6 +10,7 @@
10midori/midori-database.vala10midori/midori-database.vala
11midori/midori-extension.c11midori/midori-extension.c
12midori/midori-locationaction.c12midori/midori-locationaction.c
13midori/midori-oops.vala
13midori/midori-panel.c14midori/midori-panel.c
14midori/midori-settings.vala15midori/midori-settings.vala
15midori/midori-websettings.c16midori/midori-websettings.c

Subscribers

People subscribed via source and target branches

to all changes: