Merge lp:~midori/midori/webKitTwoOnly into lp:midori

Proposed by Christian Dywan on 2016-02-07
Status: Work in progress
Proposed branch: lp:~midori/midori/webKitTwoOnly
Merge into: lp:midori
Diff against target: 6316 lines (+248/-3830) (has conflicts)
43 files modified
CMakeLists.txt (+19/-54)
data/gtk3.css (+1/-6)
extensions/CMakeLists.txt (+9/-11)
extensions/about.vala (+0/-4)
extensions/adblock/extension.vala (+26/-60)
extensions/adblock/subscriptions.vala (+0/-34)
extensions/addons.c (+3/-3)
extensions/colorful-tabs.c (+0/-5)
extensions/cookie-manager/cookie-manager.c (+2/-8)
extensions/external-download-manager.vala (+0/-12)
extensions/feed-panel/feed-panel.c (+0/-33)
extensions/feed-panel/katze-net.c (+0/-117)
extensions/notes.vala (+0/-5)
extensions/open-with.vala (+0/-28)
extensions/transfers.vala (+0/-22)
katze/katze-item.c (+0/-27)
katze/katze.h (+1/-6)
katze/midori-paths.vala (+6/-27)
katze/midori-uri.vala (+0/-6)
midori/main.c (+3/-15)
midori/midori-browser.c (+0/-402)
midori/midori-browser.h (+0/-4)
midori/midori-contextaction.vala (+0/-2)
midori/midori-download.vala (+0/-191)
midori/midori-frontend.c (+0/-3)
midori/midori-locationaction.c (+26/-40)
midori/midori-preferences.c (+0/-29)
midori/midori-privatedata.c (+0/-39)
midori/midori-searchaction.c (+1/-118)
midori/midori-session.c (+5/-271)
midori/midori-settings.vala (+36/-33)
midori/midori-speeddial.vala (+0/-83)
midori/midori-tab.vala (+5/-46)
midori/midori-view.c (+74/-1650)
midori/midori-websettings.c (+31/-301)
midori/midori-websettings.h (+0/-9)
midori/sokoke.c (+0/-39)
tests/actions.vala (+0/-28)
tests/browser.c (+0/-7)
tests/download.vala (+0/-24)
tests/extensions.c (+0/-4)
tests/properties.c (+0/-5)
tests/tab.vala (+0/-19)
Text conflict in midori/main.c
To merge this branch: bzr merge lp:~midori/midori/webKitTwoOnly
Reviewer Review Type Date Requested Status
Midori Devs 2016-02-07 Pending
Review via email: mp+285295@code.launchpad.net

Commit message

Drop non-WebKit2 code paths

To post a comment you must log in.
lp:~midori/midori/webKitTwoOnly updated on 2016-02-17
7102. By gue5t <email address hidden> on 2016-02-10

support user-stylesheet-uri with wk2 by adding a WebKit.UserContentManager to Midori.Settings

7103. By Christian Dywan on 2016-02-17

Use WebExtension without the bindings

gue5t gue5t (gue5t) wrote :

With these last changes, adblock works, but *only* if I install Midori after building. Running from the uninstalled build directory results in adblock silently not blocking ads.

lp:~midori/midori/webKitTwoOnly updated on 2016-09-05
7104. By gue5t <email address hidden> on 2016-02-22

Fix four MidoriView/MidoriTab bugs causing popup window opening to segfault or misbehave

Before these changes, clicking the first green arrow on http://javascript.info/tutorial/popup-windows results in a segfault, instead of the expected popup.

There were four bugs here:

1. The constructor for Midori.Tab was mistakenly setting the nonexistent "related" property instead of the "related-view" property.
2. The signature of webkit_web_view_create_web_view_cb did not match the signature of the "create" signal for a WK2 WebKitWebView, causing a WebKitNavigationAction to be used as a MidoriView.
3. The function called when a popup is ready to be shown was asking for the "width" and "height" properties used by WebKitWindowProperties in WK1 rather than the "geometry" property used in WK2.

(Fixing these three resulted in no more crashes, but popups would be empty instead of loading the expected URIs.)

4. An old (WK1, touched in r5389 and r842, originally in 2009) workaround was unconditionally doing "web_view.load_uri ("")" which cancelled the loading of the intended URI for popups.

After the other fixes, removing this workaround results in everything working as expected.

7105. By Christian Dywan on 2016-03-13

Merge lp:midori

7106. By Christian Dywan on 2016-03-21

Use load-failed-with-tls-errors to handle certificate errors

7107. By gue5t <email address hidden> on 2016-09-05

fix theming issues under GTK+ 3.20

7108. By gue5t <email address hidden> on 2016-09-05

partially fix LocationAction dropdown under Wayland

Unmerged revisions

7108. By gue5t <email address hidden> on 2016-09-05

partially fix LocationAction dropdown under Wayland

7107. By gue5t <email address hidden> on 2016-09-05

fix theming issues under GTK+ 3.20

7106. By Christian Dywan on 2016-03-21

Use load-failed-with-tls-errors to handle certificate errors

7105. By Christian Dywan on 2016-03-13

Merge lp:midori

7104. By gue5t <email address hidden> on 2016-02-22

Fix four MidoriView/MidoriTab bugs causing popup window opening to segfault or misbehave

Before these changes, clicking the first green arrow on http://javascript.info/tutorial/popup-windows results in a segfault, instead of the expected popup.

There were four bugs here:

1. The constructor for Midori.Tab was mistakenly setting the nonexistent "related" property instead of the "related-view" property.
2. The signature of webkit_web_view_create_web_view_cb did not match the signature of the "create" signal for a WK2 WebKitWebView, causing a WebKitNavigationAction to be used as a MidoriView.
3. The function called when a popup is ready to be shown was asking for the "width" and "height" properties used by WebKitWindowProperties in WK1 rather than the "geometry" property used in WK2.

(Fixing these three resulted in no more crashes, but popups would be empty instead of loading the expected URIs.)

4. An old (WK1, touched in r5389 and r842, originally in 2009) workaround was unconditionally doing "web_view.load_uri ("")" which cancelled the loading of the intended URI for popups.

After the other fixes, removing this workaround results in everything working as expected.

7103. By Christian Dywan on 2016-02-17

Use WebExtension without the bindings

7102. By gue5t <email address hidden> on 2016-02-10

support user-stylesheet-uri with wk2 by adding a WebKit.UserContentManager to Midori.Settings

7101. By Christian Dywan on 2016-02-07

Drop non-WebKit2 code paths

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-02-04 19:54:52 +0000
3+++ CMakeLists.txt 2016-09-20 20:57:01 +0000
4@@ -112,13 +112,13 @@
5 sqlite3>=3.6.19
6 gmodule-2.0
7 gio-2.0>=2.32.3
8- libsoup-gnome-2.4>=2.37.1
9+ libsoup-2.4>=2.42.0
10 )
11 add_definitions("-DHAVE_LIBXML")
12 add_definitions("-DGIO_VERSION=\"${DEPS_gio-2.0_VERSION}\"")
13-add_definitions("-DLIBSOUP_VERSION=\"${DEPS_libsoup-gnome-2.4_VERSION}\"")
14-set(PKGS posix linux libxml-2.0 sqlite3 gmodule-2.0 gio-2.0 libsoup-2.4)
15-if (${DEPS_libsoup-gnome-2.4_VERSION} VERSION_GREATER "2.40.0")
16+add_definitions("-DLIBSOUP_VERSION=\"${DEPS_libsoup-2.4_VERSION}\"")
17+set(PKGS posix linux libxml-2.0 sqlite3 gmodule-2.0 gio-2.0 libsoup-2.4 gtk+-3.0)
18+if (${DEPS_libsoup-2.4_VERSION} VERSION_GREATER "2.40.0")
19 # valac 0.16 didn't have the bindings yet
20 # For consistency we need to ensure C code makes the same assumptions
21 if (${VALA_VERSION} VERSION_GREATER "0.17.0")
22@@ -126,7 +126,7 @@
23 set(VALAFLAGS ${VALAFLAGS} -D HAVE_LIBSOUP_2_40_0)
24 endif ()
25 endif ()
26-if (${DEPS_libsoup-gnome-2.4_VERSION} VERSION_GREATER "2.48.0")
27+if (${DEPS_libsoup-2.4_VERSION} VERSION_GREATER "2.48.0")
28 add_definitions("-DHAVE_LIBSOUP_2_48_0")
29 set(VALAFLAGS ${VALAFLAGS} -D HAVE_LIBSOUP_2_48_0)
30 endif ()
31@@ -142,21 +142,14 @@
32 set(PKGS ${PKGS} libnotify)
33 endif ()
34
35-option(USE_GTK3 "Use GTK+3" OFF)
36-option(HALF_BRO_INCOM_WEBKIT2 "Serve as a guniea pig" OFF)
37 option(USE_ZEITGEIST "Zeitgeist history integration" ON)
38 option(USE_GRANITE "Fancy notebook and pop-overs" OFF)
39 option(USE_APIDOCS "API documentation" OFF)
40 option(USE_GIR "Generate GObject Introspection bindings" OFF)
41 option(EXTRA_WARNINGS "Additional compiler warnings" OFF)
42
43-# GTK+3 is implied here, whether set or not
44-if (USE_GRANITE OR HALF_BRO_INCOM_WEBKIT2)
45- set(USE_GTK3 ON)
46-endif ()
47-
48 if (USE_GRANITE)
49- pkg_check_modules(GRANITE granite>=0.2)
50+ pkg_check_modules(GRANITE REQUIRED granite>=0.2)
51 set(OPTS_INCLUDE_DIRS "${OPTS_INCLUDE_DIRS};${GRANITE_INCLUDE_DIRS}")
52 set(OPTS_LIBRARIES "${OPTS_LIBRARIES};${GRANITE_LIBRARIES}")
53 add_definitions("-DHAVE_GRANITE")
54@@ -178,53 +171,25 @@
55 if (WIN32)
56 add_definitions("-DGCR_VERSION=\"No\"")
57 else ()
58- if (USE_GTK3)
59- pkg_check_modules(GCR REQUIRED gcr-3>=2.32)
60- else ()
61- pkg_check_modules(GCR REQUIRED gcr-base-3>=2.32)
62- endif ()
63+ pkg_check_modules(GCR REQUIRED gcr-3>=2.32)
64 add_definitions("-DGCR_VERSION=\"${GCR_VERSION}\"")
65 add_definitions("-DHAVE_GCR")
66 set(OPTS_INCLUDE_DIRS ${OPTS_INCLUDE_DIRS} ${GCR_INCLUDE_DIRS})
67 set(OPTS_LIBRARIES ${OPTS_LIBRARIES} ${GCR_LIBRARIES})
68 endif ()
69
70-if (HALF_BRO_INCOM_WEBKIT2)
71- pkg_check_modules(DEPS_GTK REQUIRED
72- gtk+-3.0>=3.10.0
73- webkit2gtk-4.0>=2.3.91
74- )
75- add_definitions("-DHAVE_WEBKIT2")
76- add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-3.0_VERSION}\"")
77- add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkit2gtk-4.0_VERSION}\"")
78- set(PKGS ${PKGS} gtk+-3.0)
79- # set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkit2gtk-web-extension-4.0.vapi")
80- set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkit2gtk-4.0.vapi")
81- set(VALAFLAGS ${VALAFLAGS} -D HAVE_GTK3)
82- set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2)
83- set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2_3_91)
84-elseif (USE_GTK3)
85- pkg_check_modules(DEPS_GTK REQUIRED
86- gtk+-3.0>=3.10.0
87- webkitgtk-3.0>=1.8.1
88- javascriptcoregtk-3.0
89- )
90- add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-3.0_VERSION}\"")
91- add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkitgtk-3.0_VERSION}\"")
92- set(PKGS ${PKGS} gtk+-3.0)
93- set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkitgtk-3.0.vapi")
94- set(VALAFLAGS ${VALAFLAGS} -D HAVE_GTK3)
95-else ()
96- pkg_check_modules(DEPS_GTK REQUIRED
97- gtk+-2.0>=2.24.0
98- webkit-1.0>=1.8.1
99- javascriptcoregtk-1.0
100- )
101- add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-2.0_VERSION}\"")
102- add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkit-1.0_VERSION}\"")
103- set(PKGS ${PKGS} gtk+-2.0)
104- set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkitgtk-3.0.vapi")
105-endif ()
106+pkg_check_modules(DEPS_GTK REQUIRED
107+ gtk+-3.0>=3.10.0
108+ webkit2gtk-4.0>=2.3.91
109+ )
110+add_definitions("-DHAVE_WEBKIT2")
111+add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-3.0_VERSION}\"")
112+add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkit2gtk-4.0_VERSION}\"")
113+# set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkit2gtk-web-extension-4.0.vapi")
114+set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkit2gtk-4.0.vapi")
115+set(VALAFLAGS ${VALAFLAGS} -D HAVE_GTK3)
116+set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2)
117+set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2_3_91)
118 set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/katze/katze.vapi")
119
120 # dh_translations detects this if there's no variable used
121
122=== modified file 'data/gtk3.css'
123--- data/gtk3.css 2014-01-13 22:55:08 +0000
124+++ data/gtk3.css 2016-09-20 20:57:01 +0000
125@@ -1,9 +1,4 @@
126 .notebook tab .button {
127- -GtkButton-default-border: 0;
128- -GtkButton-default-outside-border: 0;
129- -GtkButton-inner-border: 0;
130- -GtkWidget-focus-line-width: 0;
131- -GtkWidget-focus-padding: 0;
132 padding: 0;
133 border-width: 1px 1px 0 0;
134 }
135@@ -23,7 +18,7 @@
136 /* Kill grey backround on inactive buttons */
137 GtkDrawingArea,
138 GtkImage,
139-GtkImage:insensitive,
140+GtkImage:disabled,
141 GtkImage:selected {
142 background-color: @transparent;
143 }
144
145=== modified file 'extensions/CMakeLists.txt'
146--- extensions/CMakeLists.txt 2015-04-19 14:06:12 +0000
147+++ extensions/CMakeLists.txt 2016-09-20 20:57:01 +0000
148@@ -13,17 +13,15 @@
149 "${CMAKE_BINARY_DIR}/midori"
150 )
151 file(GLOB EXTENSIONS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
152-if (HALF_BRO_INCOM_WEBKIT2)
153- list(REMOVE_ITEM EXTENSIONS
154- "cookie-permissions"
155- "addons.c"
156- "formhistory"
157- "external-download-manager.vala"
158- "nojs"
159- "nsplugin-manager.vala"
160- "tabs2one.c"
161- )
162-endif ()
163+list(REMOVE_ITEM EXTENSIONS
164+ "cookie-permissions"
165+ "addons.c"
166+ "formhistory"
167+ "external-download-manager.vala"
168+ "nojs"
169+ "nsplugin-manager.vala"
170+ "tabs2one.c"
171+ )
172
173 # FIXME: re-enable webmedia extension
174 # once we have working notifications on win
175
176=== modified file 'extensions/about.vala'
177--- extensions/about.vala 2015-06-11 22:33:48 +0000
178+++ extensions/about.vala 2016-09-20 20:57:01 +0000
179@@ -15,11 +15,7 @@
180 public abstract string uri { get; set; }
181 public abstract void get_contents (Midori.View view, string uri);
182 protected void load_html (Midori.View view, string content, string uri) {
183- #if HAVE_WEBKIT2
184 view.web_view.load_html (content, uri);
185- #else
186- view.web_view.load_html_string (content, uri);
187- #endif
188 }
189 }
190
191
192=== modified file 'extensions/adblock/extension.vala'
193--- extensions/adblock/extension.vala 2016-02-01 19:48:47 +0000
194+++ extensions/adblock/extension.vala 2016-09-20 20:57:01 +0000
195@@ -55,22 +55,20 @@
196 internal string? js_hider_function_body;
197 #endif
198
199-#if HAVE_WEBKIT2
200-#if !HAVE_WEBKIT2_3_91
201- public Extension.WebExtension (WebKit.WebExtension web_extension) {
202- init ();
203- web_extension.page_created.connect (page_created);
204- }
205-
206- void page_created (WebKit.WebPage web_page) {
207- web_page.send_request.connect (send_request);
208- }
209-
210- bool send_request (WebKit.WebPage web_page, WebKit.URIRequest request, WebKit.URIResponse? redirected_response) {
211- return request_handled (request.uri, web_page.uri);
212- }
213-#endif
214-#endif
215+ public Extension.WebExtension (GLib.Object extension) {
216+ Midori.Paths.init_exec_path ({"/usr/share"});
217+ extension.connect ("signal::page-created", page_created, null);
218+ }
219+
220+ void page_created (GLib.Object page) {
221+ page.connect ("signal::send-request", send_request, page);
222+ }
223+
224+ bool send_request (WebKit.URIRequest request, WebKit.URIResponse? redirected_response, GLib.Object page) {
225+ string uri;
226+ page.get ("uri", out uri);
227+ return request_handled (request.uri, uri);
228+ }
229
230 public Extension () {
231 GLib.Object (name: _("Advertisement blocker"),
232@@ -87,7 +85,6 @@
233 }
234
235 void extension_activated (Midori.App app) {
236-#if HAVE_WEBKIT2
237 string cache_dir = Environment.get_user_cache_dir ();
238 string wk2path = Path.build_path (Path.DIR_SEPARATOR_S, cache_dir, "wk2ext");
239 Midori.Paths.mkdir_with_parents (wk2path);
240@@ -101,7 +98,6 @@
241 } catch (Error error) {
242 critical ("Failed to create WebKit2 link: %s", error.message);
243 }
244-#endif
245 init ();
246 foreach (var browser in app.get_browsers ())
247 browser_added (browser);
248@@ -136,17 +132,11 @@
249
250 void tab_added (Midori.View view) {
251 view.navigation_requested.connect (navigation_requested);
252-#if !HAVE_WEBKIT2
253- view.web_view.resource_request_starting.connect (resource_requested);
254-#endif
255 view.notify["load-status"].connect (load_status_changed);
256 view.context_menu.connect (context_menu);
257 }
258
259 void tab_removed (Midori.View view) {
260-#if !HAVE_WEBKIT2
261- view.web_view.resource_request_starting.disconnect (resource_requested);
262-#endif
263 view.navigation_requested.disconnect (navigation_requested);
264 view.notify["load-status"].disconnect (load_status_changed);
265 view.context_menu.disconnect (context_menu);
266@@ -179,23 +169,6 @@
267 menu.add (action);
268 }
269
270-#if !HAVE_WEBKIT2
271- void resource_requested (WebKit.WebView web_view, WebKit.WebFrame frame,
272- WebKit.WebResource resource, WebKit.NetworkRequest request, WebKit.NetworkResponse? response) {
273-
274- WebKit.WebFrame main_frame = web_view.get_main_frame ();
275-
276- WebKit.WebDataSource? ds = main_frame.get_provisional_data_source ();
277- WebKit.NetworkRequest? main_frame_request = (ds != null) ? ds.get_request () : null;
278- string? main_frame_uri = (main_frame_request != null) ? main_frame_request.uri : null;
279-
280- bool is_main_frame_request = (frame == main_frame) && (request.uri == main_frame_uri);
281- if (!is_main_frame_request && request_handled (request.uri, web_view.uri)) {
282- request.set_uri ("about:blank");
283- }
284- }
285-#endif
286-
287 bool navigation_requested (Midori.Tab tab, string uri) {
288 if (uri.has_prefix ("abp:")) {
289 string parsed_uri = parse_subscription_uri (uri);
290@@ -346,7 +319,7 @@
291
292 internal void init () {
293 hider_selectors = new StringBuilder ();
294- load_config ();
295+ config = load_config ();
296 manager = new SubscriptionManager (config);
297 status_icon = new StatusIcon (config, manager);
298 foreach (unowned Subscription sub in config) {
299@@ -374,29 +347,26 @@
300 hider_selectors = new StringBuilder ();
301 }
302
303- void load_config () {
304-#if HAVE_WEBKIT2
305+ static Config load_config () {
306 string config_dir = Path.build_filename (GLib.Environment.get_user_config_dir (), PACKAGE_NAME, "extensions", "libadblock." + GLib.Module.SUFFIX);
307 Midori.Paths.mkdir_with_parents (config_dir);
308-#else
309- string config_dir = Midori.Paths.get_extension_config_dir ("adblock");
310-#endif
311 string presets = Midori.Paths.get_extension_preset_filename ("adblock", "config");
312 string filename = Path.build_filename (config_dir, "config");
313- config = new Config (filename, presets);
314+ var config = new Config (filename, presets);
315 string custom_list = GLib.Path.build_filename (config_dir, "custom.list");
316 try {
317- custom = new Subscription (Filename.to_uri (custom_list, null));
318+ var custom = new Subscription (Filename.to_uri (custom_list, null));
319 custom.mutable = false;
320 custom.title = _("Custom");
321 config.add (custom);
322 } catch (Error error) {
323- custom = null;
324 warning ("Failed to add custom list %s: %s", custom_list, error.message);
325 }
326+ return config;
327 }
328
329- public Adblock.Directive get_directive_for_uri (string request_uri, string page_uri) {
330+ static Adblock.Directive get_directive_for_uri (string request_uri, string page_uri) {
331+ var config = load_config ();
332 if (!config.enabled)
333 return Directive.ALLOW;
334
335@@ -422,11 +392,11 @@
336 if (directive == null)
337 directive = Directive.ALLOW;
338 else if (directive == Directive.BLOCK) {
339- status_icon.set_state (State.BLOCKED);
340+ // FIXME: status_icon.set_state (State.BLOCKED);
341 #if USE_CSS_SELECTOR_FOR_BLOCKED_RESOURCES
342- hider_selectors.append ("img[src*=\"%s\"] , iframe[src*=\"%s\"] , ".printf (request_uri, request_uri));
343+ // FIXME: hider_selectors.append ("img[src*=\"%s\"] , iframe[src*=\"%s\"] , ".printf (request_uri, request_uri));
344 #else
345- hider_selectors.append (" uris.push ('%s');\n".printf (request_uri));
346+ // FIXME: hider_selectors.append (" uris.push ('%s');\n".printf (request_uri));
347 #endif
348 }
349 return directive;
350@@ -482,14 +452,10 @@
351 }
352 }
353
354-#if HAVE_WEBKIT2
355-#if !HAVE_WEBKIT2_3_91
356 Adblock.Extension? filter;
357-public static void webkit_web_extension_initialize (WebKit.WebExtension web_extension) {
358- filter = new Adblock.Extension.WebExtension (web_extension);
359+public static void webkit_web_extension_initialize (GLib.Object extension) {
360+ filter = new Adblock.Extension.WebExtension (extension);
361 }
362-#endif
363-#endif
364
365 public Midori.Extension extension_init () {
366 return new Adblock.Extension ();
367
368=== modified file 'extensions/adblock/subscriptions.vala'
369--- extensions/adblock/subscriptions.vala 2015-06-12 21:43:40 +0000
370+++ extensions/adblock/subscriptions.vala 2016-09-20 20:57:01 +0000
371@@ -40,9 +40,6 @@
372 public Options optslist;
373 public Whitelist whitelist;
374 public Element element;
375-#if !HAVE_WEBKIT2
376- WebKit.Download? download;
377-#endif
378
379 public Subscription (string uri) {
380 debug_parse = "adblock:parse" in (Environment.get_variable ("MIDORI_DEBUG") ?? "");
381@@ -292,20 +289,6 @@
382 }
383 }
384
385-#if !HAVE_WEBKIT2
386- void download_status (ParamSpec pspec) {
387- if (download.get_status () != WebKit.DownloadStatus.FINISHED)
388- return;
389-
390- download = null;
391- try {
392- parse ();
393- } catch (Error error) {
394- warning ("Error parsing %s: %s", uri, error.message);
395- }
396- }
397-#endif
398-
399 public void parse () throws Error
400 {
401 if (!active)
402@@ -329,24 +312,7 @@
403 try {
404 stream = new DataInputStream (filter_file.read ());
405 } catch (IOError.NOT_FOUND exist_error) {
406-#if HAVE_WEBKIT2
407 /* TODO */
408-#else
409- /* Don't bother trying to download local files */
410- if (!uri.has_prefix ("file://")) {
411- if (download != null)
412- return;
413-
414- string destination_uri = Filename.to_uri (path, null);
415- debug ("Fetching %s to %s now", uri, destination_uri);
416- download = new WebKit.Download (new WebKit.NetworkRequest (uri));
417- if (!Midori.Download.has_enough_space (download, destination_uri, true))
418- throw new FileError.EXIST ("Can't download to \"%s\"", path);
419- download.destination_uri = destination_uri;
420- download.notify["status"].connect (download_status);
421- download.start ();
422- }
423-#endif
424 return;
425 }
426
427
428=== modified file 'extensions/addons.c'
429--- extensions/addons.c 2015-04-15 22:51:01 +0000
430+++ extensions/addons.c 2016-09-20 20:57:01 +0000
431@@ -1599,7 +1599,7 @@
432 MidoriApp* app = midori_extension_get_app (extension);
433 MidoriWebSettings* settings = katze_object_get_object (app, "settings");
434 gchar* data = addons_generate_global_stylesheet (extension);
435- midori_web_settings_add_style (settings, "addons", data);
436+ midori_settings_add_style (MIDORI_SETTINGS (settings), "addons", data);
437 g_free (data);
438 g_object_unref (settings);
439 }
440@@ -1738,7 +1738,7 @@
441
442 addons_disable_monitors (extension);
443 addons_save_settings (NULL, extension);
444- midori_web_settings_remove_style (settings, "addons");
445+ midori_settings_remove_style (MIDORI_SETTINGS (settings), "addons");
446
447 browsers = katze_object_get_object (app, "browsers");
448 KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
449@@ -1860,7 +1860,7 @@
450 addons_update_elements (extension, ADDONS_USER_SCRIPTS);
451 addons_monitor_directories (extension, ADDONS_USER_SCRIPTS);
452 data = addons_generate_global_stylesheet (extension);
453- midori_web_settings_add_style (settings, "addons", data);
454+ midori_settings_add_style (MIDORI_SETTINGS (settings), "addons", data);
455
456 KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
457 addons_app_add_browser_cb (app, browser, extension);
458
459=== modified file 'extensions/colorful-tabs.c'
460--- extensions/colorful-tabs.c 2016-02-24 21:45:09 +0000
461+++ extensions/colorful-tabs.c 2016-09-20 20:57:01 +0000
462@@ -244,11 +244,6 @@
463 void
464 extension_test (void)
465 {
466- #ifndef HAVE_WEBKIT2
467- g_object_set_data (G_OBJECT (webkit_get_default_session ()),
468- "midori-session-initialized", (void*)1);
469- #endif
470-
471 /* TODO: Add test which uses favicon codepath */
472
473 g_test_add_func ("/extensions/colorful_tabs/hostname_colour", test_colour_for_hostname);
474
475=== modified file 'extensions/cookie-manager/cookie-manager.c'
476--- extensions/cookie-manager/cookie-manager.c 2013-07-29 21:05:02 +0000
477+++ extensions/cookie-manager/cookie-manager.c 2016-09-20 20:57:01 +0000
478@@ -12,7 +12,7 @@
479 #include "config.h"
480 #include <midori/midori.h>
481 #include "katze/katze.h"
482-#include <libsoup/soup-cookie-jar-sqlite.h>
483+#include <libsoup/soup-cookie-jar-db.h>
484
485 #include "cookie-manager.h"
486 #include "cookie-manager-page.h"
487@@ -280,15 +280,9 @@
488 COOKIE_MANAGER_COL_NAME, GTK_SORT_ASCENDING);
489
490 /* setup soup */
491-#ifdef HAVE_WEBKIT2
492 gchar *filename = midori_paths_get_config_filename_for_writing ("cookies.db");
493- priv->jar = soup_cookie_jar_sqlite_new (filename, FALSE);
494+ priv->jar = soup_cookie_jar_db_new (filename, FALSE);
495 g_free(filename);
496-#else
497- SoupSession *session = webkit_get_default_session();
498- priv->jar = SOUP_COOKIE_JAR(soup_session_get_feature(session, soup_cookie_jar_get_type()));
499- g_object_ref(priv->jar);
500-#endif
501 g_signal_connect(priv->jar, "changed", G_CALLBACK(cookie_manager_jar_changed_cb), self);
502
503 cookie_manager_refresh_store(self);
504
505=== modified file 'extensions/external-download-manager.vala'
506--- extensions/external-download-manager.vala 2015-08-20 06:18:50 +0000
507+++ extensions/external-download-manager.vala 2016-09-20 20:57:01 +0000
508@@ -36,16 +36,8 @@
509 if (download_type == Midori.DownloadType.SAVE) {
510 var dlReq = new DownloadRequest ();
511
512- #if HAVE_WEBKIT2
513 dlReq.uri = download.request.get_uri ();
514 weak Soup.MessageHeaders headers = download.request.get_http_headers ();
515- #else
516- dlReq.uri = download.get_uri ();
517- var request = download.get_network_request ();
518- var message = request.get_message ();
519- weak Soup.MessageHeaders headers = message.request_headers;
520- #endif
521-
522 dlReq.auth = headers.get ("Authorization");
523 dlReq.referer = headers.get ("Referer");
524 dlReq.cookie_header = this.cookie_jar.get_cookies (new Soup.URI (dlReq.uri), true);
525@@ -101,11 +93,7 @@
526 }
527
528 construct {
529- #if HAVE_WEBKIT2
530 var session= new Session ();
531- #else
532- var session = WebKit.get_default_session ();
533- #endif
534 this.cookie_jar = session.get_feature (typeof (Soup.CookieJar)) as Soup.CookieJar;
535 }
536 }
537
538=== modified file 'extensions/feed-panel/feed-panel.c'
539--- extensions/feed-panel/feed-panel.c 2013-10-25 21:49:56 +0000
540+++ extensions/feed-panel/feed-panel.c 2016-09-20 20:57:01 +0000
541@@ -589,31 +589,6 @@
542 return MIDORI_EVENT_CONTEXT_MENU (event);
543 }
544
545-#ifndef HAVE_WEBKIT2
546-static gboolean
547-webview_navigation_request_cb (WebKitWebView* web_view,
548- WebKitWebFrame* frame,
549- WebKitNetworkRequest* request,
550- WebKitWebNavigationAction* navigation_action,
551- WebKitWebPolicyDecision* policy_decision,
552- FeedPanel* panel)
553-{
554- if (webkit_web_navigation_action_get_reason (navigation_action) ==
555- WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED)
556- {
557- MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (panel));
558- const gchar* uri = webkit_network_request_get_uri (request);
559- GtkWidget* view = midori_browser_add_uri (browser, uri);
560- midori_browser_set_current_tab (browser, view);
561- webkit_web_policy_decision_ignore (policy_decision);
562-
563- return TRUE;
564- }
565-
566- return FALSE;
567-}
568-#endif
569-
570 static const gchar*
571 feed_panel_get_label (MidoriViewable* viewable)
572 {
573@@ -800,12 +775,8 @@
574 NULL);
575 gtk_widget_show (treeview);
576
577-#if GTK_CHECK_VERSION(3,0,0)
578 font_desc = (PangoFontDescription*)gtk_style_context_get_font (
579 gtk_widget_get_style_context (treeview), GTK_STATE_FLAG_NORMAL);
580-#else
581- font_desc = treeview->style->font_desc;
582-#endif
583 family = pango_font_description_get_family (font_desc);
584 size = pango_font_description_get_size (font_desc) / PANGO_SCALE;
585 settings = midori_web_settings_new ();
586@@ -814,10 +785,6 @@
587 webview = midori_view_new_with_item (NULL, settings);
588 gtk_widget_set_size_request (webview, -1, 50);
589 g_object_connect (midori_tab_get_web_view (MIDORI_TAB (webview)),
590- #ifndef HAVE_WEBKIT2
591- "signal::navigation-policy-decision-requested",
592- webview_navigation_request_cb, panel,
593- #endif
594 "signal::button-press-event",
595 webview_button_press_event_cb, NULL,
596 "signal::button-release-event",
597
598=== modified file 'extensions/feed-panel/katze-net.c'
599--- extensions/feed-panel/katze-net.c 2013-08-02 17:42:29 +0000
600+++ extensions/feed-panel/katze-net.c 2016-09-20 20:57:01 +0000
601@@ -66,85 +66,6 @@
602 KatzeNetRequest* request;
603 } KatzeNetPriv;
604
605-#ifndef HAVE_WEBKIT2
606-static void
607-katze_net_priv_free (KatzeNetPriv* priv)
608-{
609- KatzeNetRequest* request = priv->request;
610- g_free (request->uri);
611- g_free (request->mime_type);
612- g_free (request->data);
613- g_slice_free (KatzeNetRequest, request);
614- g_slice_free (KatzeNetPriv, priv);
615-}
616-
617-static void
618-katze_net_got_body_cb (SoupMessage* msg,
619- KatzeNetPriv* priv);
620-
621-static void
622-katze_net_got_headers_cb (SoupMessage* msg,
623- KatzeNetPriv* priv)
624-{
625- KatzeNetRequest* request = priv->request;
626-
627- switch (msg->status_code)
628- {
629- case 200:
630- request->status = KATZE_NET_VERIFIED;
631- break;
632- case 301:
633- request->status = KATZE_NET_MOVED;
634- break;
635- default:
636- request->status = KATZE_NET_NOT_FOUND;
637- }
638-
639- if (!priv->status_cb (request, priv->user_data))
640- {
641- g_signal_handlers_disconnect_by_func (msg, katze_net_got_headers_cb, priv);
642- g_signal_handlers_disconnect_by_func (msg, katze_net_got_body_cb, priv);
643- soup_session_cancel_message (webkit_get_default_session (), msg, 1);
644- }
645-}
646-
647-static void
648-katze_net_got_body_cb (SoupMessage* msg,
649- KatzeNetPriv* priv)
650-{
651- KatzeNetRequest* request = priv->request;
652-
653- if (msg->response_body->length > 0)
654- {
655- request->data = g_memdup (msg->response_body->data,
656- msg->response_body->length);
657- request->length = msg->response_body->length;
658- }
659-
660- priv->transfer_cb (request, priv->user_data);
661-}
662-
663-static void
664-katze_net_finished_cb (SoupMessage* msg,
665- KatzeNetPriv* priv)
666-{
667- katze_net_priv_free (priv);
668-}
669-
670-static gboolean
671-katze_net_default_cb (KatzeNetPriv* priv)
672-{
673- KatzeNetRequest* request;
674-
675- request = priv->request;
676- request->status = KATZE_NET_NOT_FOUND;
677- if (priv->status_cb)
678- priv->status_cb (request, priv->user_data);
679- katze_net_priv_free (priv);
680- return FALSE;
681-}
682-#endif
683-
684 /**
685 * katze_net_load_uri:
686 * @net: a #KatzeNet, or %NULL
687@@ -172,43 +93,5 @@
688 KatzeNetTransferCb transfer_cb,
689 gpointer user_data)
690 {
691-#ifndef HAVE_WEBKIT2
692- KatzeNetRequest* request;
693- KatzeNetPriv* priv;
694- SoupMessage* msg;
695-
696- g_return_if_fail (uri != NULL);
697-
698- if (!status_cb && !transfer_cb)
699- return;
700-
701- request = g_slice_new (KatzeNetRequest);
702- request->uri = g_strdup (uri);
703- request->mime_type = NULL;
704- request->data = NULL;
705-
706- priv = g_slice_new (KatzeNetPriv);
707- priv->status_cb = status_cb;
708- priv->transfer_cb = transfer_cb;
709- priv->user_data = user_data;
710- priv->request = request;
711-
712- if (midori_uri_is_http (uri))
713- {
714- msg = soup_message_new ("GET", uri);
715- if (status_cb)
716- g_signal_connect (msg, "got-headers",
717- G_CALLBACK (katze_net_got_headers_cb), priv);
718- if (transfer_cb)
719- g_signal_connect (msg, "got-body",
720- G_CALLBACK (katze_net_got_body_cb), priv);
721- g_signal_connect (msg, "finished",
722- G_CALLBACK (katze_net_finished_cb), priv);
723- soup_session_queue_message (webkit_get_default_session (), msg, NULL, NULL);
724- return;
725- }
726-
727- g_idle_add ((GSourceFunc)katze_net_default_cb, priv);
728-#endif
729 }
730
731
732=== modified file 'extensions/notes.vala'
733--- extensions/notes.vala 2015-03-18 21:18:11 +0000
734+++ extensions/notes.vala 2016-09-20 20:57:01 +0000
735@@ -385,11 +385,6 @@
736 }
737
738 void add_menu_items (Midori.Tab tab, WebKit.HitTestResult hit_test_result, Midori.ContextAction menu) {
739-#if !HAVE_WEBKIT2
740- if ((hit_test_result.context & WebKit.HitTestResultContext.SELECTION) == 0)
741- return;
742-#endif
743-
744 var view = tab as Midori.View;
745 var action = new Gtk.Action ("Notes", _("Copy selection as note"), null, null);
746 action.activate.connect ((action)=> {
747
748=== modified file 'extensions/open-with.vala'
749--- extensions/open-with.vala 2016-02-17 20:26:51 +0000
750+++ extensions/open-with.vala 2016-09-20 20:57:01 +0000
751@@ -663,33 +663,7 @@
752
753 /* Returns %TRUE if the attempt to download and open failed immediately, %FALSE otherwise */
754 bool open_with_type (string uri, string content_type, Gtk.Widget widget, NextStep next_step) {
755- #if HAVE_WEBKIT2
756 return open_now (uri, content_type, widget, next_step);
757- #else
758- if (!Midori.URI.is_http (uri))
759- return open_now (uri, content_type, widget, next_step);
760- /* Don't download websites */
761- if (content_type == "application/octet-stream")
762- return open_now (uri, content_type, widget, next_step);
763-
764- var download = new WebKit.Download (new WebKit.NetworkRequest (uri));
765- download.destination_uri = Midori.Download.prepare_destination_uri (download, null);
766- if (!Midori.Download.has_enough_space (download, download.destination_uri))
767- return false;
768-
769- download.notify["status"].connect ((pspec) => {
770- if (download.status == WebKit.DownloadStatus.FINISHED) {
771- open_now (download.destination_uri, content_type, widget, next_step);
772- }
773- else if (download.status == WebKit.DownloadStatus.ERROR)
774- Midori.show_message_dialog (Gtk.MessageType.ERROR,
775- _("Download error"),
776- _("Cannot open '%s' because the download failed."
777- ).printf (download.destination_uri), false);
778- });
779- download.start ();
780- return true;
781- #endif
782 }
783
784 /* If @next_step is %NextStep.TRY_OPEN, tries to pick a handler automatically.
785@@ -730,7 +704,6 @@
786 });
787 menu.add (action);
788 }
789-#if !HAVE_WEBKIT2
790 if ((hit_test_result.context & WebKit.HitTestResultContext.IMAGE) != 0) {
791 string uri = hit_test_result.image_uri;
792 var action = new Gtk.Action ("OpenImageInViewer", _("Open in Image _Viewer"), null, null);
793@@ -739,7 +712,6 @@
794 });
795 menu.add (action);
796 }
797-#endif
798 }
799
800 void show_preferences (Katze.Preferences preferences) {
801
802=== modified file 'extensions/transfers.vala'
803--- extensions/transfers.vala 2016-04-02 08:15:11 +0000
804+++ extensions/transfers.vala 2016-09-20 20:57:01 +0000
805@@ -36,23 +36,11 @@
806 internal double progress { get {
807 return Midori.Download.get_progress (download);
808 } }
809-#if HAVE_WEBKIT2
810 public bool succeeded { get; protected set; default = false; }
811 public bool finished { get; protected set; default = false; }
812 internal string destination { get {
813 return download.destination;
814 } }
815-#else
816- internal bool succeeded { get {
817- return download.status == WebKit.DownloadStatus.FINISHED;
818- } }
819- internal bool finished { get {
820- return Midori.Download.is_finished (download);
821- } }
822- internal string destination { get {
823- return download.destination_uri;
824- } }
825-#endif
826
827 internal Transfer (WebKit.Download download) {
828 poll_source = Timeout.add(1000/10, () => {
829@@ -60,7 +48,6 @@
830 return true;
831 });
832 this.download = download;
833- #if HAVE_WEBKIT2
834 download.finished.connect (() => {
835 succeeded = finished = true;
836 changed ();
837@@ -74,15 +61,6 @@
838 Source.remove (poll_source);
839 poll_source = 0;
840 });
841- #else
842- download.notify["status"].connect (() => {
843- changed ();
844- if (download.status == WebKit.DownloadStatus.FINISHED || download.status == WebKit.DownloadStatus.ERROR) {
845- Source.remove (poll_source);
846- poll_source = 0;
847- }
848- });
849- #endif
850 }
851 }
852
853
854=== modified file 'katze/katze-item.c'
855--- katze/katze-item.c 2015-08-10 02:44:13 +0000
856+++ katze/katze-item.c 2016-09-20 20:57:01 +0000
857@@ -459,34 +459,11 @@
858 static void
859 katze_item_image_destroyed_cb (GtkWidget* image,
860 KatzeItem* item);
861-#ifndef HAVE_WEBKIT2
862-static void
863-katze_item_icon_loaded_cb (WebKitFaviconDatabase* database,
864- const gchar* frame_uri,
865- GtkWidget* image)
866-{
867- KatzeItem* item = g_object_get_data (G_OBJECT (image), "KatzeItem");
868- GdkPixbuf* pixbuf;
869- if (!g_strcmp0 (frame_uri, item->uri)
870- && (pixbuf = midori_paths_get_icon (frame_uri, image)))
871- {
872- gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
873- g_object_unref (pixbuf);
874- /* This signal fires extremely often (WebKit bug?)
875- we must throttle it (disconnect) once we have an icon */
876- katze_item_image_destroyed_cb (image, g_object_ref (item));
877- }
878-}
879-#endif
880
881 static void
882 katze_item_image_destroyed_cb (GtkWidget* image,
883 KatzeItem* item)
884 {
885-#ifndef HAVE_WEBKIT2
886- g_signal_handlers_disconnect_by_func (webkit_get_favicon_database (),
887- katze_item_icon_loaded_cb, image);
888-#endif
889 g_object_unref (item);
890 }
891
892@@ -521,10 +498,6 @@
893 g_object_set_data (G_OBJECT (image), "KatzeItem", g_object_ref (item));
894 g_signal_connect (image, "destroy",
895 G_CALLBACK (katze_item_image_destroyed_cb), item);
896-#ifndef HAVE_WEBKIT2
897- g_signal_connect (webkit_get_favicon_database (), "icon-loaded",
898- G_CALLBACK (katze_item_icon_loaded_cb), image);
899-#endif
900 return image;
901 }
902
903
904=== modified file 'katze/katze.h'
905--- katze/katze.h 2013-10-22 22:38:26 +0000
906+++ katze/katze.h 2016-09-20 20:57:01 +0000
907@@ -18,11 +18,6 @@
908 #include "katze-array.h"
909 #include "katze-arrayaction.h"
910 #include "katze-preferences.h"
911-
912-#ifndef HAVE_WEBKIT2
913- #include <webkit/webkit.h>
914-#else
915- #include <webkit2/webkit2.h>
916-#endif
917+#include <webkit2/webkit2.h>
918
919 #endif /* __KATZE_H__ */
920
921=== modified file 'katze/midori-paths.vala'
922--- katze/midori-paths.vala 2016-01-15 19:18:17 +0000
923+++ katze/midori-paths.vala 2016-09-20 20:57:01 +0000
924@@ -134,11 +134,9 @@
925 tmp_dir = get_runtime_dir ();
926 }
927 else {
928-#if HAVE_WEBKIT2_3_91
929 /* Allow WebKit to spawn more than one rendering process */
930 if (!("wk2:no-multi-render-process" in (Environment.get_variable ("MIDORI_DEBUG") ?? "")))
931 WebKit.WebContext.get_default ().set_process_model (WebKit.ProcessModel.MULTIPLE_SECONDARY_PROCESSES);
932-#endif
933 string? real_config = config != null && !Path.is_absolute (config)
934 ? Path.build_filename (Environment.get_current_dir (), config) : config;
935 config_dir = real_config ?? Path.build_path (Path.DIR_SEPARATOR_S,
936@@ -148,11 +146,10 @@
937 user_data_dir = Environment.get_user_data_dir ();
938 tmp_dir = get_runtime_dir ();
939 }
940-#if HAVE_WEBKIT2
941 if (cache_dir != null) {
942 /* Cache and extension dir MUST be set no later than here to work */
943 WebKit.WebContext.get_default ().set_web_extensions_directory (
944- Path.build_path (Path.DIR_SEPARATOR_S, cache_dir, "wk2ext"));
945+ get_lib_path (PACKAGE_NAME));
946 WebKit.WebContext.get_default ().set_disk_cache_directory (
947 Path.build_path (Path.DIR_SEPARATOR_S, cache_dir, "web"));
948 }
949@@ -162,32 +159,25 @@
950 cookie_manager.set_persistent_storage (Path.build_filename (config_dir, "cookies.db"),
951 WebKit.CookiePersistentStorage.SQLITE);
952 }
953-#endif
954 if (user_data_dir != null) {
955 string folder = Path.build_filename (user_data_dir, "webkit", "icondatabase");
956-#if HAVE_WEBKIT2
957 WebKit.WebContext.get_default ().set_favicon_database_directory (folder);
958-#else
959- WebKit.get_favicon_database ().set_path (folder);
960-#endif
961 }
962 else
963 {
964-#if HAVE_WEBKIT2
965 /* with wk2 set_favicon_database_directory can only be called once and actually
966 initializes and enables the favicon database, so we do not call it in this case */
967-#else
968- /* wk1 documentation claims that the favicon database is not enabled unless
969- a call to favicon_database.set_path is made, but in fact it must be explicitly
970- disabled by setting to null (verified as of webkitgtk 2.3.1) */
971- WebKit.get_favicon_database ().set_path (null);
972-#endif
973 }
974
975 #if !HAVE_WIN32
976 Gtk.IconTheme.get_default ().append_search_path (exec_path);
977 #endif
978
979+ if (("wk2:ignore-tls" in (Environment.get_variable ("MIDORI_DEBUG") ?? "")))
980+ WebKit.WebContext.get_default ().set_tls_errors_policy (WebKit.TLSErrorsPolicy.IGNORE);
981+ else
982+ WebKit.WebContext.get_default ().set_tls_errors_policy (WebKit.TLSErrorsPolicy.FAIL);
983+
984 if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "paths") == 0) {
985 stdout.printf ("config: %s\ncache: %s\nuser_data: %s\ntmp: %s\n",
986 config_dir, cache_dir, user_data_dir, tmp_dir);
987@@ -451,11 +441,7 @@
988 public static void clear_icons () {
989 assert (cache_dir != null);
990 assert (user_data_dir != null);
991-#if HAVE_WEBKIT2
992 WebKit.WebContext.get_default ().get_favicon_database ().clear ();
993-#else
994- WebKit.get_favicon_database ().clear ();
995-#endif
996 /* FIXME: Exclude search engine icons */
997 remove_path (Path.build_filename (user_data_dir, "webkit", "icondatabase"));
998 }
999@@ -475,14 +461,7 @@
1000 Gtk.IconSize.MENU, out icon_width, out icon_height);
1001 else
1002 icon_width = icon_height = 0 /* maximum size */;
1003-#if HAVE_WEBKIT2
1004 /* There is no sync API for WebKit2 */
1005-#else
1006- Gdk.Pixbuf? pixbuf = WebKit.get_favicon_database ()
1007- .try_get_favicon_pixbuf (uri, icon_width, icon_height);
1008- if (pixbuf != null)
1009- return pixbuf;
1010-#endif
1011 if (widget != null)
1012 return widget.render_icon (Gtk.STOCK_FILE, Gtk.IconSize.MENU, null);
1013 return null;
1014
1015=== modified file 'katze/midori-uri.vala'
1016--- katze/midori-uri.vala 2015-04-12 13:30:03 +0000
1017+++ katze/midori-uri.vala 2016-09-20 20:57:01 +0000
1018@@ -248,16 +248,10 @@
1019 * Since: 0.5.8
1020 **/
1021 public static async GLib.Icon? get_icon (string uri, Cancellable? cancellable=null) throws Error {
1022-#if HAVE_WEBKIT2
1023 var database = WebKit.WebContext.get_default ().get_favicon_database ();
1024 var surface = yield database.get_favicon (uri, cancellable);
1025 var image = (Cairo.ImageSurface)surface;
1026 var pixbuf = Gdk.pixbuf_get_from_surface (image, 0, 0, image.get_width (), image.get_height ());
1027-#else
1028- var database = WebKit.get_favicon_database ();
1029- // We must not pass a Cancellable due to a crasher bug
1030- var pixbuf = yield database.get_favicon_pixbuf (uri, 0, 0, null);
1031-#endif
1032 return pixbuf as GLib.Icon;
1033 }
1034
1035
1036=== modified file 'midori/main.c'
1037--- midori/main.c 2016-03-21 19:19:52 +0000
1038+++ midori/main.c 2016-09-20 20:57:01 +0000
1039@@ -39,6 +39,7 @@
1040 g_free (uri);
1041 }
1042
1043+<<<<<<< TREE
1044 #ifndef HAVE_WEBKIT2
1045 static void
1046 snapshot_load_finished_cb (GtkWidget* web_view,
1047@@ -96,6 +97,8 @@
1048 fclose (logfile);
1049 }
1050
1051+=======
1052+>>>>>>> MERGE-SOURCE
1053 int
1054 main (int argc,
1055 char** argv)
1056@@ -321,10 +324,6 @@
1057 else
1058 gtk_widget_set_size_request (web_view, 800, 600);
1059 gtk_widget_show_all (offscreen);
1060- #ifndef HAVE_WEBKIT2
1061- g_signal_connect (web_view, "load-finished",
1062- G_CALLBACK (snapshot_load_finished_cb), filename);
1063- #endif
1064 uri = sokoke_magic_uri (snapshot, FALSE, TRUE);
1065 webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), uri);
1066 g_free (uri);
1067@@ -343,19 +342,11 @@
1068 GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
1069 GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
1070 GtkWidget* entry = gtk_entry_new ();
1071-#ifndef HAVE_WEBKIT2
1072- GtkWidget* scrolled = gtk_scrolled_window_new (NULL, NULL);
1073-#endif
1074 GtkWidget* web_view = webkit_web_view_new ();
1075 katze_window_set_sensible_default_size (GTK_WINDOW (window));
1076
1077 gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
1078-#ifndef HAVE_WEBKIT2
1079- gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE, 0);
1080- gtk_container_add (GTK_CONTAINER (scrolled), web_view);
1081-#else
1082 gtk_box_pack_start (GTK_BOX (vbox), web_view, TRUE, TRUE, 0);
1083-#endif
1084 gtk_container_add (GTK_CONTAINER (window), vbox);
1085 gtk_entry_set_text (GTK_ENTRY (entry), uris && *uris ? *uris : "http://www.example.com");
1086 plain_entry_activate_cb (entry, web_view);
1087@@ -381,9 +372,6 @@
1088
1089 MidoriBrowser* browser = midori_browser_new ();
1090 MidoriWebSettings* settings = midori_browser_get_settings (browser);
1091-#ifndef HAVE_WEBKIT2
1092- g_object_set_data (G_OBJECT (webkit_get_default_session ()), "pass-through-console", (void*)1);
1093-#endif
1094 midori_load_soup_session (settings);
1095
1096 gchar* msg = NULL;
1097
1098=== modified file 'midori/midori-browser.c'
1099--- midori/midori-browser.c 2016-01-23 19:21:31 +0000
1100+++ midori/midori-browser.c 2016-09-20 20:57:01 +0000
1101@@ -153,11 +153,9 @@
1102 static void
1103 midori_browser_finalize (GObject* object);
1104
1105-#ifdef HAVE_WEBKIT2
1106 void download_created_destination_cb (WebKitDownload *download,
1107 gchar *destination,
1108 gpointer user_data);
1109-#endif
1110
1111 static void
1112 midori_browser_set_property (GObject* object,
1113@@ -1319,54 +1317,11 @@
1114 if (!midori_download_has_enough_space (download, uri, FALSE))
1115 return FALSE;
1116
1117-#ifdef HAVE_WEBKIT2
1118 webkit_download_set_destination (download, uri);
1119-#else
1120- webkit_download_set_destination_uri (download, uri);
1121-#endif
1122 g_signal_emit (browser, signals[ADD_DOWNLOAD], 0, download);
1123 return TRUE;
1124 }
1125
1126-#ifndef HAVE_WEBKIT2
1127-static void
1128-midori_browser_save_resources (GList* resources,
1129- const gchar* folder)
1130-{
1131- GList* list;
1132- katze_mkdir_with_parents (folder, 0700);
1133-
1134- for (list = resources; list; list = g_list_next (list))
1135- {
1136- WebKitWebResource* resource = WEBKIT_WEB_RESOURCE (list->data);
1137- GString* data = webkit_web_resource_get_data (resource);
1138-
1139- /* Resource could be adblocked, skip it in that case */
1140- if (!g_strcmp0 (webkit_web_resource_get_uri (resource), "about:blank"))
1141- continue;
1142-
1143- gchar* sub_filename = midori_download_get_filename_suggestion_for_uri (
1144- webkit_web_resource_get_mime_type (resource),
1145- webkit_web_resource_get_uri (resource));
1146- gchar* sub_path = g_build_filename (folder, sub_filename, NULL);
1147- sub_path = midori_download_get_unique_filename (sub_path);
1148- if (data)
1149- {
1150- GError* error = NULL;
1151- if (!g_file_set_contents (sub_path, data->str, data->len, &error))
1152- {
1153- g_warning ("Failed to save %s: %s", sub_filename, error->message);
1154- g_error_free (error);
1155- }
1156- }
1157- else
1158- g_warning ("Skipping empty resource %s", sub_filename);
1159- g_free (sub_filename);
1160- g_free (sub_path);
1161- }
1162-}
1163-#endif
1164-
1165 void
1166 midori_browser_save_uri (MidoriBrowser* browser,
1167 MidoriView* view,
1168@@ -1395,50 +1350,6 @@
1169 g_free (dirname);
1170 }
1171
1172-#ifndef HAVE_WEBKIT2
1173- GList* resources = midori_view_get_resources (view);
1174- gboolean file_only = TRUE;
1175- GtkWidget* checkbox = NULL;
1176-
1177- if (resources != NULL && g_list_nth_data (resources, 1) != NULL)
1178- {
1179- file_only = FALSE;
1180- checkbox = gtk_check_button_new_with_mnemonic (_("Save associated _resources"));
1181- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE);
1182- gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), checkbox);
1183- }
1184-
1185- if (!file_only && !g_str_equal (title, uri))
1186- filename = midori_download_clean_filename (title);
1187- else
1188- {
1189- gchar* mime_type = katze_object_get_object (view, "mime-type");
1190- filename = midori_download_get_filename_suggestion_for_uri (mime_type, uri);
1191- g_free (mime_type);
1192- }
1193- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename);
1194- g_free (filename);
1195-
1196- if (midori_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
1197- {
1198- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
1199- if (checkbox != NULL)
1200- file_only = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
1201- if (!file_only)
1202- {
1203- gchar* fullname = g_strconcat (filename, ".html", NULL);
1204- midori_view_save_source (view, uri, fullname, FALSE);
1205- g_free (fullname);
1206- midori_browser_save_resources (resources, filename);
1207- }
1208- else
1209- midori_view_save_source (view, uri, filename, FALSE);
1210- katze_assign (last_dir,
1211- gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
1212- }
1213- g_list_foreach (resources, (GFunc)g_object_unref, NULL);
1214- g_list_free (resources);
1215-#else
1216 filename = midori_download_clean_filename (title);
1217 gchar* suggested_filename = g_strconcat (filename, ".mht", NULL);
1218 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested_filename);
1219@@ -1456,7 +1367,6 @@
1220 katze_assign (last_dir,
1221 gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
1222 }
1223-#endif
1224 gtk_widget_destroy (dialog);
1225 }
1226
1227@@ -1493,28 +1403,6 @@
1228 midori_browser_view_copy_to_item_history (GtkWidget* view,
1229 KatzeItem* item)
1230 {
1231-#ifndef HAVE_WEBKIT2
1232- WebKitWebView* copy_from;
1233- WebKitWebBackForwardList* list_from;
1234- guint length_from;
1235- gint i;
1236- GPtrArray* history;
1237-
1238- copy_from = WEBKIT_WEB_VIEW (midori_view_get_web_view (MIDORI_VIEW (view)));
1239- list_from = webkit_web_view_get_back_forward_list (copy_from);
1240- length_from = webkit_web_back_forward_list_get_back_length (list_from);
1241- history = g_ptr_array_new ();
1242-
1243- for (i = -length_from; i <= -1 ; i++)
1244- {
1245- WebKitWebHistoryItem* hist_item = webkit_web_back_forward_list_get_nth_item (list_from, i);
1246- if (hist_item == NULL)
1247- break;
1248- g_object_ref ((gpointer) hist_item);
1249- g_ptr_array_add (history, (gpointer) hist_item);
1250- }
1251- g_object_set_data (G_OBJECT (item), "tab-history", (gpointer) history);
1252-#endif
1253 }
1254
1255 static void
1256@@ -1579,63 +1467,14 @@
1257 GtkWidget* view_from,
1258 gboolean omit_last)
1259 {
1260-#ifndef HAVE_WEBKIT2
1261- WebKitWebView* copy_from;
1262- WebKitWebBackForwardList* list_from;
1263- WebKitWebView* copy_to;
1264- WebKitWebBackForwardList* list_to;
1265- guint length_from;
1266- gint i;
1267-
1268- copy_from = WEBKIT_WEB_VIEW (midori_view_get_web_view (MIDORI_VIEW (view_from)));
1269- list_from = webkit_web_view_get_back_forward_list (copy_from);
1270- copy_to = WEBKIT_WEB_VIEW (midori_view_get_web_view (MIDORI_VIEW (view_to)));
1271- list_to = webkit_web_view_get_back_forward_list (copy_to);
1272- length_from = webkit_web_back_forward_list_get_back_length (list_from);
1273-
1274- for (i = -length_from; i <= (omit_last ? -1 : 0); i++)
1275- {
1276- WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_nth_item (list_from, i);
1277- if (item == NULL)
1278- break;
1279- webkit_web_back_forward_list_add_item (list_to, item);
1280- }
1281-#endif
1282 }
1283
1284-
1285 static void
1286 midori_browser_view_copy_from_item_history (GtkWidget* view,
1287 KatzeItem* item)
1288 {
1289-#ifndef HAVE_WEBKIT2
1290- WebKitWebView* copy_to;
1291- WebKitWebBackForwardList* list_to;
1292- guint i;
1293- GPtrArray* list_from;
1294-
1295- copy_to = WEBKIT_WEB_VIEW (midori_view_get_web_view (MIDORI_VIEW (view)));
1296- list_to = webkit_web_view_get_back_forward_list (copy_to);
1297-
1298- if (item == NULL)
1299- return;
1300- list_from = g_object_get_data (G_OBJECT (item), "tab-history");
1301- if (list_from == NULL)
1302- return;
1303-
1304- for (i = 0; i < list_from->len; i++)
1305- {
1306- WebKitWebHistoryItem* hist_item = (WebKitWebHistoryItem*) g_ptr_array_index (list_from, i);
1307- if (hist_item == NULL)
1308- break;
1309- webkit_web_back_forward_list_add_item (list_to, hist_item);
1310- }
1311- g_ptr_array_unref (list_from);
1312-#endif
1313 }
1314
1315-
1316-
1317 static gboolean
1318 midori_browser_notify_new_tab_timeout_cb (MidoriBrowser *browser)
1319 {
1320@@ -1785,7 +1624,6 @@
1321 }
1322 }
1323
1324-#ifdef HAVE_WEBKIT2
1325 static void
1326 midori_browser_close_tab_idle (GObject* resource,
1327 GAsyncResult* result,
1328@@ -1795,16 +1633,8 @@
1329 result, NULL, NULL);
1330 if (data != NULL)
1331 return;
1332-#else
1333-static gboolean
1334-midori_browser_close_tab_idle (gpointer view)
1335-{
1336-#endif
1337 MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
1338 midori_browser_close_tab (browser, GTK_WIDGET (view));
1339-#ifndef HAVE_WEBKIT2
1340- return G_SOURCE_REMOVE;
1341-#endif
1342 }
1343
1344 static gboolean
1345@@ -1820,11 +1650,7 @@
1346 {
1347 handled = FALSE;
1348 }
1349- #ifdef HAVE_WEBKIT2
1350 else if (!webkit_download_get_destination (download))
1351- #else
1352- else if (!webkit_download_get_destination_uri (download))
1353- #endif
1354 {
1355 if (type == MIDORI_DOWNLOAD_SAVE_AS)
1356 {
1357@@ -1833,12 +1659,8 @@
1358
1359 if (!dialog)
1360 {
1361- #ifdef HAVE_WEBKIT2
1362 const gchar* download_uri = webkit_uri_response_get_uri (
1363 webkit_download_get_response (download));
1364- #else
1365- const gchar* download_uri = webkit_download_get_uri (download);
1366- #endif
1367 gchar* folder;
1368 dialog = (GtkWidget*)midori_file_chooser_dialog_new (_("Save file"),
1369 GTK_WINDOW (browser), GTK_FILE_CHOOSER_ACTION_SAVE);
1370@@ -1883,24 +1705,14 @@
1371 midori_browser_prepare_download (browser, download, destination_uri);
1372 g_free (destination_uri);
1373 }
1374- #ifndef HAVE_WEBKIT2
1375- webkit_download_start (download);
1376- #endif
1377 }
1378
1379 /* Close empty tabs due to download links with a target */
1380 if (midori_view_is_blank (MIDORI_VIEW (view)))
1381 {
1382 GtkWidget* web_view = midori_view_get_web_view (MIDORI_VIEW (view));
1383- #ifdef HAVE_WEBKIT2
1384 WebKitWebResource* resource = webkit_web_view_get_main_resource (WEBKIT_WEB_VIEW (web_view));
1385 webkit_web_resource_get_data (resource, NULL, midori_browser_close_tab_idle, view);
1386- #else
1387- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
1388- WebKitWebDataSource* datasource = webkit_web_frame_get_data_source (web_frame);
1389- if (webkit_web_data_source_get_data (datasource) == NULL)
1390- g_idle_add (midori_browser_close_tab_idle, view);
1391- #endif
1392 }
1393 return handled;
1394 }
1395@@ -2145,35 +1957,6 @@
1396 return TRUE;
1397 }
1398
1399-#ifndef HAVE_WEBKIT2
1400- GtkWidget* focus = gtk_window_get_focus (GTK_WINDOW (widget));
1401- if (focus == NULL)
1402- gtk_widget_grab_focus (midori_browser_get_current_tab (MIDORI_BROWSER (widget)));
1403- else if (G_OBJECT_TYPE (focus) == WEBKIT_TYPE_WEB_VIEW
1404- && event->keyval == GDK_KEY_space
1405- && (!(event->state & GDK_SHIFT_MASK))
1406- && !webkit_web_view_can_cut_clipboard (WEBKIT_WEB_VIEW (focus))
1407- && !webkit_web_view_can_paste_clipboard (WEBKIT_WEB_VIEW (focus)))
1408- {
1409- /* Space at the bottom of the page: Go to next page */
1410- MidoriView* view = midori_view_get_for_widget (focus);
1411- GtkScrolledWindow* scrolled = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (focus));
1412- GtkAdjustment* vadjust = gtk_scrolled_window_get_vadjustment (scrolled);
1413- if (gtk_adjustment_get_value (vadjust)
1414- == (gtk_adjustment_get_upper (vadjust) - gtk_adjustment_get_page_size (vadjust)))
1415- {
1416- /* Duplicate here because the URI pointer might change */
1417- gchar* uri = g_strdup (midori_view_get_next_page (view));
1418- if (uri != NULL)
1419- {
1420- midori_view_set_uri (view, uri);
1421- g_free (uri);
1422- return TRUE;
1423- }
1424- }
1425- }
1426-#endif
1427-
1428 if (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))
1429 if (sokoke_window_activate_key (window, event))
1430 return TRUE;
1431@@ -2991,11 +2774,7 @@
1432 {
1433 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
1434 if (WEBKIT_IS_WEB_VIEW (widget))
1435-#ifdef HAVE_WEBKIT2
1436 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_UNDO);
1437-#else
1438- webkit_web_view_undo (WEBKIT_WEB_VIEW (widget));
1439-#endif
1440 }
1441
1442 static void
1443@@ -3004,11 +2783,7 @@
1444 {
1445 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
1446 if (WEBKIT_IS_WEB_VIEW (widget))
1447-#ifdef HAVE_WEBKIT2
1448 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_REDO);
1449-#else
1450- webkit_web_view_redo (WEBKIT_WEB_VIEW (widget));
1451-#endif
1452 }
1453
1454 static void
1455@@ -3018,10 +2793,8 @@
1456 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
1457 if (G_LIKELY (widget) && g_signal_lookup ("cut-clipboard", G_OBJECT_TYPE (widget)))
1458 g_signal_emit_by_name (widget, "cut-clipboard");
1459-#ifdef HAVE_WEBKIT2
1460 else if (WEBKIT_IS_WEB_VIEW (widget))
1461 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_CUT);
1462-#endif
1463 }
1464
1465 static void
1466@@ -3031,10 +2804,8 @@
1467 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
1468 if (G_LIKELY (widget) && g_signal_lookup ("copy-clipboard", G_OBJECT_TYPE (widget)))
1469 g_signal_emit_by_name (widget, "copy-clipboard");
1470-#ifdef HAVE_WEBKIT2
1471 else if (WEBKIT_IS_WEB_VIEW (widget))
1472 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_COPY);
1473-#endif
1474 }
1475
1476 static void
1477@@ -3044,10 +2815,8 @@
1478 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
1479 if (G_LIKELY (widget) && g_signal_lookup ("paste-clipboard", G_OBJECT_TYPE (widget)))
1480 g_signal_emit_by_name (widget, "paste-clipboard");
1481-#ifdef HAVE_WEBKIT2
1482 else if (WEBKIT_IS_WEB_VIEW (widget))
1483 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_PASTE);
1484-#endif
1485 }
1486
1487 static void
1488@@ -3059,10 +2828,6 @@
1489 {
1490 if (GTK_IS_EDITABLE (widget))
1491 gtk_editable_delete_selection (GTK_EDITABLE (widget));
1492-#ifndef HAVE_WEBKIT2
1493- else if (WEBKIT_IS_WEB_VIEW (widget))
1494- webkit_web_view_delete_selection (WEBKIT_WEB_VIEW (widget));
1495-#endif
1496 else if (GTK_IS_TEXT_VIEW (widget))
1497 gtk_text_buffer_delete_selection (
1498 gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)), TRUE, FALSE);
1499@@ -3078,10 +2843,8 @@
1500 {
1501 if (GTK_IS_EDITABLE (widget))
1502 gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
1503-#ifdef HAVE_WEBKIT2
1504 else if (WEBKIT_IS_WEB_VIEW (widget))
1505 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_SELECT_ALL);
1506-#endif
1507 else if (g_signal_lookup ("select-all", G_OBJECT_TYPE (widget)))
1508 {
1509 if (GTK_IS_TEXT_VIEW (widget))
1510@@ -3595,11 +3358,7 @@
1511 encoding = "ISO-8859-1";
1512 else
1513 g_assert_not_reached ();
1514- #ifdef HAVE_WEBKIT2
1515 webkit_web_view_set_custom_charset (web_view, encoding);
1516- #else
1517- webkit_web_view_set_custom_encoding (web_view, encoding);
1518- #endif
1519 }
1520
1521 static void
1522@@ -3607,39 +3366,7 @@
1523 MidoriBrowser* browser,
1524 gboolean use_dom)
1525 {
1526- #ifdef HAVE_WEBKIT2
1527 /* TODO: midori_view_save_source isn't async and not WebKit2-friendly */
1528- #else
1529- GtkWidget* view = midori_browser_get_current_tab (browser);
1530- gchar* filename = midori_view_save_source (MIDORI_VIEW (view), NULL, NULL, use_dom);
1531- gchar* text_editor;
1532- GAppInfo* info;
1533- g_object_get (browser->settings, "text-editor", &text_editor, NULL);
1534- if (text_editor && *text_editor)
1535- info = g_app_info_create_from_commandline (text_editor, NULL, 0, NULL);
1536- else
1537- info = g_app_info_get_default_for_type ("text/plain", FALSE);
1538- GFile* file = g_file_new_for_path (filename);
1539- GList* files = g_list_append (NULL, file);
1540- GError* error = NULL;
1541- GdkDisplay* display = gtk_widget_get_display (view);
1542- #if GTK_CHECK_VERSION (3, 0, 0)
1543- GdkAppLaunchContext* ctx = gdk_display_get_app_launch_context (display);
1544- #else
1545- GdkAppLaunchContext* ctx = gdk_app_launch_context_new ();
1546- gdk_app_launch_context_set_display (ctx, display);
1547- #endif
1548- if (!g_app_info_launch (info, files, G_APP_LAUNCH_CONTEXT (ctx), &error))
1549- {
1550- g_printerr ("Failed to open editor: %s", error->message);
1551- g_error_free (error);
1552- }
1553- g_object_unref (info);
1554- g_list_free (files);
1555- g_object_unref (file);
1556- g_free (filename);
1557- g_free (text_editor);
1558- #endif
1559 }
1560
1561 static void
1562@@ -3736,20 +3463,6 @@
1563 _action_scroll_somewhere_activate (GtkAction* action,
1564 MidoriBrowser* browser)
1565 {
1566-#ifndef HAVE_WEBKIT2
1567- GtkWidget* view = midori_browser_get_current_tab (browser);
1568- WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (MIDORI_VIEW (view)));
1569- const gchar* name = gtk_action_get_name (action);
1570-
1571- if (g_str_equal (name, "ScrollLeft"))
1572- webkit_web_view_move_cursor (web_view, GTK_MOVEMENT_VISUAL_POSITIONS, -1);
1573- else if (g_str_equal (name, "ScrollDown"))
1574- webkit_web_view_move_cursor (web_view, GTK_MOVEMENT_DISPLAY_LINES, 1);
1575- else if (g_str_equal (name, "ScrollUp"))
1576- webkit_web_view_move_cursor (web_view, GTK_MOVEMENT_DISPLAY_LINES, -1);
1577- else if (g_str_equal (name, "ScrollRight"))
1578- webkit_web_view_move_cursor (web_view, GTK_MOVEMENT_VISUAL_POSITIONS, 1);
1579-#endif
1580 }
1581
1582 static void
1583@@ -3833,15 +3546,9 @@
1584 if (middle_click)
1585 {
1586 WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
1587- #ifdef HAVE_WEBKIT2
1588 WebKitBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);
1589 WebKitBackForwardListItem* item = webkit_back_forward_list_get_back_item (list);
1590 const gchar* back_uri = webkit_back_forward_list_item_get_uri (item);
1591- #else
1592- WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);
1593- WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_forward_item (list);
1594- const gchar* back_uri = webkit_web_history_item_get_uri (item);
1595- #endif
1596
1597 GtkWidget* new_view = midori_browser_add_uri (browser, back_uri);
1598 midori_browser_set_current_tab_smartly (browser, new_view);
1599@@ -3856,15 +3563,9 @@
1600 if (middle_click)
1601 {
1602 WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
1603- #ifdef HAVE_WEBKIT2
1604 WebKitBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);
1605 WebKitBackForwardListItem* item = webkit_back_forward_list_get_forward_item (list);
1606 const gchar* forward_uri = webkit_back_forward_list_item_get_uri (item);
1607- #else
1608- WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);
1609- WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_forward_item (list);
1610- const gchar* forward_uri = webkit_web_history_item_get_uri (item);
1611- #endif
1612
1613 GtkWidget* new_view = midori_browser_add_uri (browser, forward_uri);
1614 midori_browser_set_current_tab_smartly (browser, new_view);
1615@@ -3963,41 +3664,10 @@
1616 midori_browser_get_current_uri (browser));
1617 }
1618
1619-#ifndef HAVE_WEBKIT2
1620-static void
1621-midori_browser_item_icon_loaded_cb (WebKitFaviconDatabase* database,
1622- const gchar* frame_uri,
1623- KatzeItem* item)
1624-{
1625- gchar* uri = g_object_get_data (G_OBJECT (item), "browser-queue-icon");
1626- if (strcmp (frame_uri, uri))
1627- return;
1628-
1629- gchar* icon_uri = webkit_favicon_database_get_favicon_uri (
1630- webkit_get_favicon_database (), frame_uri);
1631- if (icon_uri != NULL)
1632- {
1633- g_free (icon_uri);
1634- katze_item_set_icon (item, frame_uri);
1635- /* This signal fires extremely often (WebKit bug?)
1636- we must throttle it (disconnect) once we have an icon */
1637- g_signal_handlers_disconnect_by_func (webkit_get_favicon_database (),
1638- midori_browser_item_icon_loaded_cb, item);
1639- }
1640-}
1641-#endif
1642-
1643 static void
1644 midori_browser_queue_item_for_icon (KatzeItem* item,
1645 const gchar* uri)
1646 {
1647-#ifndef HAVE_WEBKIT2
1648- if (katze_item_get_icon (item) != NULL)
1649- return;
1650- g_object_set_data_full (G_OBJECT (item), "browser-queue-icon", g_strdup (uri), g_free);
1651- g_signal_connect (webkit_get_favicon_database (), "icon-loaded",
1652- G_CALLBACK (midori_browser_item_icon_loaded_cb), item);
1653-#endif
1654 }
1655
1656 static void
1657@@ -6171,7 +5841,6 @@
1658 gint icon_size = 16;
1659 gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (browser)),
1660 GTK_ICON_SIZE_MENU, &icon_size, NULL);
1661- gtk_widget_set_size_request (throbber_box, icon_size, icon_size);
1662 gtk_container_add (GTK_CONTAINER (throbber_box), browser->throbber);
1663 gtk_widget_show (throbber_box);
1664 gtk_container_add (GTK_CONTAINER (menuitem), throbber_box);
1665@@ -6389,17 +6058,6 @@
1666 gtk_toolbar_style);
1667 }
1668
1669-#ifndef HAVE_WEBKIT2
1670-static void
1671-midori_browser_toolbar_popup_context_menu_history_cb (GtkMenuItem* menu_item,
1672- MidoriBrowser* browser)
1673-{
1674- gint steps = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "steps"));
1675- MidoriView* view = MIDORI_VIEW (midori_browser_get_current_tab (browser));
1676- midori_view_go_back_or_forward (view, steps);
1677-}
1678-#endif
1679-
1680 static void
1681 midori_browser_toolbar_popup_context_menu_history (MidoriBrowser* browser,
1682 GtkWidget* widget,
1683@@ -6407,61 +6065,6 @@
1684 gint x,
1685 gint y)
1686 {
1687-#ifndef HAVE_WEBKIT2
1688- const gint step = back ? -1 : 1;
1689- gint steps = step;
1690- GtkWidget* menu;
1691- WebKitWebBackForwardList* list;
1692- WebKitWebHistoryItem* current_item;
1693- WebKitWebHistoryItem* history_item;
1694- WebKitWebHistoryItem* (*history_next)(WebKitWebBackForwardList*);
1695- void (*history_action)(WebKitWebBackForwardList*);
1696-
1697- list = webkit_web_view_get_back_forward_list (
1698- WEBKIT_WEB_VIEW (midori_view_get_web_view (
1699- MIDORI_VIEW (midori_browser_get_current_tab (browser)))));
1700-
1701- if (!list)
1702- return;
1703-
1704- menu = gtk_menu_new ();
1705-
1706- history_action = back ?
1707- webkit_web_back_forward_list_go_back :
1708- webkit_web_back_forward_list_go_forward;
1709- history_next = back ?
1710- webkit_web_back_forward_list_get_back_item :
1711- webkit_web_back_forward_list_get_forward_item;
1712- current_item = webkit_web_back_forward_list_get_current_item (list);
1713-
1714- for (; (history_item = history_next (list)); history_action (list), steps += step)
1715- {
1716- const gchar* uri = webkit_web_history_item_get_uri (history_item);
1717- GtkWidget* menu_item = gtk_image_menu_item_new_with_label (
1718- webkit_web_history_item_get_title (history_item));
1719- GdkPixbuf* pixbuf;
1720- if ((pixbuf = midori_paths_get_icon (uri, widget)))
1721- {
1722- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item),
1723- gtk_image_new_from_pixbuf (pixbuf));
1724- g_object_unref (pixbuf);
1725- }
1726- g_object_set_data (G_OBJECT (menu_item), "uri", (gpointer)uri);
1727- g_object_set_data (G_OBJECT (menu_item), "steps", GINT_TO_POINTER (steps));
1728- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
1729- g_signal_connect (G_OBJECT (menu_item), "activate",
1730- G_CALLBACK (midori_browser_toolbar_popup_context_menu_history_cb),
1731- browser);
1732- if (steps == (10 - 1))
1733- break;
1734- }
1735-
1736- webkit_web_back_forward_list_go_to_item (list, current_item);
1737- gtk_widget_show_all (menu);
1738-
1739- katze_widget_popup (widget, GTK_MENU (menu), NULL,
1740- KATZE_MENU_POSITION_LEFT);
1741-#endif
1742 }
1743
1744 static void
1745@@ -7031,11 +6634,6 @@
1746 g_return_if_fail (MIDORI_IS_BROWSER (browser));
1747 g_return_if_fail (GTK_IS_WIDGET (view));
1748
1749-#ifndef HAVE_WEBKIT2
1750- if (!g_object_get_data (G_OBJECT (webkit_get_default_session ()),
1751- "midori-session-initialized"))
1752- g_critical ("midori_load_soup_session was not called!");
1753-#endif
1754 g_signal_emit (browser, signals[ADD_TAB], 0, view);
1755 }
1756
1757
1758=== modified file 'midori/midori-browser.h'
1759--- midori/midori-browser.h 2015-05-24 00:19:21 +0000
1760+++ midori/midori-browser.h 2016-09-20 20:57:01 +0000
1761@@ -40,11 +40,7 @@
1762 /* Signals */
1763 void
1764 (*window_object_cleared) (MidoriBrowser* browser,
1765-#ifndef HAVE_WEBKIT2
1766- WebKitWebFrame* web_frame,
1767-#else
1768 void* web_frame,
1769-#endif
1770 JSContextRef* context,
1771 JSObjectRef* window_object);
1772 void
1773
1774=== modified file 'midori/midori-contextaction.vala'
1775--- midori/midori-contextaction.vala 2015-06-06 12:20:44 +0000
1776+++ midori/midori-contextaction.vala 2016-09-20 20:57:01 +0000
1777@@ -70,7 +70,6 @@
1778 warning ("Action %s not known to ContextAction", name);
1779 }
1780
1781-#if HAVE_WEBKIT2
1782 public WebKit.ContextMenu create_webkit_context_menu (WebKit.ContextMenu? default_menu) {
1783 var menu = default_menu ?? new WebKit.ContextMenu ();
1784 foreach (var action in children) {
1785@@ -90,7 +89,6 @@
1786 }
1787 return menu;
1788 }
1789-#endif
1790
1791 Gtk.ToolButton toolitem;
1792 public override unowned Gtk.Widget create_tool_item () {
1793
1794=== modified file 'midori/midori-download.vala'
1795--- midori/midori-download.vala 2016-01-15 19:18:17 +0000
1796+++ midori/midori-download.vala 2016-09-20 20:57:01 +0000
1797@@ -16,20 +16,9 @@
1798 namespace Midori {
1799 namespace Download {
1800 public static bool is_finished (WebKit.Download download) {
1801-#if !HAVE_WEBKIT2
1802- switch (download.status) {
1803- case WebKit.DownloadStatus.FINISHED:
1804- case WebKit.DownloadStatus.CANCELLED:
1805- case WebKit.DownloadStatus.ERROR:
1806- return true;
1807- default:
1808- return false;
1809- }
1810-#else
1811 if (download.estimated_progress == 1)
1812 return true;
1813 return false;
1814-#endif
1815 }
1816
1817 public static int get_type (WebKit.Download download) {
1818@@ -40,90 +29,17 @@
1819 download.set_data<int> ("midori-download-type", type);
1820 }
1821
1822-#if HAVE_WEBKIT2
1823 public static string get_filename (WebKit.Download download) {
1824 return download.get_data<string> ("midori-download-filename");
1825 }
1826 public static void set_filename (WebKit.Download download, string name) {
1827 download.set_data<string> ("midori-download-filename", name);
1828 }
1829-#endif
1830 public static double get_progress (WebKit.Download download) {
1831-#if !HAVE_WEBKIT2
1832- /* Avoid a bug in WebKit */
1833- if (download.status == WebKit.DownloadStatus.CREATED)
1834- return 0.0;
1835- return download.progress;
1836-#else
1837 return download.estimated_progress;
1838-#endif
1839 }
1840
1841 public static string calculate_tooltip (WebKit.Download download) {
1842-#if !HAVE_WEBKIT2
1843- string filename = Midori.Download.get_basename_for_display (download.destination_uri);
1844- /* i18n: Download tooltip (size): 4KB of 43MB */
1845- string size = _("%s of %s").printf (
1846- format_size (download.current_size),
1847- format_size (download.total_size));
1848-
1849- /* Finished, no speed or remaining time */
1850- if (is_finished (download) || download.status == WebKit.DownloadStatus.CREATED)
1851- return "%s\n%s".printf (filename, size);
1852-
1853- uint64 total_size = download.total_size, current_size = download.current_size;
1854- double elapsed = download.get_elapsed_time (),
1855- diff = elapsed / current_size,
1856- estimated = (total_size - current_size) * diff;
1857- int hour = 3600, minute = 60;
1858- int hours = (int)(estimated / hour),
1859- minutes = (int)((estimated - (hours * hour)) / minute),
1860- seconds = (int)((estimated - (hours * hour) - (minutes * minute)));
1861- string hours_ = ngettext ("%d hour", "%d hours", hours).printf (hours);
1862- string minutes_ = ngettext ("%d minute", "%d minutes", minutes).printf (minutes);
1863- string seconds_ = ngettext ("%d second", "%d seconds", seconds).printf (seconds);
1864- double last_time = download.get_data<int> ("last-time");
1865-
1866- string eta = "";
1867- if (estimated > 0) {
1868- if (hours > 0)
1869- eta = hours_ + ", " + minutes_;
1870- else if (minutes >= 10)
1871- eta = minutes_;
1872- else if (minutes < 10 && minutes > 0)
1873- eta = minutes_ + ", " + seconds_;
1874- else if (seconds > 0)
1875- eta = seconds_;
1876- if (eta != "")
1877- /* i18n: Download tooltip (estimated time) : - 1 hour, 5 minutes remaning */
1878- eta = _(" - %s remaining").printf (eta);
1879- }
1880-
1881- string speed = "";
1882- uint64? last_size = download.get_data<uint64?> ("last-size");
1883- if (last_size != null && elapsed != last_time) {
1884- if (current_size != last_size) {
1885- speed = format_size ((uint64)(
1886- (current_size - last_size) / (elapsed - last_time)));
1887- download.set_data ("last-speed", speed.dup ());
1888- }
1889- else {
1890- speed = download.get_data ("last-speed");
1891- }
1892- }
1893- else
1894- /* i18n: Unknown number of bytes, used for transfer rate like ?B/s */
1895- speed = _("?B");
1896- /* i18n: Download tooltip (transfer rate): (130KB/s) */
1897- speed = _(" (%s/s)").printf (speed);
1898-
1899- if (elapsed - last_time > 0.0) {
1900- download.set_data<int> ("last-time", (int)elapsed);
1901- download.set_data<uint64?> ("last-size", current_size);
1902- }
1903-
1904- return "%s\n%s %s%s".printf (filename, size, speed, eta);
1905-#else
1906 string filename = Midori.Download.get_basename_for_display (download.destination);
1907
1908 string size = "%s".printf (format_size (download.get_received_data_length ()));
1909@@ -134,17 +50,12 @@
1910 if (is_finished (download))
1911 return "%s\n %s".printf (filename, size);
1912 return "%s\n %s - %s".printf (filename, speed, progress);
1913-#endif
1914 }
1915
1916 public static string get_content_type (WebKit.Download download, string? mime_type) {
1917-#if HAVE_WEBKIT2
1918 string? content_type = ContentType.guess (download.response.suggested_filename == null ?
1919 download.destination : download.response.suggested_filename,
1920 null, null);
1921-#else
1922- string? content_type = ContentType.guess (download.suggested_filename, null, null);
1923-#endif
1924 if (content_type == null) {
1925 content_type = ContentType.from_mime_type (mime_type);
1926 if (content_type == null)
1927@@ -157,24 +68,14 @@
1928 int status = download.get_data<int> ("checksum-status");
1929 if (status == 0) {
1930 /* Link Fingerprint */
1931- #if HAVE_WEBKIT2
1932 string? original_uri = download.get_request ().uri;
1933- #else
1934- string? original_uri = download.network_request.get_data<string> ("midori-original-uri");
1935- if (original_uri == null)
1936- original_uri = download.get_uri ();
1937- #endif
1938 string? fingerprint;
1939 ChecksumType checksum_type = URI.get_fingerprint (original_uri, out fingerprint, null);
1940 /* By default, no wrong checksum */
1941 status = 2;
1942 if (fingerprint != null) {
1943 try {
1944- #if HAVE_WEBKIT2
1945 string filename = Filename.from_uri (download.destination);
1946- #else
1947- string filename = Filename.from_uri (download.destination_uri);
1948- #endif
1949 string contents;
1950 size_t length;
1951 bool y = FileUtils.get_contents (filename, out contents, out length);
1952@@ -194,62 +95,16 @@
1953 }
1954
1955 public static bool action_clear (WebKit.Download download, Gtk.Widget widget) throws Error {
1956-#if !HAVE_WEBKIT2
1957- switch (download.status) {
1958- case WebKit.DownloadStatus.CREATED:
1959- case WebKit.DownloadStatus.STARTED:
1960- download.cancel ();
1961- break;
1962- case WebKit.DownloadStatus.FINISHED:
1963- if (open (download, widget))
1964- return true;
1965- break;
1966- case WebKit.DownloadStatus.CANCELLED:
1967- return true;
1968- default:
1969- critical ("action_clear: %d", download.status);
1970- warn_if_reached ();
1971- break;
1972- }
1973- #else
1974-
1975- if (download.estimated_progress < 1) {
1976- download.cancel ();
1977- } else {
1978- if (open (download, widget))
1979- return true;
1980- }
1981-#endif
1982 return false;
1983 }
1984
1985 public static string action_stock_id (WebKit.Download download) {
1986-#if !HAVE_WEBKIT2
1987- switch (download.status) {
1988- case WebKit.DownloadStatus.CREATED:
1989- case WebKit.DownloadStatus.STARTED:
1990- return Gtk.Stock.CANCEL;
1991- case WebKit.DownloadStatus.FINISHED:
1992- if (has_wrong_checksum (download))
1993- return Gtk.Stock.DIALOG_WARNING;
1994- return Gtk.Stock.OPEN;
1995- case WebKit.DownloadStatus.CANCELLED:
1996- return Gtk.Stock.CLEAR;
1997- case WebKit.DownloadStatus.ERROR:
1998- return Gtk.Stock.DIALOG_ERROR;
1999- default:
2000- critical ("action_stock_id: %d", download.status);
2001- warn_if_reached ();
2002- return Gtk.Stock.MISSING_IMAGE;
2003- }
2004-#else
2005 if (download.estimated_progress == 1)
2006 if (has_wrong_checksum (download))
2007 return Gtk.Stock.DIALOG_WARNING;
2008 else
2009 return Gtk.Stock.OPEN;
2010 return Gtk.Stock.CANCEL;
2011-#endif
2012 }
2013
2014 /* returns whether an application was successfully launched to handle the file */
2015@@ -265,11 +120,7 @@
2016 Tab? tab = null;
2017 browser.get ("tab", &tab);
2018 if (tab != null)
2019- #if HAVE_WEBKIT2
2020 return tab.open_uri (download.destination);
2021- #else
2022- return tab.open_uri (download.destination_uri);
2023- #endif
2024 }
2025 return false;
2026 }
2027@@ -297,16 +148,10 @@
2028 }
2029
2030 public string get_suggested_filename (WebKit.Download download) {
2031-#if !HAVE_WEBKIT2
2032- /* https://bugs.webkit.org/show_bug.cgi?id=83161
2033- https://d19vezwu8eufl6.cloudfront.net/nlp/slides%2F03-01-FormalizingNB.pdf */
2034- return clean_filename (download.get_suggested_filename ());
2035-#else
2036 string name = get_filename (download);
2037 if (name == null)
2038 return "";
2039 return name;
2040-#endif
2041 }
2042
2043 /**
2044@@ -397,42 +242,6 @@
2045 * @destination_uri, considering space on disk and permissions
2046 */
2047 public static bool has_enough_space (WebKit.Download download, string destination_uri, bool quiet=false) {
2048-#if !HAVE_WEBKIT2
2049- var folder = File.new_for_uri (destination_uri).get_parent ();
2050- bool can_write;
2051- uint64 free_space;
2052- try {
2053- var info = folder.query_filesystem_info ("filesystem::free");
2054- free_space = info.get_attribute_uint64 ("filesystem::free");
2055- info = folder.query_info ("access::can-write", 0);
2056- can_write = info.get_attribute_boolean ("access::can-write");
2057- }
2058- catch (Error error) {
2059- can_write = false;
2060- free_space = 0;
2061- }
2062-
2063- if (free_space < download.total_size || !can_write) {
2064- string message;
2065- string detailed_message;
2066- if (!can_write) {
2067- message = _("The file \"%s\" can't be saved in this folder.").printf (
2068- Midori.Download.get_basename_for_display (destination_uri));
2069- detailed_message = _("You don't have permission to write in this location.");
2070- }
2071- else if (free_space < download.total_size) {
2072- message = _("There is not enough free space to download \"%s\".").printf (
2073- Midori.Download.get_basename_for_display (destination_uri));
2074- detailed_message = _("The file needs %s but only %s are left.").printf (
2075- format_size (download.total_size), format_size (free_space));
2076- }
2077- else
2078- assert_not_reached ();
2079- if (!quiet)
2080- Sokoke.message_dialog (Gtk.MessageType.ERROR, message, detailed_message, false);
2081- return false;
2082- }
2083-#endif
2084 return true;
2085 }
2086 }
2087
2088=== modified file 'midori/midori-frontend.c'
2089--- midori/midori-frontend.c 2016-01-23 19:21:31 +0000
2090+++ midori/midori-frontend.c 2016-09-20 20:57:01 +0000
2091@@ -175,9 +175,6 @@
2092 guint i;
2093
2094 midori_paths_init (MIDORI_RUNTIME_MODE_PRIVATE, config);
2095-#ifndef HAVE_WEBKIT2
2096- g_object_set_data (G_OBJECT (webkit_get_default_session ()), "pass-through-console", (void*)1);
2097-#endif
2098
2099 /* Mask the timezone, which can be read by Javascript */
2100 g_setenv ("TZ", "UTC", TRUE);
2101
2102=== modified file 'midori/midori-locationaction.c'
2103--- midori/midori-locationaction.c 2015-08-10 23:42:56 +0000
2104+++ midori/midori-locationaction.c 2016-09-20 20:57:01 +0000
2105@@ -22,6 +22,7 @@
2106 #include "config.h"
2107 #include <string.h>
2108 #include <glib/gi18n.h>
2109+#include <gdk/gdk.h>
2110 #include <gdk/gdkkeysyms.h>
2111
2112 #include <sqlite3.h>
2113@@ -46,6 +47,10 @@
2114 gint completion_index;
2115 GtkWidget* entry;
2116 KatzeArray* history;
2117+ #if GTK_CHECK_VERSION (3, 18, 0)
2118+ GdkDevice* device;
2119+ guint32 time;
2120+ #endif
2121 };
2122
2123 struct _MidoriLocationActionClass
2124@@ -738,6 +743,8 @@
2125 g_signal_connect (popup, "destroy",
2126 G_CALLBACK (gtk_widget_destroyed), &action->popup);
2127 gtk_widget_show_all (popup_frame);
2128+
2129+ gtk_widget_realize (action->popup);
2130 }
2131
2132 if (!gtk_widget_get_visible (action->popup))
2133@@ -746,6 +753,21 @@
2134 gtk_window_set_screen (GTK_WINDOW (action->popup),
2135 gtk_widget_get_screen (action->entry));
2136 gtk_window_set_transient_for (GTK_WINDOW (action->popup), GTK_WINDOW (toplevel));
2137+ gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
2138+ GTK_WINDOW (action->popup));
2139+
2140+ #if GTK_CHECK_VERSION (3, 18, 0)
2141+ GdkDevice* device = action->device;
2142+
2143+ if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
2144+ device = gdk_device_get_associated_device (device);
2145+
2146+ gdk_device_grab (device, gtk_widget_get_window (action->popup),
2147+ GDK_OWNERSHIP_WINDOW, TRUE,
2148+ GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
2149+ NULL, action->time);
2150+ #endif
2151+
2152 #if GTK_CHECK_VERSION (3, 4, 0)
2153 gtk_window_set_attached_to (GTK_WINDOW (action->popup), action->entry);
2154 #endif
2155@@ -767,6 +789,10 @@
2156 g_signal_connect (entry, "destroy",
2157 G_CALLBACK (gtk_widget_destroyed), &action->entry);
2158 }
2159+ #if GTK_CHECK_VERSION (3, 18, 0)
2160+ action->device = gtk_get_current_event_device ();
2161+ action->time = gtk_get_current_event_time ();
2162+ #endif
2163 g_idle_add (midori_location_action_popup_timeout_cb, action);
2164 }
2165
2166@@ -1294,33 +1320,6 @@
2167 #include <gcr/gcr.h>
2168 #endif
2169
2170-#ifndef HAVE_WEBKIT2
2171-static GHashTable* message_map = NULL;
2172-void
2173-midori_map_add_message (SoupMessage* message)
2174-{
2175- SoupURI* uri = soup_message_get_uri (message);
2176- if (message_map == NULL)
2177- message_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
2178- g_return_if_fail (uri && uri->host);
2179- g_hash_table_insert (message_map, g_strdup (uri->host), g_object_ref (message));
2180-}
2181-
2182-SoupMessage*
2183-midori_map_get_message (SoupMessage* message)
2184-{
2185- SoupURI* uri = soup_message_get_uri (message);
2186- SoupMessage* full;
2187- g_return_val_if_fail (uri && uri->host, message);
2188- if (message_map == NULL)
2189- message_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
2190- full = g_hash_table_lookup (message_map, uri->host);
2191- if (full != NULL)
2192- return full;
2193- return message;
2194-}
2195-#endif
2196-
2197 #ifdef HAVE_GCR
2198 typedef enum {
2199 MIDORI_CERT_TRUST,
2200@@ -1458,14 +1457,7 @@
2201
2202 MidoriBrowser* browser = midori_browser_get_for_widget (widget);
2203 MidoriView* view = MIDORI_VIEW (midori_browser_get_current_tab (browser));
2204- #ifdef HAVE_WEBKIT2
2205 void* request = NULL;
2206- #else
2207- WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
2208- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (web_view);
2209- WebKitWebDataSource* source = webkit_web_frame_get_data_source (web_frame);
2210- WebKitNetworkRequest* request = webkit_web_data_source_get_request (source);
2211- #endif
2212 midori_view_get_tls_info (view, request, &tls_cert, &tls_flags, &hostname);
2213 if (tls_cert == NULL)
2214 {
2215@@ -1482,12 +1474,10 @@
2216 der_cert->data, der_cert->len);
2217 g_byte_array_unref (der_cert);
2218
2219- #if GTK_CHECK_VERSION (3, 0, 0)
2220 GtkWidget* details;
2221 details = (GtkWidget*)gcr_certificate_details_widget_new (gcr_cert);
2222 gtk_widget_show (details);
2223 gtk_container_add (GTK_CONTAINER (box), details);
2224- #endif
2225
2226 #if GTK_CHECK_VERSION (3, 12, 0)
2227 GtkWidget* button;
2228@@ -1527,10 +1517,6 @@
2229 g_object_set_data_full (G_OBJECT (dialog), "gcr-cert", gcr_cert, (GDestroyNotify)g_object_unref);
2230 #endif
2231
2232- /* With GTK+2 the scrolled contents can't communicate a natural size to the window */
2233- #if !GTK_CHECK_VERSION (3, 0, 0)
2234- gtk_window_set_default_size (GTK_WINDOW (dialog), 250, 200);
2235- #endif
2236 if (!g_tls_certificate_get_issuer (tls_cert))
2237 gtk_box_pack_start (box, gtk_label_new (_("Self-signed")), FALSE, FALSE, 0);
2238
2239
2240=== modified file 'midori/midori-preferences.c'
2241--- midori/midori-preferences.c 2015-07-06 21:26:46 +0000
2242+++ midori/midori-preferences.c 2016-09-20 20:57:01 +0000
2243@@ -371,20 +371,6 @@
2244 INDENTED_ADD (button);
2245 button = katze_property_proxy (settings, "enable-webgl", NULL);
2246 gtk_button_set_label (GTK_BUTTON (button), _("Enable WebGL support"));
2247- #ifndef HAVE_WEBKIT2
2248- if (parent && MIDORI_IS_BROWSER (parent))
2249- {
2250- GtkWidget* tab = midori_browser_get_current_tab (MIDORI_BROWSER (parent));
2251- WebKitWebView* web_view = midori_tab_get_web_view (MIDORI_TAB (tab));
2252- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
2253- JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
2254- gchar* supports_web_gl = sokoke_js_script_eval (js_context,
2255- "!!window.WebGLRenderingContext", NULL);
2256- if (g_strcmp0 (supports_web_gl, "true"))
2257- gtk_widget_hide (button);
2258- g_free (supports_web_gl);
2259- }
2260- #endif
2261 SPANNED_ADD (button);
2262 button = katze_property_proxy (settings, "zoom-text-and-images", NULL);
2263 gtk_button_set_label (GTK_BUTTON (button), _("Zoom Text and Images"));
2264@@ -522,21 +508,6 @@
2265 g_signal_connect_object (settings, "notify::proxy-type",
2266 G_CALLBACK (midori_preferences_notify_proxy_type_cb), label, 0);
2267 midori_preferences_notify_proxy_type_cb (settings, NULL, label);
2268-#ifndef HAVE_WEBKIT2
2269- if (soup_session_get_feature (webkit_get_default_session (), SOUP_TYPE_CACHE))
2270- {
2271- label = gtk_label_new (_("Web Cache"));
2272- gtk_widget_set_tooltip_text (label, _("The maximum size of cached pages on disk"));
2273- INDENTED_ADD (label);
2274- button = katze_property_proxy (settings, "maximum-cache-size", NULL);
2275- gtk_spin_button_set_range (GTK_SPIN_BUTTON (button), 0, G_MAXINT);
2276- gtk_widget_set_tooltip_text (button, _("The maximum size of cached pages on disk"));
2277- SPANNED_ADD (button);
2278- label = gtk_label_new (_("MB"));
2279- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
2280- SPANNED_ADD (label);
2281- }
2282-#endif
2283 /* i18n: This refers to an application, not the 'user agent' string */
2284 label = gtk_label_new (_("Identify as"));
2285 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
2286
2287=== modified file 'midori/midori-privatedata.c'
2288--- midori/midori-privatedata.c 2015-07-06 21:26:46 +0000
2289+++ midori/midori-privatedata.c 2016-09-20 20:57:01 +0000
2290@@ -281,28 +281,9 @@
2291 static void
2292 midori_clear_web_cookies_cb (void)
2293 {
2294-#ifdef HAVE_WEBKIT2
2295 WebKitWebContext* context = webkit_web_context_get_default ();
2296 WebKitCookieManager* cookie_manager = webkit_web_context_get_cookie_manager (context);
2297 webkit_cookie_manager_delete_all_cookies (cookie_manager);
2298- /* FIXME: site data policy */
2299-#else
2300- SoupSession* session = webkit_get_default_session ();
2301- MidoriWebSettings* settings = g_object_get_data (G_OBJECT (session), "midori-settings");
2302- SoupSessionFeature* jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
2303- GSList* cookies = soup_cookie_jar_all_cookies (SOUP_COOKIE_JAR (jar));
2304-
2305- /* HTTP Cookies/ Web Cookies */
2306- for (; cookies != NULL; cookies = g_slist_next (cookies))
2307- {
2308- const gchar* domain = ((SoupCookie*)cookies->data)->domain;
2309- if (midori_web_settings_get_site_data_policy (settings, domain)
2310- == MIDORI_SITE_DATA_PRESERVE)
2311- continue;
2312- soup_cookie_jar_delete_cookie ((SoupCookieJar*)jar, cookies->data);
2313- }
2314- soup_cookies_free (cookies);
2315-#endif
2316
2317 /* Local shared objects/ Flash cookies */
2318 if (midori_web_settings_has_plugin_support ())
2319@@ -324,17 +305,7 @@
2320 #endif
2321 }
2322
2323-#ifdef HAVE_WEBKIT2
2324 /* TODO: clear databases and offline app caches */
2325-#else
2326- /* HTML5 databases */
2327- webkit_remove_all_web_databases ();
2328-
2329- /* HTML5 offline application caches */
2330- /* Changing the size implies clearing the cache */
2331- webkit_application_cache_set_maximum_size (
2332- webkit_application_cache_get_maximum_size () - 1);
2333-#endif
2334 }
2335
2336 static void
2337@@ -358,17 +329,7 @@
2338 static void
2339 midori_clear_web_cache_cb (void)
2340 {
2341-#ifdef HAVE_WEBKIT2
2342 webkit_web_context_clear_cache (webkit_web_context_get_default ());
2343-#else
2344- SoupSession* session = webkit_get_default_session ();
2345- SoupSessionFeature* feature = soup_session_get_feature (session, SOUP_TYPE_CACHE);
2346- gchar* cache = g_build_filename (midori_paths_get_cache_dir (), "web", NULL);
2347- soup_cache_clear (SOUP_CACHE (feature));
2348- soup_cache_flush (SOUP_CACHE (feature));
2349- midori_paths_remove_path (cache);
2350- g_free (cache);
2351-#endif
2352 }
2353
2354 void
2355
2356=== modified file 'midori/midori-searchaction.c'
2357--- midori/midori-searchaction.c 2015-07-06 21:26:46 +0000
2358+++ midori/midori-searchaction.c 2016-09-20 20:57:01 +0000
2359@@ -914,125 +914,8 @@
2360 midori_search_action_get_engine_for_form (WebKitWebView* web_view,
2361 PangoEllipsizeMode ellipsize)
2362 {
2363-#ifndef HAVE_WEBKIT2
2364- WebKitWebFrame* focused_frame;
2365- WebKitDOMDocument* doc;
2366- WebKitDOMHTMLFormElement* active_form;
2367- WebKitDOMHTMLCollection* form_nodes;
2368- WebKitDOMElement* active_element;
2369- gchar* token_element;
2370- const gchar* title;
2371- GString* uri_str;
2372- gulong form_len;
2373- const gchar* action;
2374- guint i;
2375- KatzeItem* item;
2376- gchar** parts;
2377-
2378- focused_frame = webkit_web_view_get_focused_frame (web_view);
2379- if (focused_frame == NULL)
2380- return NULL;
2381- #if WEBKIT_CHECK_VERSION (1, 9, 5)
2382- doc = webkit_web_frame_get_dom_document (focused_frame);
2383- #else
2384- if (focused_frame != webkit_web_view_get_main_frame (web_view))
2385- return NULL;
2386- doc = webkit_web_view_get_dom_document (web_view);
2387- #endif
2388-
2389- active_element = webkit_dom_html_document_get_active_element ((WebKitDOMHTMLDocument*)doc);
2390- if (!WEBKIT_DOM_IS_HTML_INPUT_ELEMENT (active_element))
2391- return NULL;
2392-
2393- active_form = webkit_dom_html_input_element_get_form ((WebKitDOMHTMLInputElement*)active_element);
2394- if (!active_form)
2395- return NULL;
2396-
2397- token_element = webkit_dom_element_get_attribute (active_element, "name");
2398-
2399- form_nodes = webkit_dom_html_form_element_get_elements (active_form);
2400- form_len = webkit_dom_html_form_element_get_length (active_form);
2401-
2402- /* action NULL or "": relative path */
2403- if ((action = webkit_dom_html_form_element_get_action (active_form)) && *action)
2404- uri_str = g_string_new (action);
2405- else
2406- {
2407- gchar* hostname = midori_uri_parse_hostname (webkit_web_view_get_uri (web_view), NULL);
2408- uri_str = g_string_new ("http://");
2409- g_string_append (uri_str, hostname);
2410- g_free (hostname);
2411- }
2412- g_string_append_c (uri_str, '?');
2413-
2414- for (i = 0; i < form_len; i++)
2415- {
2416- WebKitDOMNode* form_node = webkit_dom_html_collection_item (form_nodes, i);
2417- WebKitDOMElement* form_element = (WebKitDOMElement*) form_node;
2418- gchar* name = webkit_dom_element_get_attribute (form_element, "name");
2419-
2420- if (name && *name)
2421- {
2422- if (!g_strcmp0 (token_element, name))
2423- g_string_append_printf (uri_str, "%s=%s&", name, "\%s");
2424- else
2425- {
2426- gchar* value;
2427- if (!g_strcmp0 (webkit_dom_element_get_tag_name (form_element), "SELECT"))
2428- {
2429- WebKitDOMHTMLSelectElement* select_element = (WebKitDOMHTMLSelectElement*) form_element;
2430- gulong pos = webkit_dom_html_select_element_get_selected_index (select_element);
2431- WebKitDOMNode* selected_node = webkit_dom_html_select_element_item (select_element, pos);
2432- WebKitDOMElement* selected_element = (WebKitDOMElement*) selected_node;
2433-
2434- value = webkit_dom_element_get_attribute (selected_element, "value");
2435- }
2436- else
2437- value = webkit_dom_element_get_attribute (form_element, "value");
2438-
2439- g_string_append_printf (uri_str, "%s=%s&", name, value);
2440- g_free (value);
2441- }
2442- g_free (name);
2443- }
2444- }
2445-
2446- if (!(title = webkit_web_view_get_title (web_view)))
2447- title = webkit_web_view_get_uri (web_view);
2448-
2449- item = katze_item_new ();
2450- item->uri = g_string_free (uri_str, FALSE);
2451- item->token = midori_search_action_token_for_uri (webkit_web_view_get_uri (web_view));
2452-
2453- if (strstr (title, " - "))
2454- parts = g_strsplit (title, " - ", 2);
2455- else if (strstr (title, ": "))
2456- parts = g_strsplit (title, ": ", 2);
2457- else
2458- parts = NULL;
2459- if (parts != NULL)
2460- {
2461- /* See midori_view_set_title: title can be first or last */
2462- if (ellipsize == PANGO_ELLIPSIZE_END)
2463- {
2464- katze_item_set_name (item, parts[0]);
2465- katze_item_set_text (item, parts[1]);
2466- }
2467- else
2468- {
2469- katze_item_set_name (item, parts[1]);
2470- katze_item_set_text (item, parts[2]);
2471- }
2472- g_strfreev (parts);
2473- }
2474- else
2475- katze_item_set_name (item, title);
2476-
2477- g_free (token_element);
2478- return item;
2479- #else
2480+ // TODO: Implement
2481 return NULL;
2482- #endif
2483 }
2484
2485 void
2486
2487=== modified file 'midori/midori-session.c'
2488--- midori/midori-session.c 2015-03-23 11:33:24 +0000
2489+++ midori/midori-session.c 2016-09-20 20:57:01 +0000
2490@@ -17,300 +17,34 @@
2491 #include "sokoke.h"
2492
2493 #include <glib/gi18n-lib.h>
2494-#include <libsoup/soup-cookie-jar-sqlite.h>
2495-#include <libsoup/soup-gnome-features.h>
2496-
2497- #define LIBSOUP_USE_UNSTABLE_REQUEST_API
2498- #include <libsoup/soup-cache.h>
2499-
2500-#ifndef HAVE_WEBKIT2
2501-static void
2502-midori_soup_session_set_proxy_uri (SoupSession* session,
2503- const gchar* uri)
2504-{
2505- SoupURI* proxy_uri;
2506-
2507- /* soup_uri_new expects a non-NULL string with a protocol */
2508- gchar* scheme = uri ? g_uri_parse_scheme (uri): NULL;
2509- if (scheme)
2510- {
2511- proxy_uri = soup_uri_new (uri);
2512- g_free (scheme);
2513- }
2514- else if (uri && *uri)
2515- {
2516- gchar* fixed_uri = g_strconcat ("http://", uri, NULL);
2517- proxy_uri = soup_uri_new (fixed_uri);
2518- g_free (fixed_uri);
2519- }
2520- else
2521- proxy_uri = NULL;
2522- g_object_set (session, "proxy-uri", proxy_uri, NULL);
2523- if (proxy_uri)
2524- soup_uri_free (proxy_uri);
2525-}
2526-
2527-static void
2528-soup_session_settings_notify_http_proxy_cb (MidoriWebSettings* settings,
2529- GParamSpec* pspec,
2530- SoupSession* session)
2531-{
2532- gboolean uses_proxy = TRUE;
2533- MidoriProxy proxy_type = katze_object_get_enum (settings, "proxy-type");
2534- if (proxy_type == MIDORI_PROXY_AUTOMATIC)
2535- {
2536- soup_session_add_feature_by_type (session, SOUP_TYPE_PROXY_RESOLVER_GNOME);
2537-
2538- GProxyResolver* resolver = g_proxy_resolver_get_default ();
2539- gchar** proxies = g_proxy_resolver_lookup (resolver, "none", NULL, NULL);
2540-
2541- if (!proxies || !g_strcmp0 (proxies[0], "direct://"))
2542- uses_proxy = FALSE;
2543- g_strfreev (proxies);
2544- }
2545- else if (proxy_type == MIDORI_PROXY_HTTP)
2546- {
2547- soup_session_remove_feature_by_type (session, SOUP_TYPE_PROXY_RESOLVER_GNOME);
2548- gchar* proxy = katze_object_get_string (settings, "http-proxy");
2549- GString* http_proxy = g_string_new (proxy);
2550- g_string_append_printf (http_proxy, ":%d", katze_object_get_int (settings, "http-proxy-port"));
2551- midori_soup_session_set_proxy_uri (session, http_proxy->str);
2552- g_string_free (http_proxy, TRUE);
2553- g_free (proxy);
2554- }
2555- else
2556- {
2557- uses_proxy = FALSE;
2558- soup_session_remove_feature_by_type (session, SOUP_TYPE_PROXY_RESOLVER_GNOME);
2559- midori_soup_session_set_proxy_uri (session, NULL);
2560- }
2561-
2562- /* If a proxy server looks to be active, we disable prefetching, otherwise
2563- libSoup may be prefetching outside the proxy server beyond our control.
2564- */
2565-
2566- if (uses_proxy)
2567- g_object_set (settings, "enable-dns-prefetching", FALSE, NULL);
2568-}
2569-#endif
2570-
2571-#if WEBKIT_CHECK_VERSION (1, 1, 21)
2572+#include <libsoup/soup-cookie-jar-db.h>
2573+#define LIBSOUP_USE_UNSTABLE_REQUEST_API
2574+#include <libsoup/soup-cache.h>
2575+
2576 static void
2577 soup_session_settings_notify_first_party_cb (MidoriWebSettings* settings,
2578 GParamSpec* pspec,
2579 gpointer user_data)
2580 {
2581 gboolean yes = katze_object_get_boolean (settings, "first-party-cookies-only");
2582-#ifdef HAVE_WEBKIT2
2583 WebKitWebContext* context = webkit_web_context_get_default ();
2584 WebKitCookieManager* cookie_manager = webkit_web_context_get_cookie_manager (context);
2585 webkit_cookie_manager_set_accept_policy (cookie_manager,
2586 yes ? WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY
2587 : WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS);
2588-#else
2589- SoupSession* session = webkit_get_default_session ();
2590- gpointer jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
2591- g_object_set (jar, "accept-policy",
2592- yes ? SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY
2593- : SOUP_COOKIE_JAR_ACCEPT_ALWAYS, NULL);
2594-#endif
2595-}
2596-#endif
2597-
2598-#if !defined (HAVE_WEBKIT2)
2599-/* Implemented in MidoriLocationAction */
2600-void
2601-midori_map_add_message (SoupMessage* message);
2602-
2603-static void
2604-midori_soup_session_request_started_cb (SoupSession* session,
2605- SoupMessage* message,
2606- SoupSocket* socket,
2607- gpointer user_data)
2608-{
2609- midori_map_add_message (message);
2610-}
2611-#endif
2612-
2613-#ifndef HAVE_WEBKIT2
2614-const gchar*
2615-midori_web_settings_get_accept_language (MidoriWebSettings* settings);
2616-
2617-static void
2618-midori_soup_session_settings_accept_language_cb (SoupSession* session,
2619- SoupMessage* msg,
2620- MidoriWebSettings* settings)
2621-{
2622- const gchar* accept = midori_web_settings_get_accept_language (settings);
2623- soup_message_headers_append (msg->request_headers, "Accept-Language", accept);
2624-
2625- if (katze_object_get_boolean (settings, "strip-referer"))
2626- {
2627- const gchar* referer
2628- = soup_message_headers_get_one (msg->request_headers, "Referer");
2629- SoupURI* destination = soup_message_get_uri (msg);
2630- SoupURI* stripped_uri;
2631- if (referer && destination && !strstr (referer, destination->host)
2632- && (stripped_uri = soup_uri_new (referer)))
2633- {
2634- gchar* stripped_referer;
2635- soup_uri_set_path (stripped_uri, "");
2636- soup_uri_set_query (stripped_uri, NULL);
2637- stripped_referer = soup_uri_to_string (stripped_uri, FALSE);
2638- soup_uri_free (stripped_uri);
2639- if (strcmp (stripped_referer, referer))
2640- {
2641- if (midori_debug ("referer"))
2642- g_message ("Referer '%s' stripped to '%s'", referer, stripped_referer);
2643- soup_message_headers_replace (msg->request_headers, "Referer",
2644- stripped_referer);
2645- }
2646- g_free (stripped_referer);
2647- }
2648-
2649- /* With HTTP, Host is optional. Strip to outsmart some filter proxies */
2650- if (destination && destination->scheme == SOUP_URI_SCHEME_HTTP)
2651- soup_message_headers_remove (msg->request_headers, "Host");
2652- }
2653-}
2654-#endif
2655+}
2656
2657 gboolean
2658 midori_load_soup_session (gpointer settings)
2659 {
2660- #if WEBKIT_CHECK_VERSION (1, 1, 21)
2661 g_signal_connect (settings, "notify::first-party-cookies-only",
2662 G_CALLBACK (soup_session_settings_notify_first_party_cb), NULL);
2663- #endif
2664-
2665-#ifndef HAVE_WEBKIT2
2666- SoupSession* session = webkit_get_default_session ();
2667-
2668- #ifndef G_OS_WIN32
2669- g_object_set (session,
2670- "ssl-use-system-ca-file", TRUE,
2671- "ssl-strict", FALSE,
2672- NULL);
2673- #else /* G_OS_WIN32 */
2674- /* We cannot use "ssl-use-system-ca-file" on Windows
2675- * some GTLS backend pieces are missing currently.
2676- * Instead we specify the bundle we ship ourselves */
2677- gchar* certificate_file = midori_paths_get_res_filename ("ca-bundle.crt");
2678- g_object_set (session,
2679- "ssl-ca-file", certificate_file,
2680- "ssl-strict", FALSE,
2681- NULL);
2682- g_free (certificate_file);
2683- #endif
2684-
2685- g_object_set_data (G_OBJECT (session), "midori-settings", settings);
2686- soup_session_settings_notify_http_proxy_cb (settings, NULL, session);
2687- g_signal_connect (settings, "notify::http-proxy",
2688- G_CALLBACK (soup_session_settings_notify_http_proxy_cb), session);
2689- g_signal_connect (settings, "notify::proxy-type",
2690- G_CALLBACK (soup_session_settings_notify_http_proxy_cb), session);
2691-
2692- g_signal_connect (session, "request-started",
2693- G_CALLBACK (midori_soup_session_request_started_cb), session);
2694- g_signal_connect (session, "request-queued",
2695- G_CALLBACK (midori_soup_session_settings_accept_language_cb), settings);
2696-
2697- soup_session_add_feature (session, SOUP_SESSION_FEATURE (midori_hsts_new ()));
2698-
2699- if (midori_debug ("headers"))
2700- {
2701- SoupLogger* logger = soup_logger_new (SOUP_LOGGER_LOG_HEADERS, -1);
2702- soup_logger_attach (logger, session);
2703- g_object_unref (logger);
2704- }
2705- else if (midori_debug ("body"))
2706- {
2707- SoupLogger* logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
2708- soup_logger_attach (logger, session);
2709- g_object_unref (logger);
2710- }
2711-
2712- g_object_set_data (G_OBJECT (session), "midori-session-initialized", (void*)1);
2713-#endif
2714 return FALSE;
2715 }
2716
2717-#ifndef HAVE_WEBKIT2
2718-static void
2719-midori_session_cookie_jar_changed_cb (SoupCookieJar* jar,
2720- SoupCookie* old_cookie,
2721- SoupCookie* new_cookie,
2722- MidoriWebSettings* settings)
2723-{
2724-
2725- if (midori_debug ("cookies"))
2726- {
2727- gchar* old = old_cookie ? soup_cookie_to_cookie_header (old_cookie) : NULL;
2728- gchar* new = new_cookie ? soup_cookie_to_cookie_header (new_cookie) : NULL;
2729- g_print ("cookie changed from %s to %s\n", old, new);
2730- g_free (old);
2731- g_free (new);
2732- }
2733-
2734- /* Don't allow revival of expiring cookies */
2735- if (new_cookie && old_cookie && old_cookie->expires)
2736- soup_cookie_set_expires (new_cookie, old_cookie->expires);
2737-
2738- if (new_cookie && new_cookie->expires)
2739- {
2740- time_t expires = soup_date_to_time_t (new_cookie->expires);
2741- gint age = katze_object_get_int (settings, "maximum-cookie-age");
2742- /* An age of 0 to SoupCookie means already-expired
2743- A user choosing 0 days probably expects 1 hour.
2744- */
2745- int seconds = age > 0 ? age * SOUP_COOKIE_MAX_AGE_ONE_DAY : SOUP_COOKIE_MAX_AGE_ONE_HOUR;
2746- SoupDate* max_date = soup_date_new_from_now (seconds);
2747- if (expires > soup_date_to_time_t (max_date))
2748- {
2749- if (midori_debug ("cookies"))
2750- {
2751- gchar* new_date = soup_date_to_string (max_date, SOUP_DATE_COOKIE);
2752- g_print ("^^ enforcing expiry: %s\n", new_date);
2753- g_free (new_date);
2754- }
2755- soup_cookie_set_expires (new_cookie, max_date);
2756- }
2757- soup_date_free (max_date);
2758- }
2759-}
2760-#endif
2761-
2762 gboolean
2763 midori_load_soup_session_full (gpointer settings)
2764 {
2765- #ifndef HAVE_WEBKIT2
2766- SoupSession* session = webkit_get_default_session ();
2767- SoupCookieJar* jar;
2768- gchar* config_file;
2769- SoupSessionFeature* feature;
2770-
2771- midori_load_soup_session (settings);
2772-
2773- config_file = midori_paths_get_config_filename_for_writing ("logins");
2774- feature = g_object_new (KATZE_TYPE_HTTP_AUTH, "filename", config_file, NULL);
2775- soup_session_add_feature (session, feature);
2776- g_object_unref (feature);
2777-
2778- katze_assign (config_file, midori_paths_get_config_filename_for_writing ("cookies.db"));
2779- jar = soup_cookie_jar_sqlite_new (config_file, FALSE);
2780- soup_session_add_feature (session, SOUP_SESSION_FEATURE (jar));
2781- g_signal_connect (jar, "changed",
2782- G_CALLBACK (midori_session_cookie_jar_changed_cb), settings);
2783- g_object_unref (jar);
2784-
2785- katze_assign (config_file, g_build_filename (midori_paths_get_cache_dir (), "web", NULL));
2786- feature = SOUP_SESSION_FEATURE (soup_cache_new (config_file, 0));
2787- soup_session_add_feature (session, feature);
2788- soup_cache_set_max_size (SOUP_CACHE (feature),
2789- katze_object_get_int (settings, "maximum-cache-size") * 1024 * 1024);
2790- soup_cache_load (SOUP_CACHE (feature));
2791- g_free (config_file);
2792- #endif
2793 return FALSE;
2794 }
2795
2796
2797=== modified file 'midori/midori-settings.vala'
2798--- midori/midori-settings.vala 2013-11-24 21:50:38 +0000
2799+++ midori/midori-settings.vala 2016-09-20 20:57:01 +0000
2800@@ -19,23 +19,6 @@
2801 FULLSCREEN
2802 }
2803 /* Since: 0.1.3 */
2804-#if !HAVE_WEBKIT2
2805- public class Settings : WebKit.WebSettings {
2806- /* Since: 0.5.0 */
2807- public bool enable_javascript { get {
2808- return enable_scripts;
2809- } set {
2810- enable_scripts = value;
2811- } }
2812- /* Since: 0.5.1 */
2813- public string default_charset { owned get {
2814- return default_encoding;
2815- } set {
2816- default_encoding = value;
2817- } }
2818- /* Since: 0.1.3 */
2819- public bool zoom_text_and_images { get; set; default = true; }
2820-#else
2821 public class Settings : WebKit.Settings {
2822 public bool zoom_text_and_images { get {
2823 return !zoom_text_only;
2824@@ -47,7 +30,6 @@
2825 } set {
2826 WebKit.WebContext.get_default ().set_spell_checking_enabled (value);
2827 } }
2828-#endif
2829 public bool remember_last_window_size { get; set; default = true; }
2830 public int last_window_width { get; set; default = 0; }
2831 public int last_window_height { get; set; default = 0; }
2832@@ -62,6 +44,9 @@
2833 /* Since: 0.1.3 */
2834 public WindowState last_window_state { get; set; default = WindowState.NORMAL; }
2835
2836+ GLib.HashTable<string, WebKit.UserStyleSheet> user_stylesheets;
2837+ public WebKit.UserContentManager user_content_manager { get; private set; default = new WebKit.UserContentManager(); }
2838+
2839 /* Since: 0.4.8 */
2840 public uint inactivity_reset { get; set; default = 0; }
2841
2842@@ -90,21 +75,7 @@
2843 public string? block_uris { get {
2844 return block_uris_regex != null ? block_uris_regex.get_pattern () : null;
2845 } set {
2846-#if !HAVE_WEBKIT2
2847- if (value == null || value == "")
2848- return;
2849- if (block_uris_regex == null)
2850- WebKit.get_default_session ().request_queued.connect ((msg) => {
2851- if (block_uris_regex.match (msg.uri.to_string (false)))
2852- msg.uri = new Soup.URI ("http://.invalid");
2853- });
2854- try {
2855- block_uris_regex = new GLib.Regex (value);
2856- }
2857- catch (Error error) {
2858- critical ("block-uris: %s", error.message);
2859- }
2860-#endif
2861+ // TODO: Implement
2862 } }
2863
2864 /**
2865@@ -189,5 +160,37 @@
2866 || property == "user-stylesheet-uri"
2867 || property.has_suffix ("-width");
2868 }
2869+
2870+ /* Adds a stylesheet to midori settings. Since: 0.5.12 */
2871+ public void add_style (string rule_id, string style)
2872+ {
2873+ if (user_stylesheets == null)
2874+ user_stylesheets = new GLib.HashTable<string, WebKit.UserStyleSheet>(str_hash, str_equal);
2875+
2876+ var ss = new WebKit.UserStyleSheet(style,
2877+ WebKit.UserContentInjectedFrames.ALL_FRAMES,
2878+ WebKit.UserStyleLevel.USER,
2879+ null, null);
2880+ user_stylesheets[rule_id]=ss;
2881+ user_content_manager.add_style_sheet (ss);
2882+ }
2883+
2884+ /* Removes a stylesheet from midori settings. Since: 0.5.12 */
2885+ public void remove_style (string rule_id)
2886+ {
2887+ if (user_stylesheets != null)
2888+ {
2889+ if (user_stylesheets.contains (rule_id))
2890+ {
2891+ user_stylesheets.remove (rule_id);
2892+
2893+ /* the API is rather silly: we have to remove all sheets and re-add all others */
2894+ user_content_manager.remove_all_style_sheets ();
2895+ user_stylesheets.foreach((key, ss) => {
2896+ user_content_manager.add_style_sheet (ss);
2897+ });
2898+ }
2899+ }
2900+ }
2901 }
2902 }
2903
2904=== modified file 'midori/midori-speeddial.vala'
2905--- midori/midori-speeddial.vala 2015-06-11 22:33:48 +0000
2906+++ midori/midori-speeddial.vala 2016-09-20 20:57:01 +0000
2907@@ -32,10 +32,6 @@
2908 string filename;
2909 string? html = null;
2910 List<Spec> thumb_queue = null;
2911-#if !HAVE_WEBKIT2
2912- WebKit.WebView thumb_view = null;
2913- Spec? spec = null;
2914-#endif
2915
2916 public GLib.KeyFile keyfile;
2917 public bool close_buttons_left { get; set; default = false; }
2918@@ -340,86 +336,7 @@
2919 refresh ();
2920 }
2921
2922-#if !HAVE_WEBKIT2
2923- void load_status (GLib.Object thumb_view_, ParamSpec pspec) {
2924- if (thumb_view.load_status != WebKit.LoadStatus.FINISHED
2925- && thumb_view.load_status != WebKit.LoadStatus.FAILED)
2926- return;
2927- thumb_view.notify["load-status"].disconnect (load_status);
2928- /* Schedule an idle to give the offscreen time to draw */
2929- Idle.add (save_thumbnail);
2930- }
2931-#endif
2932-
2933-#if !HAVE_WEBKIT2
2934- bool save_thumbnail () {
2935- return_val_if_fail (spec != null, false);
2936-
2937- var offscreen = (thumb_view.parent as Gtk.OffscreenWindow);
2938- var pixbuf = offscreen.get_pixbuf ();
2939- int image_width = pixbuf.get_width (), image_height = pixbuf.get_height ();
2940- int thumb_width = 240, thumb_height = 160;
2941- float image_ratio = image_width / image_height;
2942- float thumb_ratio = thumb_width / thumb_height;
2943- int x_offset, y_offset, computed_width, computed_height;
2944- if (image_ratio > thumb_ratio) {
2945- computed_width = (int)(image_height * thumb_ratio);
2946- computed_height = image_height;
2947- x_offset = (image_width - computed_width) / 2;
2948- y_offset = 0;
2949- }
2950- else {
2951- computed_width = image_width;
2952- computed_height = (int)(image_width / thumb_ratio);
2953- x_offset = 0;
2954- y_offset = 0;
2955- }
2956- var sub = pixbuf;
2957- if (y_offset + computed_height <= image_height)
2958- sub = new Gdk.Pixbuf.subpixbuf (pixbuf, x_offset, y_offset, computed_width, computed_height);
2959- var scaled = sub.scale_simple (thumb_width, thumb_height, Gdk.InterpType.TILES);
2960- add_with_id (spec.dial_id, spec.uri, thumb_view.get_title () ?? spec.uri, scaled);
2961-
2962- thumb_queue.remove (spec);
2963- if (thumb_queue.length () > 0) {
2964- spec = thumb_queue.nth_data (0);
2965- thumb_view.notify["load-status"].connect (load_status);
2966- thumb_view.load_uri (spec.uri);
2967- }
2968- return false;
2969- }
2970-#endif
2971-
2972 void get_thumb (string dial_id, string uri) {
2973-#if !HAVE_WEBKIT2
2974- if (thumb_view == null) {
2975- thumb_view = new WebKit.WebView ();
2976- thumb_view.settings.set (
2977- "enable-scripts", false,
2978- "enable-plugins", false,
2979- "auto-load-images", true,
2980- "enable-html5-database", false,
2981- "enable-html5-local-storage", false,
2982- "enable-java-applet", false);
2983- var offscreen = new Gtk.OffscreenWindow ();
2984- offscreen.add (thumb_view);
2985- thumb_view.set_size_request (800, 600);
2986- offscreen.show_all ();
2987- }
2988-
2989- /* Don't load thumbnails already queued */
2990- foreach (var spec_ in thumb_queue)
2991- if (spec_.dial_id == dial_id)
2992- return;
2993-
2994- thumb_queue.append (new Spec (dial_id, uri));
2995- if (thumb_queue.length () > 1)
2996- return;
2997-
2998- spec = thumb_queue.nth_data (0);
2999- thumb_view.notify["load-status"].connect (load_status);
3000- thumb_view.load_uri (spec.uri);
3001-#endif
3002 }
3003 }
3004 }
3005
3006=== modified file 'midori/midori-tab.vala'
3007--- midori/midori-tab.vala 2015-04-19 14:06:12 +0000
3008+++ midori/midori-tab.vala 2016-09-20 20:57:01 +0000
3009@@ -44,6 +44,7 @@
3010
3011 public class Tab : Gtk.VBox {
3012 public Tab related { get; set construct; }
3013+ public WebKit.UserContentManager user_content_manager { private get; set construct; }
3014 public WebKit.WebView web_view { get; private set; }
3015
3016 private string current_uri = "about:blank";
3017@@ -133,30 +134,13 @@
3018 orientation = Gtk.Orientation.VERTICAL;
3019 #endif
3020
3021-#if HAVE_WEBKIT2_3_91
3022- web_view = related != null ?
3023- new WebKit.WebView.with_related_view (related.web_view) : new WebKit.WebView ();
3024-#else
3025- web_view = new WebKit.WebView ();
3026-#endif
3027- /* Load something to avoid a bug where WebKit might not set a main frame */
3028- web_view.load_uri ("");
3029+ if (related != null)
3030+ web_view = (WebKit.WebView)GLib.Object.new(typeof (WebKit.WebView), "user-content-manager", user_content_manager, "related-view", related.web_view);
3031+ else
3032+ web_view = (WebKit.WebView)GLib.Object.new(typeof (WebKit.WebView), "user-content-manager", user_content_manager);
3033 }
3034
3035 public void inject_stylesheet (string stylesheet) {
3036-#if !HAVE_WEBKIT2
3037- var dom = web_view.get_dom_document ();
3038- return_if_fail (dom.head != null);
3039- try {
3040- var style = dom.create_element ("style");
3041- style.set_attribute ("type", "text/css");
3042- style.append_child (dom.create_text_node (stylesheet));
3043- dom.head.append_child (style);
3044- }
3045- catch (Error error) {
3046- critical (_("Failed to inject stylesheet: %s"), error.message);
3047- }
3048-#endif
3049 }
3050
3051 /* Since: 0.5.1
3052@@ -219,10 +203,6 @@
3053 return false;
3054 if (view_source)
3055 return false;
3056-#if !HAVE_WEBKIT2
3057- if (web_view.get_main_frame ().get_data_source ().get_data () == null)
3058- return false;
3059-#endif
3060 return true;
3061 }
3062
3063@@ -239,13 +219,9 @@
3064 }
3065
3066 public void unmark_text_matches () {
3067-#if !HAVE_WEBKIT2
3068- web_view.unmark_text_matches ();
3069-#endif
3070 }
3071
3072 public bool find (string text, bool case_sensitive, bool forward) {
3073-#if HAVE_WEBKIT2
3074 var controller = web_view.get_find_controller ();
3075 uint options = WebKit.FindOptions.WRAP_AROUND;
3076 if (!case_sensitive)
3077@@ -255,13 +231,6 @@
3078 controller.search (text, options, 0);
3079 // FIXME: mark matches, count matches, not found
3080 return true;
3081-#else
3082- bool found = false;
3083- found = web_view.search_text (text, case_sensitive, forward, true);
3084- web_view.mark_text_matches (text, case_sensitive, 0);
3085- web_view.set_highlight_text_matches (true);
3086- return found;
3087-#endif
3088 }
3089
3090 /*
3091@@ -270,7 +239,6 @@
3092 Since: 0.5.8
3093 */
3094 public async void update_actions (Gtk.ActionGroup actions) {
3095-#if HAVE_WEBKIT2
3096 try {
3097 actions.get_action ("Undo").sensitive = yield web_view.can_execute_editing_command ("Undo", null);
3098 actions.get_action ("Redo").sensitive = yield web_view.can_execute_editing_command ("Redo", null);
3099@@ -282,15 +250,6 @@
3100 } catch (Error error) {
3101 critical ("Failed to update actions: %s", error.message);
3102 }
3103-#else
3104- actions.get_action ("Undo").sensitive = web_view.can_undo ();
3105- actions.get_action ("Redo").sensitive = web_view.can_redo ();
3106- actions.get_action ("Cut").sensitive = web_view.can_cut_clipboard ();
3107- actions.get_action ("Copy").sensitive = web_view.can_copy_clipboard ();
3108- actions.get_action ("Paste").sensitive = web_view.can_paste_clipboard ();
3109- actions.get_action ("Delete").sensitive = web_view.can_cut_clipboard ();
3110- actions.get_action ("SelectAll").sensitive = true;
3111-#endif
3112 }
3113 }
3114 }
3115
3116=== modified file 'midori/midori-view.c'
3117--- midori/midori-view.c 2016-02-28 00:07:54 +0000
3118+++ midori/midori-view.c 2016-09-20 20:57:01 +0000
3119@@ -27,11 +27,6 @@
3120 #include <gcr/gcr.h>
3121 #endif
3122
3123-#if !defined (HAVE_WEBKIT2)
3124-SoupMessage*
3125-midori_map_get_message (SoupMessage* message);
3126-#endif
3127-
3128 #include <string.h>
3129 #include <stdlib.h>
3130 #include <glib/gi18n.h>
3131@@ -61,7 +56,6 @@
3132 _midori_view_set_settings (MidoriView* view,
3133 MidoriWebSettings* settings);
3134
3135-#ifdef HAVE_WEBKIT2
3136 static void
3137 midori_view_uri_scheme_res (WebKitURISchemeRequest* request,
3138 gpointer user_data);
3139@@ -74,7 +68,6 @@
3140 midori_view_download_query_action (MidoriView* view,
3141 WebKitDownload* download,
3142 const gchar * suggested_filename );
3143-#endif
3144
3145 static gboolean
3146 midori_view_display_error (MidoriView* view,
3147@@ -85,11 +78,7 @@
3148 const gchar* description,
3149 const gchar* suggestions,
3150 const gchar* try_again,
3151-#ifndef HAVE_WEBKIT2
3152- WebKitWebFrame* web_frame);
3153-#else
3154 void* web_frame);
3155-#endif
3156
3157 struct _MidoriView
3158 {
3159@@ -496,7 +485,6 @@
3160 _midori_web_view_load_icon (MidoriView* view)
3161 {
3162 GdkPixbuf* pixbuf = NULL;
3163- #ifdef HAVE_WEBKIT2
3164 cairo_surface_t* surface = webkit_web_view_get_favicon (WEBKIT_WEB_VIEW (view->web_view));
3165 if (surface != NULL
3166 && (pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
3167@@ -505,11 +493,6 @@
3168 {
3169 midori_view_apply_icon (view, G_ICON (pixbuf), view->icon_uri);
3170 }
3171- #else
3172- if ((pixbuf = webkit_web_view_try_get_favicon_pixbuf (
3173- WEBKIT_WEB_VIEW (view->web_view), 0, 0)))
3174- midori_view_apply_icon (view, G_ICON (pixbuf), view->icon_uri);
3175- #endif
3176 }
3177
3178 static void
3179@@ -537,45 +520,20 @@
3180 GTlsCertificateFlags* tls_flags,
3181 gchar** hostname)
3182 {
3183- #ifdef HAVE_WEBKIT2
3184 WebKitWebView* web_view = WEBKIT_WEB_VIEW (view->web_view);
3185 *hostname = midori_uri_parse_hostname (webkit_web_view_get_uri (web_view), NULL);
3186 gboolean success = webkit_web_view_get_tls_info (web_view, tls_cert, tls_flags);
3187 if (*tls_cert != NULL)
3188 g_object_ref (*tls_cert);
3189 return success && *tls_flags == 0;
3190- #else
3191- SoupMessage* message = midori_map_get_message (webkit_network_request_get_message (request));
3192- if (message != NULL)
3193- {
3194- SoupURI* uri = soup_message_get_uri (message);
3195- *hostname = uri ? g_strdup (uri->host) : NULL;
3196- g_object_get (message, "tls-certificate", tls_cert, "tls-errors", tls_flags, NULL);
3197- if (soup_message_get_flags (message) & SOUP_MESSAGE_CERTIFICATE_TRUSTED)
3198- return TRUE;
3199- return *tls_flags == 0;
3200- }
3201- *tls_cert = NULL;
3202- *tls_flags = 0;
3203- *hostname = NULL;
3204- return FALSE;
3205- #endif
3206 }
3207
3208 static gboolean
3209 midori_view_web_view_navigation_decision_cb (WebKitWebView* web_view,
3210- #ifdef HAVE_WEBKIT2
3211 WebKitPolicyDecision* decision,
3212 WebKitPolicyDecisionType decision_type,
3213- #else
3214- WebKitWebFrame* web_frame,
3215- WebKitNetworkRequest* request,
3216- WebKitWebNavigationAction* action,
3217- WebKitWebPolicyDecision* decision,
3218- #endif
3219 MidoriView* view)
3220 {
3221- #ifdef HAVE_WEBKIT2
3222 if (decision_type == WEBKIT_POLICY_DECISION_TYPE_RESPONSE)
3223 {
3224 WebKitURIResponse* response = webkit_response_policy_decision_get_response (
3225@@ -610,9 +568,6 @@
3226
3227 WebKitURIRequest * request = webkit_navigation_policy_decision_get_request (WEBKIT_NAVIGATION_POLICY_DECISION (decision));
3228 const gchar* uri = webkit_uri_request_get_uri (request);
3229- #else
3230- const gchar* uri = webkit_network_request_get_uri (request);
3231- #endif
3232 if (g_str_has_prefix (uri, "geo:") && strstr (uri, ","))
3233 {
3234 gchar* new_uri = sokoke_magic_uri (uri, TRUE, FALSE);
3235@@ -624,42 +579,34 @@
3236 {
3237 /* For security reasons, main content served as data: is limited to images
3238 http://lcamtuf.coredump.cx/switch/ */
3239- #ifdef HAVE_WEBKIT2
3240 webkit_policy_decision_ignore (decision);
3241- #else
3242- webkit_web_policy_decision_ignore (decision);
3243- #endif
3244 return TRUE;
3245 }
3246- #ifdef HAVE_GCR
3247- else if (/* midori_tab_get_special (MIDORI_TAB (view)) && */ !strncmp (uri, "https", 5))
3248+ else if (midori_tab_get_special (MIDORI_TAB (view)) && !strncmp (uri, "https", 5))
3249 {
3250 /* We show an error page if the certificate is invalid.
3251 If a "special", unverified page loads a form, it must be that page.
3252 if (webkit_web_navigation_action_get_reason (action) == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED)
3253 FIXME: Verify more stricly that this cannot be eg. a simple Reload */
3254- #ifdef HAVE_WEBKIT2
3255 if (decision_type == WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION)
3256- #else
3257- if (webkit_web_navigation_action_get_reason (action) == WEBKIT_WEB_NAVIGATION_REASON_RELOAD)
3258- #endif
3259 {
3260- GTlsCertificate* tls_cert;
3261- GTlsCertificateFlags tls_flags;
3262- gchar* hostname;
3263- if (!midori_view_get_tls_info (view, request, &tls_cert, &tls_flags, &hostname)
3264- && tls_cert != NULL)
3265+ gchar* hostname = midori_uri_parse_hostname (uri, NULL);
3266+ g_return_val_if_fail (hostname != NULL, FALSE);
3267+ GTlsCertificate* cert = g_object_get_data (G_OBJECT (view->web_view), "tls-cert");
3268+ g_return_val_if_fail (cert != NULL, FALSE);
3269+ webkit_web_context_allow_tls_certificate_for_host (webkit_web_context_get_default (),
3270+ cert, hostname);
3271+ if (cert != NULL)
3272 {
3273- GcrCertificate* gcr_cert;
3274- GByteArray* der_cert;
3275-
3276- g_object_get (tls_cert, "certificate", &der_cert, NULL);
3277- gcr_cert = gcr_simple_certificate_new (der_cert->data, der_cert->len);
3278- g_byte_array_unref (der_cert);
3279- if (hostname && !gcr_trust_is_certificate_pinned (gcr_cert, GCR_PURPOSE_SERVER_AUTH, hostname, NULL, NULL))
3280+ GByteArray* der;
3281+ g_object_get (cert, "certificate", &der, NULL);
3282+ GcrCertificate* gcr = gcr_simple_certificate_new (der->data, der->len);
3283+ g_return_val_if_fail (gcr != NULL, FALSE);
3284+ // FIXME: g_object_unref (der);
3285+ if (hostname && !gcr_trust_is_certificate_pinned (gcr, GCR_PURPOSE_SERVER_AUTH, hostname, NULL, NULL))
3286 {
3287 GError* error = NULL;
3288- gcr_trust_add_pinned_certificate (gcr_cert, GCR_PURPOSE_SERVER_AUTH, hostname, NULL, &error);
3289+ gcr_trust_add_pinned_certificate (gcr, GCR_PURPOSE_SERVER_AUTH, hostname, NULL, &error);
3290 if (error != NULL)
3291 {
3292 gchar* slots = g_strjoinv (" , ", (gchar**)gcr_pkcs11_get_trust_lookup_uris ());
3293@@ -675,14 +622,11 @@
3294 g_error_free (error);
3295 }
3296 }
3297- g_object_unref (gcr_cert);
3298+ g_object_unref (gcr);
3299 }
3300- if (tls_cert != NULL)
3301- g_object_unref (tls_cert);
3302 g_free (hostname);
3303 }
3304 }
3305- #endif
3306
3307 if (katze_item_get_meta_integer (view->item, "delay") == MIDORI_DELAY_PENDING_UNDELAY)
3308 {
3309@@ -690,39 +634,11 @@
3310 katze_item_set_meta_integer (view->item, "delay", MIDORI_DELAY_UNDELAYED);
3311 }
3312
3313- #ifndef HAVE_WEBKIT2
3314- /* Remove link labels */
3315- JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
3316- gchar* result = sokoke_js_script_eval (js_context,
3317- "(function (links) {"
3318- "if (links != undefined && links.length > 0) {"
3319- " for (var i = links.length - 1; i >= 0; i--) {"
3320- " var parent = links[i].parentNode;"
3321- " parent.removeChild(links[i]); } } }) ("
3322- "document.getElementsByClassName ('midoriHKD87346'));",
3323- NULL);
3324- g_free (result);
3325- result = sokoke_js_script_eval (js_context,
3326- "(function (links) {"
3327- "if (links != undefined && links.length > 0) {"
3328- " for (var i = links.length - 1; i >= 0; i--) {"
3329- " var parent = links[i].parentNode;"
3330- " parent.removeChild(links[i]); } } }) ("
3331- "document.getElementsByClassName ('midori_access_key_fc04de'));",
3332- NULL);
3333- g_free (result);
3334- view->find_links = -1;
3335- #endif
3336-
3337 gboolean handled = FALSE;
3338 g_signal_emit_by_name (view, "navigation-requested", uri, &handled);
3339 if (handled)
3340 {
3341- #ifdef HAVE_WEBKIT2
3342 webkit_policy_decision_ignore (decision);
3343- #else
3344- webkit_web_policy_decision_ignore (decision);
3345- #endif
3346 return TRUE;
3347 }
3348
3349@@ -764,54 +680,6 @@
3350 g_object_set (view, "title", NULL, NULL);
3351 midori_view_unset_icon (view);
3352
3353- if (!strncmp (uri, "https", 5))
3354- {
3355- #ifdef HAVE_WEBKIT2
3356- void* request = NULL;
3357- #else
3358- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
3359- WebKitWebDataSource* source = webkit_web_frame_get_data_source (web_frame);
3360- WebKitNetworkRequest* request = webkit_web_data_source_get_request (source);
3361- #endif
3362- GTlsCertificate* tls_cert;
3363- GTlsCertificateFlags tls_flags;
3364- gchar* hostname;
3365- if (midori_view_get_tls_info (view, request, &tls_cert, &tls_flags, &hostname))
3366- midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_TRUSTED);
3367- #ifdef HAVE_GCR
3368- else if (!midori_tab_get_special (MIDORI_TAB (view)) && tls_cert != NULL)
3369- {
3370- GcrCertificate* gcr_cert;
3371- GByteArray* der_cert;
3372-
3373- g_object_get (tls_cert, "certificate", &der_cert, NULL);
3374- gcr_cert = gcr_simple_certificate_new (der_cert->data, der_cert->len);
3375- g_byte_array_unref (der_cert);
3376- if (gcr_trust_is_certificate_pinned (gcr_cert, GCR_PURPOSE_SERVER_AUTH, hostname, NULL, NULL))
3377- midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_TRUSTED);
3378- else
3379- {
3380- midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_UNKNOWN);
3381- midori_tab_stop_loading (MIDORI_TAB (view));
3382- midori_view_display_error (view, NULL, NULL, NULL, _("Security unknown"),
3383- midori_location_action_tls_flags_to_string (tls_flags), NULL,
3384- _("Trust this website"),
3385- NULL);
3386- }
3387- g_object_unref (gcr_cert);
3388- }
3389- #endif
3390- else
3391- midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_UNKNOWN);
3392- #ifdef HAVE_GCR
3393- if (tls_cert != NULL)
3394- g_object_unref (tls_cert);
3395- g_free (hostname);
3396- #endif
3397- }
3398- else
3399- midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_NONE);
3400-
3401 view->find_links = -1;
3402
3403 midori_view_update_load_status (view, MIDORI_LOAD_COMMITTED);
3404@@ -828,7 +696,6 @@
3405 midori_tab_set_progress (MIDORI_TAB (view), progress);
3406 }
3407
3408-#ifdef HAVE_WEBKIT2
3409 static void
3410 midori_view_uri_scheme_res (WebKitURISchemeRequest* request,
3411 gpointer user_data)
3412@@ -836,17 +703,6 @@
3413 const gchar* uri = webkit_uri_scheme_request_get_uri (request);
3414 WebKitWebView* web_view = webkit_uri_scheme_request_get_web_view (request);
3415 MidoriView* view = midori_view_get_for_widget (GTK_WIDGET (web_view));
3416-#else
3417-static void
3418-midori_view_web_view_resource_request_cb (WebKitWebView* web_view,
3419- WebKitWebFrame* web_frame,
3420- WebKitWebResource* web_resource,
3421- WebKitNetworkRequest* request,
3422- WebKitNetworkResponse* response,
3423- MidoriView* view)
3424-{
3425- const gchar* uri = webkit_network_request_get_uri (request);
3426-#endif
3427
3428 /* Only apply custom URIs to special pages for security purposes */
3429 if (!midori_tab_get_special (MIDORI_TAB (view)))
3430@@ -855,7 +711,6 @@
3431 if (g_str_has_prefix (uri, "res://"))
3432 {
3433 gchar* filepath = midori_paths_get_res_filename (&uri[6]);
3434- #ifdef HAVE_WEBKIT2
3435 gchar* contents;
3436 gsize length;
3437 if (g_file_get_contents (filepath, &contents, &length, NULL))
3438@@ -868,11 +723,6 @@
3439 g_free (mime_type);
3440 g_free (content_type);
3441 }
3442- #else
3443- gchar* file_uri = g_filename_to_uri (filepath, NULL, NULL);
3444- webkit_network_request_set_uri (request, file_uri);
3445- g_free (file_uri);
3446- #endif
3447 g_free (filepath);
3448 }
3449 else if (g_str_has_prefix (uri, "stock://"))
3450@@ -936,14 +786,9 @@
3451 encoded = g_base64_encode ((guchar*)buffer, buffer_size);
3452 data_uri = g_strconcat ("data:image/png;base64,", encoded, NULL);
3453 g_free (encoded);
3454- #ifdef HAVE_WEBKIT2
3455 GInputStream* stream = g_memory_input_stream_new_from_data (buffer, buffer_size, g_free);
3456 webkit_uri_scheme_request_finish (request, stream, -1, "image/png");
3457 g_object_unref (stream);
3458- #else
3459- g_free (buffer);
3460- webkit_network_request_set_uri (request, data_uri);
3461- #endif
3462 g_free (data_uri);
3463 return;
3464 }
3465@@ -1032,7 +877,6 @@
3466 return infobar;
3467 }
3468
3469-#ifdef HAVE_WEBKIT2
3470 static gboolean
3471 midori_view_web_view_permission_request_cb (WebKitWebView* web_view,
3472 WebKitPermissionRequest* decision,
3473@@ -1044,86 +888,6 @@
3474 } */
3475 return FALSE;
3476 }
3477-#else
3478-static void
3479-midori_view_database_response_cb (GtkWidget* infobar,
3480- gint response,
3481- WebKitWebDatabase* database)
3482-{
3483- if (response != GTK_RESPONSE_ACCEPT)
3484- {
3485- WebKitSecurityOrigin* origin = webkit_web_database_get_security_origin (database);
3486- webkit_security_origin_set_web_database_quota (origin, 0);
3487- webkit_web_database_remove (database);
3488- }
3489- /* TODO: Remember the decision */
3490-}
3491-
3492-static void
3493-midori_view_web_view_database_quota_exceeded_cb (WebKitWebView* web_view,
3494- WebKitWebFrame* web_frame,
3495- WebKitWebDatabase* database,
3496- MidoriView* view)
3497-{
3498- const gchar* uri = webkit_web_frame_get_uri (web_frame);
3499- MidoriSiteDataPolicy policy = midori_web_settings_get_site_data_policy (view->settings, uri);
3500-
3501- switch (policy)
3502- {
3503- case MIDORI_SITE_DATA_BLOCK:
3504- {
3505- WebKitSecurityOrigin* origin = webkit_web_database_get_security_origin (database);
3506- webkit_security_origin_set_web_database_quota (origin, 0);
3507- webkit_web_database_remove (database);
3508- }
3509- case MIDORI_SITE_DATA_ACCEPT:
3510- case MIDORI_SITE_DATA_PRESERVE:
3511- return;
3512- case MIDORI_SITE_DATA_UNDETERMINED:
3513- {
3514- gchar* hostname = midori_uri_parse_hostname (uri, NULL);
3515- gchar* message = g_strdup_printf (_("%s wants to save an HTML5 database."),
3516- hostname && *hostname ? hostname : uri);
3517- midori_view_add_info_bar (view, GTK_MESSAGE_QUESTION, message,
3518- G_CALLBACK (midori_view_database_response_cb), database,
3519- _("_Deny"), GTK_RESPONSE_REJECT, _("_Allow"), GTK_RESPONSE_ACCEPT,
3520- NULL);
3521- g_free (hostname);
3522- g_free (message);
3523- }
3524- }
3525-}
3526-
3527-static void
3528-midori_view_location_response_cb (GtkWidget* infobar,
3529- gint response,
3530- WebKitGeolocationPolicyDecision* decision)
3531-{
3532- if (response == GTK_RESPONSE_ACCEPT)
3533- webkit_geolocation_policy_allow (decision);
3534- else
3535- webkit_geolocation_policy_deny (decision);
3536-}
3537-
3538-static gboolean
3539-midori_view_web_view_geolocation_decision_cb (WebKitWebView* web_view,
3540- WebKitWebFrame* web_frame,
3541- WebKitGeolocationPolicyDecision* decision,
3542- MidoriView* view)
3543-{
3544- const gchar* uri = webkit_web_frame_get_uri (web_frame);
3545- gchar* hostname = midori_uri_parse_hostname (uri, NULL);
3546- gchar* message = g_strdup_printf (_("%s wants to know your location."),
3547- hostname && *hostname ? hostname : uri);
3548- midori_view_add_info_bar (view, GTK_MESSAGE_QUESTION,
3549- message, G_CALLBACK (midori_view_location_response_cb), decision,
3550- _("_Deny"), GTK_RESPONSE_REJECT, _("_Allow"), GTK_RESPONSE_ACCEPT,
3551- NULL);
3552- g_free (hostname);
3553- g_free (message);
3554- return TRUE;
3555-}
3556-#endif
3557
3558 void
3559 midori_view_set_html (MidoriView* view,
3560@@ -1137,23 +901,10 @@
3561 WebKitWebView* web_view = WEBKIT_WEB_VIEW (view->web_view);
3562 if (!uri)
3563 uri = "about:blank";
3564-#ifndef HAVE_WEBKIT2
3565- WebKitWebFrame* main_frame = webkit_web_view_get_main_frame (web_view);
3566- if (!web_frame)
3567- web_frame = main_frame;
3568- if (web_frame == main_frame)
3569- {
3570- katze_item_set_uri (view->item, uri);
3571- midori_tab_set_special (MIDORI_TAB (view), TRUE);
3572- }
3573- webkit_web_frame_load_alternate_string (
3574- web_frame, data, uri, uri);
3575-#else
3576 /* XXX: with webkit2 ensure child frames do not set tab URI/special/html */
3577 katze_item_set_uri (view->item, uri);
3578 midori_tab_set_special (MIDORI_TAB (view), TRUE);
3579 webkit_web_view_load_alternate_html (web_view, data, uri, uri);
3580-#endif
3581 }
3582
3583 static gboolean
3584@@ -1165,11 +916,7 @@
3585 const gchar* description,
3586 const gchar* suggestions,
3587 const gchar* try_again,
3588-#ifndef HAVE_WEBKIT2
3589- WebKitWebFrame* web_frame)
3590-#else
3591 void* web_frame)
3592-#endif
3593 {
3594 gchar* path = midori_paths_get_res_filename ("error.html");
3595 gchar* template;
3596@@ -1182,11 +929,7 @@
3597 gchar* result;
3598 gboolean is_main_frame;
3599
3600- #ifdef HAVE_WEBKIT2
3601 is_main_frame = TRUE;
3602- #else
3603- is_main_frame = web_frame && (webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view)) == web_frame);
3604- #endif
3605
3606 #if !GTK_CHECK_VERSION (3, 0, 0)
3607 /* g_object_get_valist: object class `GtkSettings' has no property named `gtk-button-images' */
3608@@ -1234,11 +977,7 @@
3609
3610 static gboolean
3611 webkit_web_view_load_error_cb (WebKitWebView* web_view,
3612-#ifdef HAVE_WEBKIT2
3613 WebKitLoadEvent load_event,
3614-#else
3615- WebKitWebFrame* web_frame,
3616-#endif
3617 const gchar* uri,
3618 GError* error,
3619 MidoriView* view)
3620@@ -1247,12 +986,8 @@
3621 didFailProvisionalLoadWithErrorForFrame early-returns if the frame isn't
3622 main, so we know that the pertinent frame here is the view's main frame--so
3623 it's safe for midori_view_display_error to assume it fills in a main frame*/
3624- #ifdef HAVE_WEBKIT2
3625 void* web_frame = NULL;
3626 void* main_frame = NULL;
3627- #else
3628- WebKitWebFrame* main_frame = webkit_web_view_get_main_frame (web_view);
3629- #endif
3630 gchar* title;
3631 gchar* message;
3632 gboolean result;
3633@@ -1332,95 +1067,54 @@
3634 }
3635 }
3636
3637+static gboolean
3638+midori_view_web_view_tls_error_cb (WebKitWebView* web_view,
3639+ const gchar* failing_uri,
3640+ GTlsCertificate* cert,
3641+ GTlsCertificateFlags errors,
3642+ MidoriView* view)
3643+{
3644+ GByteArray* der = NULL;
3645+ g_object_get (cert, "certificate", &der, NULL);
3646+ g_return_val_if_fail (der != NULL, FALSE);
3647+ GcrCertificate* gcr = gcr_simple_certificate_new (der->data, der->len);
3648+ // FIXME: g_object_unref (der);
3649+ g_return_val_if_fail (gcr != NULL, FALSE);
3650+ gchar* hostname = midori_uri_parse_hostname (failing_uri, NULL);
3651+ g_return_val_if_fail (hostname != NULL, FALSE);
3652+ if (gcr_trust_is_certificate_pinned (gcr, GCR_PURPOSE_SERVER_AUTH, hostname, NULL, NULL))
3653+ {
3654+ webkit_web_context_allow_tls_certificate_for_host (webkit_web_context_get_default (),
3655+ cert, hostname);
3656+ webkit_web_view_load_uri (web_view, failing_uri);
3657+ }
3658+ else
3659+ {
3660+ midori_view_display_error (view, NULL, NULL, NULL, _("Security unknown"),
3661+ midori_location_action_tls_flags_to_string (errors), NULL,
3662+ _("Trust this website"), NULL);
3663+ g_object_set_data_full (G_OBJECT (web_view), "cert", g_object_ref (cert), (GDestroyNotify)g_object_unref);
3664+ // FIXME: g_object_set_data_full (G_OBJECT (web_view), "uri", g_strdup (failing_uri), (GDestroyNotify)g_free);
3665+ midori_tab_set_load_error (MIDORI_TAB (view), MIDORI_LOAD_ERROR_SECURITY);
3666+ midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_UNKNOWN);
3667+ }
3668+ g_free (hostname);
3669+ g_object_unref (gcr);
3670+ return TRUE;
3671+}
3672+
3673 static void
3674 midori_view_load_finished (MidoriView* view)
3675 {
3676+ if (midori_tab_get_load_error (MIDORI_TAB (view)) == MIDORI_LOAD_ERROR_SECURITY)
3677+ midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_UNKNOWN);
3678+ else if (!strncmp (midori_tab_get_uri (MIDORI_TAB (view)), "https", 5))
3679+ midori_tab_set_security (MIDORI_TAB (view), MIDORI_SECURITY_TRUSTED);
3680 midori_view_apply_scroll_position (view);
3681- #ifndef HAVE_WEBKIT2
3682-
3683- {
3684- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
3685- JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
3686- /* Icon: URI, News Feed: $URI|title, Search: :URI|title */
3687- gchar* value = sokoke_js_script_eval (js_context,
3688- "(function (l) { var f = new Array (); for (var i in l) "
3689- "{ var t = l[i].type; var r = l[i].rel; "
3690- "if (t && (t.indexOf ('rss') != -1 || t.indexOf ('atom') != -1)) "
3691- "f.push ('$' + l[i].href + '|' + l[i].title);"
3692- "else if (r == 'search' && t == 'application/opensearchdescription+xml') "
3693- "f.push (':' + l[i].href + '|' + l[i].title); } "
3694- "return f; })("
3695- "document.getElementsByTagName ('link'));", NULL);
3696-
3697- /* FIXME: If URI or title contains , parsing will break */
3698- gchar** items = g_strsplit (value, ",", 0);
3699- gchar** current_item = items;
3700- gchar* default_uri = NULL;
3701-
3702- if (view->news_feeds != NULL)
3703- katze_array_clear (view->news_feeds);
3704- else
3705- view->news_feeds = katze_array_new (KATZE_TYPE_ITEM);
3706-
3707- while (current_item && *current_item)
3708- {
3709- const gchar* uri_and_title = *current_item;
3710- if (uri_and_title[0] == '$')
3711- {
3712- const gchar* title;
3713- gchar* uri;
3714- KatzeItem* item;
3715-
3716- uri_and_title++;
3717- if (uri_and_title == NULL)
3718- continue;
3719- title = strchr (uri_and_title, '|');
3720- if (title == NULL)
3721- goto news_feeds_continue;
3722- title++;
3723-
3724- uri = g_strndup (uri_and_title, title - 1 - uri_and_title);
3725- item = g_object_new (KATZE_TYPE_ITEM,
3726- "uri", uri, "name", title, NULL);
3727- katze_array_add_item (view->news_feeds, item);
3728- g_object_unref (item);
3729- if (!default_uri)
3730- default_uri = uri;
3731- else
3732- g_free (uri);
3733- }
3734- else if (uri_and_title[0] == ':')
3735- {
3736- const gchar* title;
3737-
3738- uri_and_title++;
3739- if (uri_and_title == NULL)
3740- continue;
3741- title = strchr (uri_and_title, '|');
3742- if (title == NULL)
3743- goto news_feeds_continue;
3744- title++;
3745- /* TODO: Parse search engine XML
3746- midori_view_add_info_bar (view, GTK_MESSAGE_INFO, title,
3747- G_CALLBACK (midori_view_open_search_response_cb), view,
3748- _("_Save Search engine"), GTK_RESPONSE_ACCEPT, NULL); */
3749- }
3750-
3751- news_feeds_continue:
3752- current_item++;
3753- }
3754- g_strfreev (items);
3755-
3756- g_object_set_data_full (G_OBJECT (view), "news-feeds", default_uri, g_free);
3757- g_free (value);
3758- }
3759- #endif
3760-
3761 midori_tab_set_progress (MIDORI_TAB (view), 1.0);
3762 midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
3763 }
3764
3765-#ifdef HAVE_WEBKIT2
3766 static void
3767 midori_view_web_view_crashed_cb (WebKitWebView* web_view,
3768 MidoriView* view)
3769@@ -1430,6 +1124,7 @@
3770 gchar* message = g_strdup_printf (_("Something went wrong with '%s'."), uri);
3771 midori_view_display_error (view, uri, NULL, title,
3772 message, "", NULL, _("Try again"), NULL);
3773+ midori_tab_set_load_error (MIDORI_TAB (view), MIDORI_LOAD_ERROR_CRASH);
3774 g_free (message);
3775 g_free (title);
3776 }
3777@@ -1461,50 +1156,16 @@
3778
3779 g_object_thaw_notify (G_OBJECT (view));
3780 }
3781-#else
3782-static void
3783-midori_view_web_view_notify_load_status_cb (WebKitWebView* web_view,
3784- GParamSpec* pspec,
3785- MidoriView* view)
3786-{
3787- g_object_freeze_notify (G_OBJECT (view));
3788-
3789- switch (webkit_web_view_get_load_status (web_view))
3790- {
3791- case WEBKIT_LOAD_PROVISIONAL:
3792- midori_view_load_started (view);
3793- break;
3794- case WEBKIT_LOAD_COMMITTED:
3795- midori_view_load_committed (view);
3796- break;
3797- case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT:
3798- /* Not implemented */
3799- break;
3800- case WEBKIT_LOAD_FINISHED:
3801- case WEBKIT_LOAD_FAILED:
3802- midori_view_load_finished (view);
3803- break;
3804- default:
3805- g_warn_if_reached ();
3806- }
3807-
3808- g_object_thaw_notify (G_OBJECT (view));
3809-}
3810-#endif
3811
3812 static void
3813 midori_web_view_notify_icon_uri_cb (WebKitWebView* web_view,
3814 GParamSpec* pspec,
3815 MidoriView* view)
3816 {
3817-#ifdef HAVE_WEBKIT2
3818 const gchar* uri = webkit_web_view_get_uri (web_view);
3819 WebKitWebContext* context = webkit_web_context_get_default ();
3820 WebKitFaviconDatabase* favicon_database = webkit_web_context_get_favicon_database (context);
3821 gchar* icon_uri = webkit_favicon_database_get_favicon_uri (favicon_database, uri);
3822-#else
3823- gchar* icon_uri = g_strdup (webkit_web_view_get_icon_uri (web_view));
3824-#endif
3825 katze_assign (view->icon_uri, icon_uri);
3826 _midori_web_view_load_icon (view);
3827 }
3828@@ -1519,17 +1180,6 @@
3829 g_object_notify (G_OBJECT (view), "title");
3830 }
3831
3832-#ifndef HAVE_WEBKIT2
3833-static void
3834-webkit_web_view_statusbar_text_changed_cb (WebKitWebView* web_view,
3835- const gchar* text,
3836- MidoriView* view)
3837-{
3838- midori_tab_set_statusbar_text (MIDORI_TAB (view), text);
3839-}
3840-#endif
3841-
3842-#if GTK_CHECK_VERSION(3, 2, 0)
3843 static gboolean
3844 midori_view_overlay_frame_enter_notify_event_cb (GtkOverlay* overlay,
3845 GdkEventCrossing* event,
3846@@ -1541,7 +1191,6 @@
3847 ? GTK_ALIGN_END : GTK_ALIGN_START);
3848 return FALSE;
3849 }
3850-#endif
3851
3852 static gboolean
3853 midori_view_web_view_leave_notify_event_cb (WebKitWebView* web_view,
3854@@ -1554,16 +1203,10 @@
3855
3856 static void
3857 webkit_web_view_hovering_over_link_cb (WebKitWebView* web_view,
3858- #ifdef HAVE_WEBKIT2
3859 WebKitHitTestResult* hit_test_result,
3860 guint modifiers,
3861- #else
3862- const gchar* tooltip,
3863- const gchar* link_uri,
3864- #endif
3865 MidoriView* view)
3866 {
3867- #ifdef HAVE_WEBKIT2
3868 katze_object_assign (view->hit_test, g_object_ref (hit_test_result));
3869 if (!webkit_hit_test_result_context_is_link (hit_test_result))
3870 {
3871@@ -1571,7 +1214,6 @@
3872 return;
3873 }
3874 const gchar* link_uri = webkit_hit_test_result_get_link_uri (hit_test_result);
3875- #endif
3876
3877 katze_assign (view->link_uri, g_strdup (link_uri));
3878 if (link_uri && g_str_has_prefix (link_uri, "mailto:"))
3879@@ -1597,25 +1239,6 @@
3880 gint *y,
3881 GdkEventButton* event)
3882 {
3883-#ifndef HAVE_WEBKIT2
3884- g_return_if_fail (MIDORI_IS_VIEW (view));
3885-
3886- if (gtk_widget_get_window (view->web_view))
3887- {
3888-
3889- if (x != NULL)
3890- *x = event->x;
3891- if (y != NULL)
3892- *y = event->y;
3893-
3894- katze_object_assign (view->hit_test,
3895- g_object_ref (
3896- webkit_web_view_get_hit_test_result (
3897- WEBKIT_WEB_VIEW (view->web_view), event)));
3898- katze_assign (view->link_uri,
3899- katze_object_get_string (view->hit_test, "link-uri"));
3900- }
3901-#endif
3902 }
3903
3904 #define MIDORI_KEYS_MODIFIER_MASK (GDK_SHIFT_MASK | GDK_CONTROL_MASK \
3905@@ -1678,70 +1301,6 @@
3906 view->button_press_handled = TRUE;
3907 return TRUE;
3908 }
3909- #if GTK_CHECK_VERSION (3, 4, 0)
3910- if (katze_object_get_boolean (gtk_widget_get_settings (view->web_view), "gtk-enable-primary-paste"))
3911- #else
3912- if (midori_settings_get_middle_click_opens_selection (MIDORI_SETTINGS (view->settings)))
3913- #endif
3914- {
3915- #ifndef HAVE_WEBKIT2
3916- WebKitHitTestResult* result = webkit_web_view_get_hit_test_result (web_view, event);
3917- WebKitHitTestResultContext context = katze_object_get_int (result, "context");
3918- gboolean is_editable = context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE;
3919- g_object_unref (result);
3920- if (!is_editable)
3921- {
3922- gchar* uri;
3923- GtkClipboard* clipboard = gtk_clipboard_get_for_display (
3924- gtk_widget_get_display (GTK_WIDGET (view)),
3925- GDK_SELECTION_PRIMARY);
3926- if ((uri = gtk_clipboard_wait_for_text (clipboard)))
3927- {
3928- guint i = 0;
3929- while (uri[i++] != '\0')
3930- if (uri[i] == '\n' || uri[i] == '\r')
3931- uri[i] = ' ';
3932- g_strstrip (uri);
3933-
3934- /* Hold Alt to search for the selected word */
3935- if (event->state & GDK_MOD1_MASK)
3936- {
3937- gchar* new_uri = sokoke_magic_uri (uri, TRUE, FALSE);
3938- if (!new_uri)
3939- {
3940- gchar* search = katze_object_get_string (
3941- view->settings, "location-entry-search");
3942- new_uri = midori_uri_for_search (search, uri);
3943- g_free (search);
3944- }
3945- katze_assign (uri, new_uri);
3946- }
3947- else if (midori_uri_is_location (uri))
3948- {
3949- if (MIDORI_MOD_NEW_TAB (event->state))
3950- {
3951- background = view->open_tabs_in_the_background;
3952- if (MIDORI_MOD_BACKGROUND (event->state))
3953- background = !background;
3954- g_signal_emit (view, signals[NEW_TAB], 0, uri, background);
3955- }
3956- else
3957- {
3958- midori_view_set_uri (MIDORI_VIEW (view), uri);
3959- gtk_widget_grab_focus (GTK_WIDGET (view));
3960- }
3961- g_free (uri);
3962- view->button_press_handled = TRUE;
3963- return TRUE;
3964- }
3965- else
3966- {
3967- g_free (uri);
3968- }
3969- }
3970- }
3971- #endif
3972- }
3973 if (MIDORI_MOD_SCROLL (event->state))
3974 {
3975 midori_view_set_zoom_level (MIDORI_VIEW (view), 1.0);
3976@@ -1751,9 +1310,7 @@
3977 break;
3978 case 3:
3979 /* Older versions don't have the context-menu signal */
3980- #if WEBKIT_CHECK_VERSION (1, 10, 0)
3981 if (event->state & GDK_CONTROL_MASK)
3982- #endif
3983 {
3984 /* Ctrl + Right-click suppresses javascript button handling */
3985 GtkWidget* menu = gtk_menu_new ();
3986@@ -1814,150 +1371,6 @@
3987 GdkEventKey* event,
3988 MidoriView* view)
3989 {
3990-#ifndef HAVE_WEBKIT2
3991- gint digit = g_ascii_digit_value (event->keyval);
3992- gunichar uc = gdk_keyval_to_unicode (event->keyval);
3993- gchar* result = NULL;
3994- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (web_view);
3995- JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
3996-
3997- if (view->find_links < 0)
3998- {
3999- /* Links are currently off, turn them on */
4000- midori_tab_inject_stylesheet (MIDORI_TAB (view), ".midoriHKD87346 {"
4001- " font-size:small !important; font-weight:bold !important;"
4002- " z-index:500; border-radius:0.3em; line-height:1 !important;"
4003- " background: white !important; color: black !important;"
4004- " border:1px solid gray; padding:0 0.1em !important;"
4005- " position:absolute; display:inline !important; }");
4006- midori_tab_inject_stylesheet (MIDORI_TAB (view), ".midori_access_key_fc04de {"
4007- " font-size:small !important; font-weight:bold !important;"
4008- " z-index:500; border-radius:0.3em; line-height:1 !important;"
4009- " background: black !important; color: white !important;"
4010- " border:1px solid gray; padding:0 0.1em 0.2em 0.1em !important;"
4011- " position:absolute; display:inline !important; }");
4012- result = sokoke_js_script_eval (js_context,
4013- " var label_count = 0;"
4014- " for (i in document.links) {"
4015- " if (document.links[i].href && document.links[i].insertBefore) {"
4016- " var child = document.createElement ('span');"
4017- " if (document.links[i].accessKey && isNaN (document.links[i].accessKey)) {"
4018- " child.setAttribute ('class', 'midori_access_key_fc04de');"
4019- " child.appendChild (document.createTextNode (document.links[i].accessKey));"
4020- " } else {"
4021- " child.setAttribute ('class', 'midoriHKD87346');"
4022- " child.appendChild (document.createTextNode (label_count));"
4023- " label_count++;"
4024- " }"
4025- " document.links[i].insertBefore (child); } }",
4026- NULL);
4027- view->find_links = 0; /* Links are now on */
4028- g_free (result);
4029- return;
4030- }
4031-
4032- if (event->keyval == '.')
4033- {
4034- /* Pressed '.' with links on, so turn them off */
4035- result = sokoke_js_script_eval (js_context,
4036- "var links = document.getElementsByClassName ('midoriHKD87346');"
4037- "for (var i = links.length - 1; i >= 0; i--) {"
4038- " var parent = links[i].parentNode;"
4039- " parent.removeChild(links[i]); }",
4040- NULL);
4041- g_free (result);
4042- result = sokoke_js_script_eval (js_context,
4043- "var links = document.getElementsByClassName ('midori_access_key_fc04de');"
4044- "if (links != undefined && links.length > 0) {"
4045- " for (var i = links.length - 1; i >= 0; i--) {"
4046- " var parent = links[i].parentNode;"
4047- " parent.removeChild(links[i]); } }",
4048- NULL);
4049- g_free (result);
4050- view->find_links = -1;
4051- return;
4052- }
4053-
4054- /* Links are already on at this point, so process the input character */
4055-
4056- if (digit != -1 && event->keyval != GDK_KEY_Return && event->keyval != GDK_KEY_Escape)
4057- {
4058- /* Got a digit, add it to the link count/ number */
4059- if (view->find_links > 0)
4060- view->find_links *= 10;
4061- view->find_links += digit;
4062- return;
4063- }
4064-
4065- if (event->keyval == GDK_KEY_Escape)
4066- {
4067- // Clear the link count/number
4068- view->find_links = 0;
4069- return;
4070- }
4071-
4072- if (g_unichar_isalpha (uc))
4073- {
4074- /* letter pressed if we have a corresponding accessKey and grab URI */
4075- gchar* script = NULL;
4076- gchar* utf8 = NULL;
4077- gulong sz = g_unichar_to_utf8 (uc, NULL);
4078-
4079- utf8 = g_malloc0 (sz);
4080- g_unichar_to_utf8 (uc, utf8);
4081- script = g_strdup_printf (
4082- "var l = 'undefined';"
4083- "for (i in document.links) {"
4084- " if ( document.links[i].href &&"
4085- " document.links[i].accessKey == \"%s\" )"
4086- " {"
4087- " l = document.links[i].href;"
4088- " break;"
4089- " }"
4090- "}"
4091- "if (l != 'undefined') { l; }"
4092- , utf8
4093- );
4094- g_free (utf8);
4095- result = sokoke_js_script_eval (js_context, script, NULL);
4096- g_free (script);
4097- }
4098- else if (event->keyval == GDK_KEY_Return)
4099- {
4100- /* Return pressed, grab URI if we have a link with the entered number */
4101- gchar* script = g_strdup_printf (
4102- "var links = document.getElementsByClassName ('midoriHKD87346');"
4103- "var i = %d; var return_key = %d;"
4104- "if (return_key) {"
4105- " if (typeof links[i] != 'undefined')"
4106- " links[i].parentNode.href; }",
4107- view->find_links, event->keyval == GDK_KEY_Return
4108- );
4109- result = sokoke_js_script_eval (js_context, script, NULL);
4110- g_free (script);
4111- }
4112-
4113- /* Check the URI we grabbed to see if it's valid, if so go there */
4114- if (midori_uri_is_location (result))
4115- {
4116- if (MIDORI_MOD_NEW_TAB (event->state))
4117- {
4118- gboolean background = view->open_tabs_in_the_background;
4119- if (MIDORI_MOD_BACKGROUND (event->state))
4120- background = !background;
4121- g_signal_emit (view, signals[NEW_TAB], 0, result, background);
4122- }
4123- else
4124- midori_view_set_uri (view, result);
4125- view->find_links = -1; /* Turn off link mode */
4126- }
4127- else /* Invalid URI, start over... */
4128- view->find_links = 0;
4129-
4130- if (result)
4131- g_free (result);
4132- return;
4133-#endif
4134 }
4135
4136 static gboolean
4137@@ -1992,21 +1405,12 @@
4138 if (character == (event->keyval | 0x01000000))
4139 return FALSE;
4140
4141- #ifdef HAVE_WEBKIT2
4142 WebKitHitTestResultContext context = katze_object_get_int (view->hit_test, "context");
4143 if (!(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE))
4144- #else
4145- if (!webkit_web_view_can_cut_clipboard (web_view)
4146- && !webkit_web_view_can_paste_clipboard (web_view))
4147- #endif
4148 {
4149 gchar* text = character ? g_strdup_printf ("%c", character) : NULL;
4150- #if GTK_CHECK_VERSION(3, 2, 0)
4151 midori_findbar_search_text (MIDORI_FINDBAR (view->overlay_find),
4152 (GtkWidget*)view, TRUE, katze_str_non_null (text));
4153- #else
4154- g_signal_emit_by_name (view, "search-text", TRUE, katze_str_non_null (text));
4155- #endif
4156 g_free (text);
4157 return TRUE;
4158 }
4159@@ -2058,19 +1462,10 @@
4160 MidoriDownloadType type,
4161 const gchar* uri)
4162 {
4163-#ifdef HAVE_WEBKIT2
4164 WebKitDownload* download = webkit_web_view_download_uri (WEBKIT_WEB_VIEW (view->web_view), uri);
4165 WebKitWebContext * web_context = webkit_web_view_get_context (WEBKIT_WEB_VIEW (view->web_view));
4166 midori_download_set_type (download, type);
4167 g_signal_emit_by_name (web_context, "download-started", download, view);
4168-#else
4169- WebKitNetworkRequest* request = webkit_network_request_new (uri);
4170- WebKitDownload* download = webkit_download_new (request);
4171- g_object_unref (request);
4172- midori_download_set_type (download, type);
4173- gboolean handled;
4174- g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
4175- #endif
4176 }
4177
4178 static void
4179@@ -2106,19 +1501,7 @@
4180 GList*
4181 midori_view_get_resources (MidoriView* view)
4182 {
4183-#ifndef HAVE_WEBKIT2
4184- g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL);
4185-
4186- WebKitWebView* web_view = WEBKIT_WEB_VIEW (view->web_view);
4187- WebKitWebFrame* frame = webkit_web_view_get_main_frame (web_view);
4188- WebKitWebDataSource* data_source = webkit_web_frame_get_data_source (frame);
4189- GList* resources = webkit_web_data_source_get_subresources (data_source);
4190- resources = g_list_prepend (resources, webkit_web_data_source_get_main_resource (data_source));
4191- g_list_foreach (resources, (GFunc)g_object_ref, NULL);
4192- return resources;
4193-#else
4194 return NULL;
4195-#endif
4196 }
4197
4198 static GString*
4199@@ -2128,19 +1511,6 @@
4200 GList* resources = midori_view_get_resources (view);
4201 GString* result = NULL;
4202
4203-#ifndef HAVE_WEBKIT2
4204- GList* list;
4205- for (list = resources; list; list = g_list_next (list))
4206- {
4207- WebKitWebResource* resource = WEBKIT_WEB_RESOURCE (list->data);
4208- GString* data = webkit_web_resource_get_data (resource);
4209- if (!g_strcmp0 (webkit_web_resource_get_uri (resource), uri))
4210- {
4211- result = data;
4212- break;
4213- }
4214- }
4215-#endif
4216 g_list_foreach (resources, (GFunc)g_object_unref, NULL);
4217 g_list_free (resources);
4218 return result;
4219@@ -2225,20 +1595,6 @@
4220 g_free (uri);
4221 }
4222
4223-#ifndef HAVE_WEBKIT2
4224-static void
4225-midori_view_menu_open_email_activate_cb (GtkAction* action,
4226- gpointer user_data)
4227-{
4228- MidoriView* view = user_data;
4229- gchar* data = (gchar*)g_object_get_data (G_OBJECT (action), "uri");
4230- gchar* uri = g_strconcat ("mailto:", data, NULL);
4231- gboolean handled = FALSE;
4232- g_signal_emit_by_name (view, "open-uri", uri, &handled);
4233- g_free (uri);
4234-}
4235-#endif
4236-
4237 static void
4238 midori_view_menu_open_link_tab_activate_cb (GtkAction* action,
4239 gpointer user_data)
4240@@ -2262,30 +1618,6 @@
4241 !view->open_tabs_in_the_background);
4242 }
4243
4244-#ifndef HAVE_WEBKIT2
4245-static void
4246-midori_web_view_menu_search_web_activate_cb (GtkAction* action,
4247- gpointer user_data)
4248-{
4249- MidoriView* view = user_data;
4250- const gchar* search = g_object_get_data (G_OBJECT (action), "search");
4251- if (search == NULL)
4252- search = midori_settings_get_location_entry_search (MIDORI_SETTINGS (view->settings));
4253- gchar* uri = midori_uri_for_search (search, view->selected_text);
4254-
4255- if (view->open_new_pages_in == MIDORI_NEW_PAGE_WINDOW)
4256- g_signal_emit (view, signals[NEW_WINDOW], 0, uri);
4257- /* FIXME: need a way to override behavior (middle click)
4258- else if (view->open_new_pages_in == MIDORI_NEW_PAGE_CURRENT)
4259- midori_view_set_uri (view, uri); */
4260- else
4261- g_signal_emit (view, signals[NEW_TAB], 0, uri,
4262- view->open_tabs_in_the_background);
4263-
4264- g_free (uri);
4265-}
4266-#endif
4267-
4268 static void
4269 midori_view_tab_label_menu_window_new_cb (GtkAction* action,
4270 gpointer user_data)
4271@@ -2295,30 +1627,12 @@
4272 midori_view_get_display_uri (MIDORI_VIEW (view)));
4273 }
4274
4275-#ifndef HAVE_WEBKIT2
4276-static void
4277-midori_web_view_open_frame_in_new_tab_cb (GtkAction* action,
4278- gpointer user_data)
4279-{
4280- MidoriView* view = user_data;
4281- WebKitWebFrame* web_frame = webkit_web_view_get_focused_frame (WEBKIT_WEB_VIEW (view->web_view));
4282- g_signal_emit (view, signals[NEW_TAB], 0,
4283- webkit_web_frame_get_uri (web_frame), view->open_tabs_in_the_background);
4284-}
4285-#endif
4286-
4287 static void
4288 midori_view_inspect_element_activate_cb (GtkAction* action,
4289 gpointer user_data)
4290 {
4291 MidoriView* view = user_data;
4292 WebKitWebInspector* inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (view->web_view));
4293- #ifndef HAVE_WEBKIT2
4294- WebKitHitTestResult* hit_test_result = view->hit_test;
4295- gint x = katze_object_get_int (hit_test_result, "x");
4296- gint y = katze_object_get_int (hit_test_result, "y");
4297- webkit_web_inspector_inspect_coordinates (inspector, x, y);
4298- #endif
4299 webkit_web_inspector_show (inspector);
4300 }
4301
4302@@ -2443,76 +1757,6 @@
4303 midori_web_view_menu_video_save_activate_cb, view);
4304 }
4305
4306- #ifndef HAVE_WEBKIT2
4307- if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION)
4308- {
4309- if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK)
4310- midori_context_action_add (menu, NULL);
4311-
4312- /* Ensure view->selected_text */
4313- midori_view_has_selection (view);
4314- if (midori_uri_is_valid (view->selected_text))
4315- {
4316- /* :// and @ together would mean login credentials */
4317- if (g_str_has_prefix (view->selected_text, "mailto:")
4318- || (strchr (view->selected_text, '@') != NULL
4319- && strstr (view->selected_text, "://") == NULL))
4320- {
4321- gchar* text = g_strdup_printf (_("Send a message to %s"), view->selected_text);
4322- GtkAction* action = (GtkAction*)midori_context_action_new_escaped ("SendMessage", text, NULL, GTK_STOCK_JUMP_TO);
4323- g_object_set_data_full (G_OBJECT (action), "uri", g_strdup (view->selected_text), (GDestroyNotify)g_free);
4324- g_signal_connect (action, "activate", G_CALLBACK (midori_view_menu_open_email_activate_cb), view);
4325- midori_context_action_add (menu, action);
4326- g_free (text);
4327- }
4328- else
4329- {
4330- GtkAction* action = gtk_action_new ("OpenAddressInNewTab", _("Open Address in New _Tab"), NULL, GTK_STOCK_JUMP_TO);
4331- g_object_set_data_full (G_OBJECT (action), "uri", g_strdup (view->selected_text), (GDestroyNotify)g_free);
4332- g_signal_connect (action, "activate", G_CALLBACK (midori_view_menu_open_link_tab_activate_cb), view);
4333- midori_context_action_add (menu, action);
4334- }
4335- }
4336-
4337- KatzeArray* search_engines = katze_object_get_object (browser, "search-engines");
4338- if (search_engines != NULL)
4339- {
4340- MidoriContextAction* searches = midori_context_action_new ("SearchWith", _("Search _with"), NULL, NULL);
4341- midori_context_action_add (menu, GTK_ACTION (searches));
4342-
4343- KatzeItem* item;
4344- guint i = 0;
4345- KATZE_ARRAY_FOREACH_ITEM (item, search_engines)
4346- {
4347- GdkPixbuf* pixbuf;
4348- gchar* search_option = g_strdup_printf ("SearchWith%u", i);
4349- GtkAction* action = (GtkAction*)midori_context_action_new_escaped (search_option, katze_item_get_name (item), NULL, STOCK_EDIT_FIND);
4350- g_free (search_option);
4351- midori_context_action_add (searches, action);
4352- if ((pixbuf = midori_paths_get_icon (katze_item_get_uri (item), NULL)))
4353- {
4354- gtk_action_set_gicon (action, G_ICON (pixbuf));
4355- g_object_unref (pixbuf);
4356- }
4357- else
4358- {
4359- GIcon* icon = g_themed_icon_new_with_default_fallbacks ("edit-find-option-symbolic");
4360- gtk_action_set_gicon (action, icon);
4361- }
4362- gtk_action_set_always_show_image (GTK_ACTION (action), TRUE);
4363- g_object_set_data (G_OBJECT (action), "search", (gchar*)katze_item_get_uri (item));
4364- g_signal_connect (action, "activate",
4365- G_CALLBACK (midori_web_view_menu_search_web_activate_cb), view);
4366- i++;
4367- }
4368- g_object_unref (search_engines);
4369- }
4370- if (midori_settings_get_location_entry_search (MIDORI_SETTINGS (view->settings)) != NULL)
4371- midori_context_action_add_simple (menu, "SearchWeb", _("_Search the Web"), NULL, GTK_STOCK_FIND,
4372- midori_web_view_menu_search_web_activate_cb, view);
4373- }
4374- #endif
4375-
4376 if (context == WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT)
4377 {
4378 midori_context_action_add_by_name (menu, "Back");
4379@@ -2535,12 +1779,6 @@
4380 {
4381 midori_context_action_add (menu, NULL);
4382 midori_context_action_add_by_name (menu, "UndoTabClose");
4383- #ifndef HAVE_WEBKIT2
4384- WebKitWebView* web_view = WEBKIT_WEB_VIEW (view->web_view);
4385- if (webkit_web_view_get_focused_frame (web_view) != webkit_web_view_get_main_frame (web_view))
4386- midori_context_action_add_simple (menu, "OpenFrameInNewTab", _("Open _Frame in New Tab"), NULL, NULL,
4387- midori_web_view_open_frame_in_new_tab_cb, view);
4388- #endif
4389 midori_context_action_add_simple (menu, "OpenInNewWindow", _("Open in New _Window"), NULL, STOCK_WINDOW_NEW,
4390 midori_view_tab_label_menu_window_new_cb, view);
4391 midori_context_action_add_by_name (menu, "ZoomIn");
4392@@ -2614,26 +1852,14 @@
4393 #if WEBKIT_CHECK_VERSION (1, 10, 0)
4394 static gboolean
4395 midori_view_web_view_context_menu_cb (WebKitWebView* web_view,
4396- #ifdef HAVE_WEBKIT2
4397 WebKitContextMenu* context_menu,
4398 GdkEvent* event,
4399 WebKitHitTestResult* hit_test_result,
4400- #else
4401- GtkMenu* default_menu,
4402- WebKitHitTestResult* hit_test_result,
4403- gboolean keyboard,
4404- #endif
4405 MidoriView* view)
4406 {
4407- #ifndef HAVE_WEBKIT2
4408- GdkEvent* event = gtk_get_current_event();
4409- midori_view_ensure_link_uri (view, NULL, NULL, (GdkEventButton *)event);
4410- gdk_event_free (event);
4411- #endif
4412 MidoriContextAction* menu = midori_view_get_page_context_action (view, hit_test_result);
4413 /* Retain specific menu items we can't re-create easily */
4414 guint guesses = 0, guesses_max = 10; /* Maximum number of spelling suggestions */
4415- #ifdef HAVE_WEBKIT2
4416 GList* items = webkit_context_menu_get_items (context_menu), *item, *preserved = NULL;
4417 for (item = items; item; item = g_list_next (item))
4418 {
4419@@ -2649,21 +1875,6 @@
4420 }
4421 g_list_free (preserved);
4422 midori_context_action_create_webkit_context_menu (menu, context_menu);
4423- #else
4424- GList* items = gtk_container_get_children (GTK_CONTAINER (default_menu)), *item;
4425- for (item = items; item; item = g_list_next (item))
4426- {
4427- /* Private API: Source/WebCore/platform/ContextMenuItem.h */
4428- int stock_action = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item->data), "webkit-context-menu"));
4429- const int ContextMenuItemTagSpellingGuess = 30;
4430- if (stock_action == ContextMenuItemTagSpellingGuess && guesses++ < guesses_max)
4431- continue;
4432- else
4433- gtk_widget_destroy (item->data);
4434- }
4435- g_list_free (items);
4436- midori_context_action_create_menu (menu, default_menu, FALSE);
4437- #endif
4438 return FALSE;
4439 }
4440 #endif
4441@@ -2683,20 +1894,18 @@
4442 MidoriNewView where = MIDORI_NEW_VIEW_TAB;
4443 GtkWidget* new_view = GTK_WIDGET (midori_view_get_for_widget (web_view));
4444
4445-#ifdef HAVE_WEBKIT2
4446 WebKitWindowProperties* features = webkit_web_view_get_window_properties (WEBKIT_WEB_VIEW (web_view));
4447-#else
4448- WebKitWebWindowFeatures* features = webkit_web_view_get_window_features (WEBKIT_WEB_VIEW (web_view));
4449-#endif
4450 gboolean locationbar_visible, menubar_visible, toolbar_visible;
4451+ GdkRectangle* geometry = NULL;
4452 gint width, height;
4453 g_object_get (features,
4454 "locationbar-visible", &locationbar_visible,
4455 "menubar-visible", &menubar_visible,
4456 "toolbar-visible", &toolbar_visible,
4457- "width", &width,
4458- "height", &height,
4459+ "geometry", &geometry,
4460 NULL);
4461+ width = geometry->width;
4462+ height = geometry->height;
4463 midori_tab_set_is_dialog (MIDORI_TAB (view),
4464 !locationbar_visible && !menubar_visible && !toolbar_visible
4465 && width > 0 && height > 0);
4466@@ -2723,32 +1932,21 @@
4467 GtkWidget* toplevel = gtk_widget_get_toplevel (new_view);
4468 if (width > 0 && height > 0)
4469 gtk_widget_set_size_request (toplevel, width, height);
4470-#ifdef HAVE_WEBKIT2
4471 g_signal_connect (web_view, "close",
4472 G_CALLBACK (midori_view_web_view_close_cb), new_view);
4473-#else
4474- g_signal_connect (web_view, "close-web-view",
4475- G_CALLBACK (midori_view_web_view_close_cb), new_view);
4476-#endif
4477 }
4478
4479 return TRUE;
4480 }
4481
4482 static GtkWidget*
4483-webkit_web_view_create_web_view_cb (GtkWidget* web_view,
4484-#ifndef HAVE_WEBKIT2
4485- WebKitWebFrame* web_frame,
4486-#endif
4487- MidoriView* view)
4488+webkit_web_view_create_web_view_cb (GtkWidget* web_view,
4489+ WebKitNavigationAction* navigation_action,
4490+ MidoriView* view)
4491 {
4492 MidoriView* new_view;
4493
4494-#ifdef HAVE_WEBKIT2
4495 const gchar* uri = webkit_web_view_get_uri (WEBKIT_WEB_VIEW (web_view));
4496-#else
4497- const gchar* uri = webkit_web_frame_get_uri (web_frame);
4498-#endif
4499 if (view->open_new_pages_in == MIDORI_NEW_PAGE_CURRENT)
4500 new_view = view;
4501 else
4502@@ -2756,53 +1954,13 @@
4503 KatzeItem* item = katze_item_new ();
4504 item->uri = g_strdup (uri);
4505 new_view = (MidoriView*)midori_view_new_from_view (view, item, NULL);
4506-#ifdef HAVE_WEBKIT2
4507 g_signal_connect (new_view->web_view, "ready-to-show",
4508 G_CALLBACK (webkit_web_view_web_view_ready_cb), view);
4509-#else
4510- g_signal_connect (new_view->web_view, "web-view-ready",
4511- G_CALLBACK (webkit_web_view_web_view_ready_cb), view);
4512-#endif
4513 }
4514 g_object_set_data_full (G_OBJECT (new_view), "opener-uri", g_strdup (uri), g_free);
4515 return new_view->web_view;
4516 }
4517
4518-#ifndef HAVE_WEBKIT2
4519-static gboolean
4520-webkit_web_view_mime_type_decision_cb (GtkWidget* web_view,
4521- WebKitWebFrame* web_frame,
4522- WebKitNetworkRequest* request,
4523- const gchar* mime_type,
4524- WebKitWebPolicyDecision* decision,
4525- MidoriView* view)
4526-{
4527- /* FIXME: Never download plugins from sub resources */
4528- if (!strcmp (mime_type, "application/x-shockwave-flash"))
4529- if (strcmp (midori_tab_get_uri (MIDORI_TAB (view)), webkit_network_request_get_uri (request)))
4530- return FALSE;
4531-
4532- if (webkit_web_view_can_show_mime_type (WEBKIT_WEB_VIEW (web_view), mime_type))
4533- {
4534- if (web_frame == webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view)))
4535- {
4536- g_warn_if_fail (mime_type != NULL);
4537- midori_tab_set_mime_type (MIDORI_TAB (view), mime_type);
4538- katze_item_set_meta_string (view->item, "mime-type", mime_type);
4539- if (view->icon == NULL)
4540- midori_view_unset_icon (view);
4541- }
4542-
4543- return FALSE;
4544- }
4545-
4546- g_object_set_data(G_OBJECT (view), "download-mime-type", (gpointer)mime_type);
4547- webkit_web_policy_decision_download (decision);
4548- g_object_set_data(G_OBJECT (view), "download-mime-type", NULL);
4549- return TRUE;
4550-}
4551-#endif
4552-
4553 gint
4554 midori_save_dialog (const gchar* title,
4555 const gchar * hostname,
4556@@ -2851,7 +2009,6 @@
4557 return response;
4558 }
4559
4560-#ifdef HAVE_WEBKIT2
4561 static gboolean
4562 midori_view_download_decide_destination_cb (WebKitDownload* download,
4563 const gchar * suggested_filename,
4564@@ -2877,13 +2034,6 @@
4565 WebKitDownload* download,
4566 const gchar * suggested_filename)
4567 {
4568-#else
4569-static gboolean
4570-midori_view_download_requested_cb (GtkWidget* web_view,
4571- WebKitDownload* download,
4572- MidoriView* view)
4573-{
4574-#endif
4575 gboolean handled = TRUE;
4576 gchar* hostname;
4577 gchar* content_type;
4578@@ -2897,27 +2047,17 @@
4579 hostname = midori_uri_parse_hostname (
4580 opener_uri ? opener_uri : midori_view_get_display_uri (view), NULL);
4581
4582- #ifdef HAVE_WEBKIT2
4583 content_type = g_content_type_guess (suggested_filename, NULL ,
4584 0 ,NULL);
4585 if (!content_type)
4586 content_type = g_strdup ("application/octet-stream");
4587 midori_download_set_filename (download, g_strdup (suggested_filename));
4588- #else
4589- content_type = midori_download_get_content_type (download,
4590- g_object_get_data (G_OBJECT (view), "download-mime-type"));
4591- #endif
4592 description = g_content_type_get_description (content_type);
4593
4594 details = g_string_sized_new (20 * 4);
4595- #ifdef HAVE_WEBKIT2
4596 const gchar * suggestion = webkit_uri_response_get_suggested_filename (webkit_download_get_response (download));
4597 g_string_append_printf (details, _("File Name: %s"),
4598 suggestion ? suggestion : suggested_filename);
4599- #else
4600- g_string_append_printf (details, _("File Name: %s"),
4601- webkit_download_get_suggested_filename (download));
4602- #endif
4603 g_string_append_c (details, '\n');
4604
4605 if (g_strrstr (description, content_type))
4606@@ -2926,51 +2066,8 @@
4607 g_string_append_printf (details, _("File Type: %s ('%s')"), description, content_type);
4608 g_string_append_c (details, '\n');
4609
4610- #ifndef HAVE_WEBKIT2
4611- /* Link Fingerprint */
4612- /* We look at the original URI because redirection would lose the fragment */
4613- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
4614- WebKitWebDataSource* datasource = webkit_web_frame_get_provisional_data_source (web_frame);
4615- if (datasource)
4616- {
4617- gchar* fingerprint;
4618- gchar* fplabel;
4619- WebKitNetworkRequest* original_request = webkit_web_data_source_get_initial_request (datasource);
4620- const gchar* original_uri = webkit_network_request_get_uri (original_request);
4621- midori_uri_get_fingerprint (original_uri, &fingerprint, &fplabel);
4622- if (fplabel && fingerprint)
4623- {
4624- WebKitNetworkRequest* request = webkit_download_get_network_request (download);
4625-
4626- g_string_append (details, fplabel);
4627- g_string_append_c (details, ' ');
4628- g_string_append (details, fingerprint);
4629- g_string_append_c (details, '\n');
4630-
4631- /* Propagate original URI to make it available when the download finishes */
4632- g_object_set_data_full (G_OBJECT (request), "midori-original-uri",
4633- g_strdup (original_uri), g_free);
4634- }
4635- g_free (fplabel);
4636- g_free (fingerprint);
4637-
4638- }
4639-
4640- if (webkit_download_get_total_size (download) > webkit_download_get_current_size (download))
4641- {
4642- gchar* total = g_format_size (webkit_download_get_total_size (download));
4643- g_string_append_printf (details, _("Size: %s"), total);
4644- g_string_append_c (details, '\n');
4645- g_free (total);
4646- }
4647- #endif
4648-
4649- #ifdef HAVE_WEBKIT2
4650 /* i18n: A file open dialog title, ie. "Open http://fila.com/manual.tgz" */
4651 title = g_strdup_printf (_("Open %s"), webkit_uri_request_get_uri (webkit_download_get_request (download)));
4652- #else
4653- title = g_strdup_printf (_("Open %s"), webkit_download_get_uri (download));
4654- #endif
4655 response = midori_save_dialog (title,
4656 hostname, details, content_type); //We prompt a dialog
4657 g_free (title);
4658@@ -2983,147 +2080,6 @@
4659 return handled;
4660 }
4661
4662-#ifndef HAVE_WEBKIT2
4663-static gboolean
4664-webkit_web_view_console_message_cb (GtkWidget* web_view,
4665- const gchar* message,
4666- guint line,
4667- const gchar* source_id,
4668- MidoriView* view)
4669-{
4670- if (g_object_get_data (G_OBJECT (webkit_get_default_session ()),
4671- "pass-through-console"))
4672- return FALSE;
4673-
4674- if (!strncmp (message, "speed_dial-save", 13))
4675- {
4676- MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
4677- MidoriSpeedDial* dial = katze_object_get_object (browser, "speed-dial");
4678- GError* error = NULL;
4679- midori_speed_dial_save_message (dial, message, &error);
4680- if (error != NULL)
4681- {
4682- g_critical ("Failed speed dial message: %s\n", error->message);
4683- g_error_free (error);
4684- }
4685- }
4686- else
4687- g_signal_emit_by_name (view, "console-message", message, line, source_id);
4688- return TRUE;
4689-}
4690-
4691-static void
4692-midori_view_script_response_cb (GtkWidget* infobar,
4693- gint response,
4694- MidoriView* view)
4695-{
4696- view->alerts--;
4697-}
4698-
4699-static gboolean
4700-midori_view_web_view_script_alert_cb (GtkWidget* web_view,
4701- WebKitWebFrame* web_frame,
4702- const gchar* message,
4703- MidoriView* view)
4704-{
4705- gchar* text;
4706-
4707- /* Allow a maximum of 5 alerts */
4708- if (view->alerts > 4)
4709- return TRUE;
4710-
4711- view->alerts++;
4712- /* i18n: The text of an infobar for JavaScript alert messages */
4713- text = g_strdup_printf ("JavaScript: %s", message);
4714- midori_view_add_info_bar (view, GTK_MESSAGE_WARNING, text,
4715- G_CALLBACK (midori_view_script_response_cb), view,
4716- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
4717- g_free (text);
4718- return TRUE;
4719-}
4720-
4721-static gboolean
4722-midori_view_web_view_print_requested_cb (GtkWidget* web_view,
4723- WebKitWebFrame* web_frame,
4724- MidoriView* view)
4725-{
4726- midori_view_print (view);
4727- return TRUE;
4728-}
4729-
4730-static void
4731-webkit_web_view_window_object_cleared_cb (GtkWidget* web_view,
4732- WebKitWebFrame* web_frame,
4733- JSContextRef js_context,
4734- JSObjectRef js_window,
4735- MidoriView* view)
4736-{
4737- const gchar* page_uri;
4738-
4739- page_uri = webkit_web_frame_get_uri (web_frame);
4740- if (!midori_uri_is_http (page_uri))
4741- return;
4742-
4743- if (midori_paths_get_runtime_mode () == MIDORI_RUNTIME_MODE_PRIVATE)
4744- {
4745- /* Mask language, architecture, no plugin list */
4746- gchar* result = sokoke_js_script_eval (js_context,
4747- "navigator = { 'appName': 'Netscape',"
4748- "'appCodeName': 'Mozilla',"
4749- "'appVersion': '5.0 (X11)',"
4750- "'userAgent': navigator.userAgent,"
4751- "'language': 'en-US',"
4752- "'platform': 'Linux i686',"
4753- "'cookieEnabled': true,"
4754- "'javaEnabled': function () { return true; },"
4755- "'mimeTypes': {},"
4756- "'plugins': {'refresh': function () { } } };",
4757- NULL);
4758- g_free (result);
4759- }
4760-}
4761-
4762-static void
4763-midori_view_hadjustment_notify_value_cb (GtkAdjustment* hadjustment,
4764- GParamSpec* pspec,
4765- MidoriView* view)
4766-{
4767- gint value = (gint)gtk_adjustment_get_value (hadjustment);
4768- katze_item_set_meta_integer (view->item, "scrollh", value);
4769-}
4770-
4771-static void
4772-midori_view_notify_hadjustment_cb (MidoriView* view,
4773- GParamSpec* pspec,
4774- gpointer data)
4775-{
4776- GtkScrolledWindow* scrolled = GTK_SCROLLED_WINDOW (view->scrolled_window);
4777- GtkAdjustment* hadjustment = gtk_scrolled_window_get_hadjustment (scrolled);
4778- g_signal_connect (hadjustment, "notify::value",
4779- G_CALLBACK (midori_view_hadjustment_notify_value_cb), view);
4780-}
4781-
4782-static void
4783-midori_view_vadjustment_notify_value_cb (GtkAdjustment* vadjustment,
4784- GParamSpec* pspec,
4785- MidoriView* view)
4786-{
4787- gint value = (gint)gtk_adjustment_get_value (vadjustment);
4788- katze_item_set_meta_integer (view->item, "scrollv", value);
4789-}
4790-
4791-static void
4792-midori_view_notify_vadjustment_cb (MidoriView* view,
4793- GParamSpec* pspec,
4794- gpointer data)
4795-{
4796- GtkScrolledWindow* scrolled = GTK_SCROLLED_WINDOW (view->scrolled_window);
4797- GtkAdjustment* vadjustment = gtk_scrolled_window_get_vadjustment (scrolled);
4798- g_signal_connect (vadjustment, "notify::value",
4799- G_CALLBACK (midori_view_vadjustment_notify_value_cb), view);
4800-}
4801-#endif
4802-
4803 static void
4804 midori_view_init (MidoriView* view)
4805 {
4806@@ -3140,18 +2096,6 @@
4807 view->item = katze_item_new ();
4808
4809 view->scrollh = view->scrollv = -2;
4810- #ifndef HAVE_WEBKIT2
4811- /* Adjustments are not created initially, but overwritten later */
4812- view->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
4813- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (view->scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
4814- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->scrolled_window),
4815- GTK_SHADOW_NONE);
4816- g_signal_connect (view->scrolled_window, "notify::hadjustment",
4817- G_CALLBACK (midori_view_notify_hadjustment_cb), view);
4818- g_signal_connect (view->scrolled_window, "notify::vadjustment",
4819- G_CALLBACK (midori_view_notify_vadjustment_cb), view);
4820- #endif
4821-
4822 g_signal_connect (view->item, "meta-data-changed",
4823 G_CALLBACK (midori_view_item_meta_data_changed), view);
4824 }
4825@@ -3282,10 +2226,6 @@
4826 NULL);
4827
4828 webkit_web_view_set_settings (WEBKIT_WEB_VIEW (view->web_view), (void*)settings);
4829- #ifndef HAVE_WEBKIT2
4830- webkit_web_view_set_full_content_zoom (WEBKIT_WEB_VIEW (view->web_view),
4831- zoom_text_and_images);
4832- #endif
4833 midori_view_set_zoom_level (view, zoom_level);
4834 }
4835
4836@@ -3368,12 +2308,15 @@
4837 KatzeItem* item,
4838 MidoriWebSettings* settings)
4839 {
4840- MidoriView* view = g_object_new (MIDORI_TYPE_VIEW,
4841- "related", MIDORI_TAB (related),
4842- "title", item ? katze_item_get_name (item) : NULL,
4843- NULL);
4844+ MidoriView* view;
4845+
4846 if (!settings && related)
4847 settings = related->settings;
4848+ view = g_object_new (MIDORI_TYPE_VIEW,
4849+ "user-content-manager", midori_settings_get_user_content_manager (MIDORI_SETTINGS (settings)),
4850+ "related", MIDORI_TAB (related),
4851+ "title", item ? katze_item_get_name (item) : NULL,
4852+ NULL);
4853 if (settings)
4854 _midori_view_set_settings (view, settings);
4855 if (item)
4856@@ -3400,14 +2343,6 @@
4857
4858 if (name == g_intern_string ("open-new-pages-in"))
4859 view->open_new_pages_in = g_value_get_enum (&value);
4860- #ifndef HAVE_WEBKIT2
4861- else if (name == g_intern_string ("zoom-text-and-images"))
4862- {
4863- if (view->web_view)
4864- webkit_web_view_set_full_content_zoom (WEBKIT_WEB_VIEW (view->web_view),
4865- g_value_get_boolean (&value));
4866- }
4867- #endif
4868 else if (name == g_intern_string ("open-tabs-in-the-background"))
4869 view->open_tabs_in_the_background = g_value_get_boolean (&value);
4870 else if (name == g_intern_string ("enable-javascript"))
4871@@ -3475,184 +2410,6 @@
4872 return midori_tab_get_progress (MIDORI_TAB (view));
4873 }
4874
4875-#ifndef HAVE_WEBKIT2
4876-static gboolean
4877-midori_view_inspector_window_key_press_event_cb (GtkWidget* window,
4878- GdkEventKey* event,
4879- gpointer user_data)
4880-{
4881- /* Close window on Ctrl+W */
4882- if (event->keyval == 'w' && (event->state & GDK_CONTROL_MASK))
4883- gtk_widget_destroy (window);
4884-
4885- return FALSE;
4886-}
4887-
4888-static void
4889-midori_view_web_inspector_construct_window (gpointer inspector,
4890- WebKitWebView* web_view,
4891- GtkWidget* inspector_view,
4892- MidoriView* view)
4893-{
4894- gchar* title;
4895- const gchar* label;
4896- GtkWidget* window;
4897- GtkWidget* toplevel;
4898- const gchar* icon_name;
4899- GtkIconTheme* icon_theme;
4900- GdkPixbuf* icon;
4901- GdkPixbuf* gray_icon;
4902- #if GTK_CHECK_VERSION (3, 0, 0)
4903- GtkWidget* scrolled;
4904- #endif
4905-
4906- label = midori_view_get_display_title (view);
4907- title = g_strdup_printf (_("Inspect page - %s"), label);
4908- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
4909- gtk_window_set_title (GTK_WINDOW (window), title);
4910- g_free (title);
4911-
4912- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
4913- if (gtk_widget_is_toplevel (toplevel))
4914- {
4915- gtk_window_set_screen (GTK_WINDOW (window), gtk_window_get_screen (GTK_WINDOW (toplevel)));
4916- katze_window_set_sensible_default_size (GTK_WINDOW (window));
4917- }
4918-
4919- /* Attempt to make a gray version of the icon on the fly */
4920- icon_name = gtk_window_get_icon_name (GTK_WINDOW (toplevel));
4921- icon_theme = gtk_icon_theme_get_for_screen (
4922- gtk_widget_get_screen (GTK_WIDGET (view)));
4923- icon = gtk_icon_theme_load_icon (icon_theme, icon_name, 32,
4924- GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
4925- if (icon)
4926- {
4927- gray_icon = gdk_pixbuf_copy (icon);
4928- if (gray_icon)
4929- {
4930- gdk_pixbuf_saturate_and_pixelate (gray_icon, gray_icon, 0.1f, FALSE);
4931- gtk_window_set_icon (GTK_WINDOW (window), gray_icon);
4932- g_object_unref (gray_icon);
4933- }
4934- g_object_unref (icon);
4935- }
4936- else
4937- gtk_window_set_icon_name (GTK_WINDOW (window), icon_name);
4938- gtk_widget_set_size_request (GTK_WIDGET (inspector_view), 700, 100);
4939- #if GTK_CHECK_VERSION (3, 0, 0)
4940- scrolled = gtk_scrolled_window_new (NULL, NULL);
4941- gtk_container_add (GTK_CONTAINER (scrolled), inspector_view);
4942- gtk_container_add (GTK_CONTAINER (window), scrolled);
4943- gtk_widget_show_all (scrolled);
4944- #else
4945- gtk_container_add (GTK_CONTAINER (window), inspector_view);
4946- gtk_widget_show_all (inspector_view);
4947- #endif
4948-
4949- g_signal_connect (window, "key-press-event",
4950- G_CALLBACK (midori_view_inspector_window_key_press_event_cb), NULL);
4951-
4952- /* FIXME: Update window title with URI */
4953-}
4954-
4955-static WebKitWebView*
4956-midori_view_web_inspector_inspect_web_view_cb (gpointer inspector,
4957- WebKitWebView* web_view,
4958- MidoriView* view)
4959-{
4960- GtkWidget* inspector_view = webkit_web_view_new ();
4961- midori_view_web_inspector_construct_window (inspector,
4962- web_view, inspector_view, view);
4963- return WEBKIT_WEB_VIEW (inspector_view);
4964-}
4965-
4966-static gboolean
4967-midori_view_web_inspector_show_window_cb (WebKitWebInspector* inspector,
4968- MidoriView* view)
4969-{
4970- GtkWidget* inspector_view = GTK_WIDGET (webkit_web_inspector_get_web_view (inspector));
4971- GtkWidget* window = gtk_widget_get_toplevel (inspector_view);
4972- if (!window)
4973- return FALSE;
4974- if (katze_object_get_boolean (view->settings, "last-inspector-attached"))
4975- {
4976- gboolean handled = FALSE;
4977- g_signal_emit_by_name (inspector, "attach-window", &handled);
4978- }
4979- else
4980- {
4981- gtk_widget_show (window);
4982- gtk_window_present (GTK_WINDOW (window));
4983- }
4984- return TRUE;
4985-}
4986-
4987-static gboolean
4988-midori_view_web_inspector_attach_window_cb (gpointer inspector,
4989- MidoriView* view)
4990-{
4991- GtkWidget* inspector_view = GTK_WIDGET (webkit_web_inspector_get_web_view (inspector));
4992- g_signal_emit_by_name (view, "attach-inspector", inspector_view);
4993- return TRUE;
4994-}
4995-
4996-/**
4997- * midori_view_web_inspector_get_own_window:
4998- * @inspector: the inspector instance
4999- *
5000- * Get the widget containing the inspector, generally either a GtkWindow
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: