Merge lp:~midori/midori/gtk3WebKit2only into lp:midori

Proposed by Christian Dywan
Status: Work in progress
Proposed branch: lp:~midori/midori/gtk3WebKit2only
Merge into: lp:midori
Diff against target: 16822 lines (+5233/-7471)
92 files modified
CMakeLists.txt (+14/-65)
data/error.html (+0/-30)
data/logo-shade.svg (+0/-150)
extensions/CMakeLists.txt (+81/-72)
extensions/about.vala (+31/-33)
extensions/adblock/extension.vala (+1/-27)
extensions/adblock/widgets.vala (+0/-8)
extensions/colorful-tabs.c (+0/-5)
extensions/colorful-tabs.web.vala (+69/-0)
extensions/cookie-manager/cookie-manager.c (+0/-6)
extensions/cookie-permissions/cookie-permission-manager-preferences-window.c (+0/-22)
extensions/cookie-permissions/cookie-permission-manager.c (+0/-6)
extensions/donottrack.web.vala (+141/-0)
extensions/external-download-manager.vala (+2/-19)
extensions/feed-panel/feed-panel.c (+0/-4)
extensions/feed-panel/main.c (+1/-1)
extensions/formhistory/formhistory.c (+1/-1)
extensions/history-list.vala (+0/-14)
extensions/hsts.web.vala (+173/-0)
extensions/nojs/nojs-preferences.c (+0/-18)
extensions/nojs/nojs.c (+1/-1)
extensions/nsplugin-manager.vala (+0/-71)
extensions/open-with.vala (+0/-11)
extensions/shortcuts.c (+1/-1)
extensions/status-clock.c (+1/-1)
extensions/statusbar-features.c (+1/-42)
extensions/tabby.vala (+0/-5)
extensions/transfers.vala (+1/-28)
ipc/CMakeLists.txt (+47/-0)
ipc/ipc-contextaction.vala (+56/-0)
ipc/ipc-paths.vala (+132/-0)
ipc/midori-tabproxy.vala (+29/-0)
ipc/midori-webextension.vala (+40/-0)
katze/gtk3-compat.c (+0/-119)
katze/gtk3-compat.h (+0/-93)
katze/katze-cellrenderercomboboxtext.c (+0/-39)
katze/katze-http-auth.c (+0/-464)
katze/katze-http-auth.h (+0/-42)
katze/katze-preferences.c (+4/-7)
katze/katze-utils.c (+0/-80)
katze/katze-utils.h (+0/-1)
katze/katze.h (+0/-5)
katze/midori-hsts.vala (+0/-145)
katze/midori-paths.vala (+22/-111)
katze/midori-uri.vala (+0/-6)
midori/CMakeLists.txt (+10/-12)
midori/main.c (+50/-11)
midori/midori-addons.vala (+415/-0)
midori/midori-app.c (+4/-9)
midori/midori-app.h (+5/-0)
midori/midori-browser.c (+190/-1110)
midori/midori-browser.h (+1/-1)
midori/midori-contextaction.vala (+19/-13)
midori/midori-download.vala (+2/-36)
midori/midori-extension.c (+47/-830)
midori/midori-extension.h (+2/-5)
midori/midori-findbar.c (+7/-4)
midori/midori-frontend.c (+19/-15)
midori/midori-locationaction.c (+16/-97)
midori/midori-navigationaction.vala (+237/-0)
midori/midori-notebook.vala (+0/-48)
midori/midori-oops.vala (+53/-0)
midori/midori-panedaction.vala (+0/-79)
midori/midori-panel.c (+0/-10)
midori/midori-platform.h (+0/-1)
midori/midori-preferences.c (+0/-15)
midori/midori-privatedata.c (+2/-44)
midori/midori-searchaction.c (+2/-8)
midori/midori-session.c (+0/-87)
midori/midori-session.h (+0/-3)
midori/midori-settings.vala (+1/-0)
midori/midori-tab.vala (+101/-50)
midori/midori-view.c (+151/-1121)
midori/midori-view.h (+3/-5)
midori/midori-websettings.c (+8/-202)
midori/midori-window.vala (+211/-0)
midori/midori.vapi (+2/-23)
midori/sokoke.c (+0/-53)
midori/sokoke.h (+0/-1)
midori/webkit2gtk-3.0.vapi (+0/-779)
midori/webkit2gtk-web-extension-4.0.vapi (+2801/-0)
midori/webkitgtk-3.0.deps (+0/-6)
midori/webkitgtk-3.0.vapi (+0/-841)
po/POTFILES.in (+12/-7)
tests/CMakeLists.txt (+0/-12)
tests/browser.c (+0/-33)
tests/extensions.c (+0/-52)
tests/hsts.vala (+0/-32)
tests/magic-uri.c (+0/-2)
tests/properties.c (+0/-5)
tests/tab.vala (+1/-5)
win32/makedist/makedist.midori (+12/-51)
To merge this branch: bzr merge lp:~midori/midori/gtk3WebKit2only
Reviewer Review Type Date Requested Status
Midori Devs Pending
Review via email: mp+242128@code.launchpad.net

Commit message

Make WebKit2/ GTK+3 and GCR mandatory

Description of the change

WebKit2 porting:
[x] HSTS
[ ] Adblock
[*] Addons
[ ] Cookie Permissions
[*] Form History
[ ] NoJS
[x] NS plugin manager

Drop compatibility lower than
[x] GTK+3.12
[x] WebKit2GTK+ 2.6
[x] Vala 0.26

Other
[ ] Plug holes in WebKit2 API based code
[x] Drop obsolete custom auth backend
[x] Drop cryptic site-data-uri feature
[x] Split NavigationAction off Browser
[x] Add Do-Not-Track/ URL cleansing extension

To post a comment you must log in.
lp:~midori/midori/gtk3WebKit2only updated
6833. By Christian Dywan

Drop most obvious GTK+3/ WebKit2/ GCR compat code paths

Leaving for now some pieces of WebKit1-only code

6834. By Christian Dywan

Dropping gtk3-compat.* files

6835. By Christian Dywan

Drop remaining HAVE_GTK3 instances

6836. By Christian Dywan

More HAVE_WEBKIT2 droppings

6837. By Christian Dywan

Drop inspector split view which isn't needed for WebKit2

6838. By Christian Dywan

Switch to WebKit2GTK+ 4.0 (new ABI) and upstream vapi

6839. By Christian Dywan

Stop using javascriptcoregtk-3.0

6840. By Christian Dywan

Drop obsolete Soup-based KatzeHttpAuth

6841. By Christian Dywan

Drop Soup-based cache and cookie setup

6842. By Christian Dywan

Drop half-baked site data policy support: it was never fully implemented

6843. By Christian Dywan

Geo location request support with WebKit2

6844. By Christian Dywan

Correctly set/ unset link uri with WebKit2

6845. By Christian Dywan

Drop obsolete midori_view_ensure_link_uri helper

6846. By Christian Dywan

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

6847. By Christian Dywan

Implement new NavigationAction and remove back/ forward logic from Browser

6848. By Christian Dywan

Drop GTK_CHECK_VERSION GTK2 fallbacks

6849. By Christian Dywan

Merge lp:midori

6850. By Christian Dywan

Save/ views source with WebKit2

6851. By Christian Dywan

Use gtk-decoration-layout to determine close button position

6852. By Christian Dywan

Port HSTS to WebKit.WebExtension

6853. By Christian Dywan

Run classic extensions through -t also

6854. By Christian Dywan

Add DoNotTrack/ URL cleanser web extension

6855. By Christian Dywan

Don't consider absent hsts cache as an error

6856. By Christian Dywan

Native GTK+ tabs: errors and private browsing info

6857. By Christian Dywan

New Window superclass with transparent header-/ toolbar

6858. By Christian Dywan

Implement Midori.Addons singleton

Extensions as well as Netscape plugins
and web extensions have a common place.
All modes have an App.
There's a proper way to handle stock extensions.

6859. By Paweł Forysiuk <email address hidden>

makedist: Drop support for gtk2 and old gstreamer version

6860. By Christian Dywan

Omit active extensions from about: and interns unless debugging

6861. By Christian Dywan

Scan user scripts/ styles and add to ContentManager

6862. By Christian Dywan

Implement non-GUI that provides a subset of Midori.Paths through IPC

6863. By Christian Dywan

Expose tabs on DBus and use it to set tab colors from meta tags

6864. By Christian Dywan

Fallback to uri if error page really has no title

6865. By Christian Dywan

Make extension tests aware of web extensions with user data

6866. By Christian Dywan

DoNotTrack needs to handle query keys being null

6867. By Christian Dywan

Fix return_if_fail's on midori_view_get_source/find_bar

6868. By Christian Dywan

Update webkit2gtk-web-extension-4.0.vapi from vala master

https://github.com/GNOME/vala/commit/8d57dffdea43a9d663e12b52722ef567c705bf5e

6869. By Christian Dywan

Make Midori.Database available to web extensions

6870. By Christian Dywan

Reinstate unowned annotation of URIRequest.get_http_headers

6871. By Christian Dywan

Implement TabProxy.add_icon and low-level Midori.ContextItem

Revision history for this message
Christian Dywan (kalikiana) wrote :

As per discussion I'll split this work once we branch stable off the current trunk which then becomes 0.6 in ~ a week's time and then review becomes easier.

Unmerged revisions

6871. By Christian Dywan

Implement TabProxy.add_icon and low-level Midori.ContextItem

6870. By Christian Dywan

Reinstate unowned annotation of URIRequest.get_http_headers

6869. By Christian Dywan

Make Midori.Database available to web extensions

6868. By Christian Dywan

Update webkit2gtk-web-extension-4.0.vapi from vala master

https://github.com/GNOME/vala/commit/8d57dffdea43a9d663e12b52722ef567c705bf5e

6867. By Christian Dywan

Fix return_if_fail's on midori_view_get_source/find_bar

6866. By Christian Dywan

DoNotTrack needs to handle query keys being null

6865. By Christian Dywan

Make extension tests aware of web extensions with user data

6864. By Christian Dywan

Fallback to uri if error page really has no title

6863. By Christian Dywan

Expose tabs on DBus and use it to set tab colors from meta tags

6862. By Christian Dywan

Implement non-GUI that provides a subset of Midori.Paths through IPC

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 2014-11-10 22:59:26 +0000
3+++ CMakeLists.txt 2015-03-10 00:27:20 +0000
4@@ -39,7 +39,7 @@
5 set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
6
7 find_package(Vala REQUIRED)
8-vala_require("0.16.0")
9+vala_require("0.26.0")
10 set(VALAFLAGS ${VALAFLAGS}
11 --enable-deprecated
12 --debug
13@@ -118,30 +118,19 @@
14 sqlite3>=3.6.19
15 gmodule-2.0
16 gio-2.0>=2.32.3
17- libsoup-gnome-2.4>=2.27.90
18+ libsoup-gnome-2.4>=2.40.0
19 )
20 add_definitions("-DHAVE_LIBXML")
21 add_definitions("-DGIO_VERSION=\"${DEPS_gio-2.0_VERSION}\"")
22 add_definitions("-DLIBSOUP_VERSION=\"${DEPS_libsoup-gnome-2.4_VERSION}\"")
23-set(PKGS posix linux libxml-2.0 sqlite3 gmodule-2.0 gio-2.0 libsoup-2.4)
24-if (${DEPS_libsoup-gnome-2.4_VERSION} VERSION_GREATER "2.29.91")
25+set(PACKAGES_CORE posix libsoup-2.4 sqlite3 gtk+-3.0)
26+set(PKGS ${PACKAGES_CORE} linux libxml-2.0 gmodule-2.0)
27 add_definitions("-DHAVE_LIBSOUP_2_29_91")
28-endif ()
29-if (${DEPS_libsoup-gnome-2.4_VERSION} VERSION_GREATER "2.34.0")
30 add_definitions("-DHAVE_LIBSOUP_2_34_0")
31 set(VALAFLAGS ${VALAFLAGS} -D HAVE_LIBSOUP_2_34_0)
32-endif ()
33-if (${DEPS_libsoup-gnome-2.4_VERSION} VERSION_GREATER "2.37.1")
34 add_definitions("-DHAVE_LIBSOUP_2_37_1")
35-endif ()
36-if (${DEPS_libsoup-gnome-2.4_VERSION} VERSION_GREATER "2.40.0")
37- # valac 0.16 didn't have the bindings yet
38- # For consistency we need to ensure C code makes the same assumptions
39- if (${VALA_VERSION} VERSION_GREATER "0.17.0")
40 add_definitions("-DHAVE_LIBSOUP_2_40_0")
41 set(VALAFLAGS ${VALAFLAGS} -D HAVE_LIBSOUP_2_40_0)
42- endif ()
43-endif ()
44
45 if (WIN32)
46 add_definitions("-DLIBNOTIFY_VERSION=\"No\"")
47@@ -154,19 +143,12 @@
48 set(PKGS ${PKGS} libnotify)
49 endif ()
50
51-option(USE_GTK3 "Use GTK+3" OFF)
52-option(HALF_BRO_INCOM_WEBKIT2 "Serve as a guniea pig" OFF)
53 option(USE_ZEITGEIST "Zeitgeist history integration" ON)
54 option(USE_GRANITE "Fancy notebook and pop-overs" OFF)
55 option(USE_APIDOCS "API documentation" OFF)
56 option(USE_GIR "Generate GObject Introspection bindings" OFF)
57 option(EXTRA_WARNINGS "Additional compiler warnings" OFF)
58
59-# GTK+3 is implied here, whether set or not
60-if (USE_GRANITE OR HALF_BRO_INCOM_WEBKIT2)
61- set(USE_GTK3 ON)
62-endif ()
63-
64 if (USE_GRANITE)
65 pkg_check_modules(GRANITE granite>=0.2)
66 set(OPTS_INCLUDE_DIRS "${OPTS_INCLUDE_DIRS};${GRANITE_INCLUDE_DIRS}")
67@@ -187,60 +169,24 @@
68 set(PKGS ${PKGS} zeitgeist-1.0)
69 endif()
70
71-if (USE_GTK3)
72- pkg_check_modules(GCR gcr-3>=2.32)
73- if (GCR_VERSION)
74+pkg_check_modules(GCR REQUIRED gcr-3>=2.32)
75 set(OPTS_INCLUDE_DIRS "${OPTS_INCLUDE_DIRS};${GCR_INCLUDE_DIRS}")
76 set(OPTS_LIBRARIES "${OPTS_LIBRARIES};${GCR_LIBRARIES}")
77 add_definitions("-DGCR_VERSION=\"${GCR_VERSION}\"")
78 add_definitions("-DHAVE_GCR")
79 set(VALAFLAGS ${VALAFLAGS} -D HAVE_GCR)
80- else ()
81- add_definitions("-DGCR_VERSION=\"No\"")
82- endif ()
83-else ()
84- add_definitions("-DGCR_VERSION=\"No\"")
85-endif ()
86
87-if (HALF_BRO_INCOM_WEBKIT2)
88- # Note: WebKitGTK+ 2.0.0 matches 1.11.91; 1.11.92 > 2.0.0
89 pkg_check_modules(DEPS_GTK REQUIRED
90- gtk+-3.0>=3.0.0
91- webkit2gtk-3.0>=1.11.91
92- javascriptcoregtk-3.0
93+ gtk+-3.0>=3.6.0
94+ webkit2gtk-4.0>=2.3.91
95 )
96 add_definitions("-DHAVE_WEBKIT2")
97 add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-3.0_VERSION}\"")
98- add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkit2gtk-3.0_VERSION}\"")
99- set(PKGS ${PKGS} gtk+-3.0)
100- set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkit2gtk-3.0.vapi")
101+ add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkit2gtk-4.0_VERSION}\"")
102+ set(PKGS ${PKGS} webkit2gtk-4.0)
103 set(VALAFLAGS ${VALAFLAGS} -D HAVE_GTK3)
104 set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2)
105- if (${DEPS_GTK_webkit2gtk-3.0_VERSION} VERSION_GREATER "2.3.90")
106- set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2_3_91)
107- endif ()
108-elseif (USE_GTK3)
109- pkg_check_modules(DEPS_GTK REQUIRED
110- gtk+-3.0>=3.0.0
111- webkitgtk-3.0>=1.8.1
112- javascriptcoregtk-3.0
113- )
114- add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-3.0_VERSION}\"")
115- add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkitgtk-3.0_VERSION}\"")
116- set(PKGS ${PKGS} gtk+-3.0)
117- set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkitgtk-3.0.vapi")
118- set(VALAFLAGS ${VALAFLAGS} -D HAVE_GTK3)
119-else ()
120- pkg_check_modules(DEPS_GTK REQUIRED
121- gtk+-2.0>=2.24.0
122- webkit-1.0>=1.8.1
123- javascriptcoregtk-1.0
124- )
125- add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-2.0_VERSION}\"")
126- add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkit-1.0_VERSION}\"")
127- set(PKGS ${PKGS} gtk+-2.0)
128- set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkitgtk-3.0.vapi")
129-endif ()
130+ set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2_3_91)
131
132 # dh_translations detects this if there's no variable used
133 set (GETTEXT_PACKAGE "midori")
134@@ -273,6 +219,8 @@
135 set(VALA_CFLAGS "-w -g -fPIC")
136
137 set(LIBMIDORI "${CMAKE_PROJECT_NAME}-core")
138+set(LIBMIDORIV "${CMAKE_PROJECT_NAME}-vala")
139+set(LIBMIDORI2 "${CMAKE_PROJECT_NAME}-ipc")
140
141 # CMake provides no uninstall target by design
142 add_custom_target (uninstall
143@@ -281,8 +229,9 @@
144 install(FILES AUTHORS COPYING ChangeLog EXPAT README DESTINATION ${CMAKE_INSTALL_DOCDIR})
145
146 add_subdirectory (midori)
147+add_subdirectory (ipc)
148+enable_testing()
149 add_subdirectory (extensions)
150-enable_testing()
151 add_subdirectory (tests)
152 add_subdirectory (po)
153 add_subdirectory (icons)
154
155=== removed file 'data/error.html'
156--- data/error.html 2013-10-06 16:41:01 +0000
157+++ data/error.html 1970-01-01 00:00:00 +0000
158@@ -1,30 +0,0 @@
159-<!--
160- Error page template for Midori.
161- This file is licensed under the terms of the expat license, see the file EXPAT.
162--->
163-<html dir="{dir}">
164-<head>
165-<title>{title}</title>
166-{favicon}
167-<link rel="stylesheet" type="text/css" href="res://about.css" />
168-</head>
169-<body>
170-<img id="logo" src="res://logo-shade.png" />
171-<div id="main" style="background-image: url({error_icon});">
172- <div id="text">
173- <h1>{title}</h1>
174- <p class="message">{message}<br><i>{description}</i></p>
175- {suggestions}
176- </div>
177- <form method="GET" action="{uri}" id="button">
178- <button type="submit" onclick="location.reload(); return false;" {autofocus}>
179- <img style="{hide-button-images}" src="stock://gtk-refresh"/>
180- <span>{tryagain}</span>
181- </button>
182- </form>
183- </div>
184-
185-<br style="clear: both;"/>
186-</div>
187-</body>
188-</html>
189
190=== removed file 'data/logo-shade.svg'
191--- data/logo-shade.svg 2008-10-16 01:51:39 +0000
192+++ data/logo-shade.svg 1970-01-01 00:00:00 +0000
193@@ -1,150 +0,0 @@
194-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
195-<!-- Created with Inkscape (http://www.inkscape.org/) -->
196-<svg
197- xmlns:dc="http://purl.org/dc/elements/1.1/"
198- xmlns:cc="http://creativecommons.org/ns#"
199- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
200- xmlns:svg="http://www.w3.org/2000/svg"
201- xmlns="http://www.w3.org/2000/svg"
202- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
203- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
204- width="307.65372"
205- height="350"
206- id="svg2418"
207- sodipodi:version="0.32"
208- inkscape:version="0.46"
209- version="1.0"
210- inkscape:export-filename="/home/user/logo-shade.png"
211- inkscape:export-xdpi="90"
212- inkscape:export-ydpi="90"
213- sodipodi:docname="logo-shade.svg"
214- inkscape:output_extension="org.inkscape.output.svg.inkscape">
215- <sodipodi:namedview
216- id="base"
217- pagecolor="#ffffff"
218- bordercolor="#666666"
219- borderopacity="1.0"
220- gridtolerance="10000"
221- guidetolerance="10"
222- objecttolerance="10"
223- inkscape:pageopacity="0.0"
224- inkscape:pageshadow="2"
225- inkscape:zoom="1.03"
226- inkscape:cx="74.949357"
227- inkscape:cy="143.09941"
228- inkscape:document-units="px"
229- inkscape:current-layer="layer1"
230- showgrid="false"
231- inkscape:window-width="1253"
232- inkscape:window-height="682"
233- inkscape:window-x="0"
234- inkscape:window-y="22" />
235- <defs
236- id="defs2420">
237- <linearGradient
238- id="linearGradient3412">
239- <stop
240- id="stop3414"
241- offset="0"
242- style="stop-color:#ffffff;stop-opacity:0.59836066;" />
243- <stop
244- id="stop3416"
245- offset="1"
246- style="stop-color:#97f839;stop-opacity:0;" />
247- </linearGradient>
248- <linearGradient
249- id="linearGradient3458">
250- <stop
251- id="stop3460"
252- offset="0"
253- style="stop-color:#88fe38;stop-opacity:1;" />
254- <stop
255- id="stop3462"
256- offset="1"
257- style="stop-color:#ffffff;stop-opacity:0;" />
258- </linearGradient>
259- <inkscape:perspective
260- id="perspective2426"
261- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
262- inkscape:vp_z="744.09448 : 526.18109 : 1"
263- inkscape:vp_y="0 : 1000 : 0"
264- inkscape:vp_x="0 : 526.18109 : 1"
265- sodipodi:type="inkscape:persp3d" />
266- <linearGradient
267- id="linearGradient3458-648">
268- <stop
269- id="stop2423"
270- offset="0"
271- style="stop-color:#bababa;stop-opacity:1;" />
272- <stop
273- id="stop2425"
274- offset="1"
275- style="stop-color:#ffffff;stop-opacity:0;" />
276- </linearGradient>
277- <linearGradient
278- id="linearGradient3412-967">
279- <stop
280- id="stop2429"
281- offset="0"
282- style="stop-color:#ffffff;stop-opacity:0.59836066;" />
283- <stop
284- id="stop2431"
285- offset="1"
286- style="stop-color:#bababa;stop-opacity:0;" />
287- </linearGradient>
288- </defs>
289- <metadata
290- id="metadata2423">
291- <rdf:RDF>
292- <cc:Work
293- rdf:about="">
294- <dc:format>image/svg+xml</dc:format>
295- <dc:type
296- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
297- <dc:creator>
298- <cc:Agent>
299- <dc:title>Nancy Runge &lt;nancy@twotoasts.de&gt;</dc:title>
300- </cc:Agent>
301- </dc:creator>
302- <cc:license
303- rdf:resource="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" />
304- </cc:Work>
305- </rdf:RDF>
306- </metadata>
307- <g
308- transform="translate(-280.66056,-644.09745)"
309- id="layer1"
310- inkscape:groupmode="layer"
311- inkscape:label="Layer 1">
312- <g
313- id="g2546"
314- style="fill:#ffffff;fill-opacity:1;stroke:#bcbcbc;stroke-opacity:1"
315- transform="matrix(2.7318355,0,0,2.7318355,-731.07518,-1421.3016)">
316- <path
317- sodipodi:nodetypes="ccsscccsc"
318- id="path3598"
319- d="M 479.0149,757.44485 C 463.33929,760.3524 390.05715,768.6009 373.75783,823.05659 C 368.99751,841.48441 371.67629,866.55457 392.88608,865.62945 C 394.38911,865.56465 394.54399,866.0597 395.07871,867.32475 C 403.8111,887.98406 426.11314,884.657 430.13518,876.12801 C 430.41248,875.53998 429.75994,876.1331 430.13518,876.12801 C 452.01909,891.1113 463.94687,870.37434 470.8404,851.89287 C 479.26032,835.85799 484.40756,769.09622 479.90163,773.41411 C 403.13312,846.97906 403.28006,782.18757 479.0149,757.44485"
320- style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#bcbcbc;stroke-width:2.79349113000000004;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
321- <path
322- id="path3606"
323- d="M 394.6271,866.42646 C 389.11843,841.31269 395.51037,833.40754 398.10369,830.14819"
324- style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#bcbcbc;stroke-width:2.79349113000000004;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
325- sodipodi:nodetypes="cc" />
326- <path
327- id="path3608"
328- d="M 430.04511,875.57142 C 422.884,860.41673 424.07276,847.90995 429.16085,838.58891"
329- style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#bcbcbc;stroke-width:2.79349113000000004;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
330- sodipodi:nodetypes="cc" />
331- </g>
332- <g
333- id="g2551"
334- style="fill:#e8e8e8;fill-opacity:1;stroke:none"
335- transform="matrix(2.7318355,0,0,2.7318355,-731.59243,-1420.9344)">
336- <path
337- sodipodi:nodetypes="cccccccccccc"
338- id="path2553"
339- d="M 447.08573,768.31725 C 436.04919,774.1595 397.92257,781.58705 381.33359,820.27881 C 377.02863,833.88105 375.31278,851.44676 387.44516,857.54862 C 385.16801,848.06163 387.57514,834.11288 393.43272,827.57808 C 397.5473,821.96506 405.70797,826.00823 403.09775,831.29165 C 401.29067,836.46522 394.76631,843.8643 399.87669,863.28435 C 404.09154,874.85534 415.25599,879.58634 422.43347,873.92723 C 414.92666,858.12585 420.32228,825.17457 433.92305,832.69366 C 440.70334,836.82119 424.80942,848.38632 435.43821,869.81488 C 448.73626,880.75776 460.15899,863.55615 464.02222,850.63024 C 472.18961,832.82769 477.16809,790.8233 475.1786,786.29359 C 410.97397,845.50147 395.61545,794.24336 447.07098,768.23969"
340- style="fill:#e8e8e8;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.79349113;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
341- </g>
342- </g>
343-</svg>
344
345=== modified file 'extensions/CMakeLists.txt'
346--- extensions/CMakeLists.txt 2014-07-03 08:03:18 +0000
347+++ extensions/CMakeLists.txt 2015-03-10 00:27:20 +0000
348@@ -1,5 +1,7 @@
349-# Copyright (C) 2013 Christian Dywan <christian@twotoasts.de>
350+# Copyright (C) 2013-2014 Christian Dywan <christian@twotoasts.de>
351
352+include(ContainTest)
353+add_custom_target(check COMMAND "env" "CTEST_OUTPUT_ON_FAILURE=1" "${CMAKE_CTEST_COMMAND}")
354 set(EXTENSIONDIR "${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_PROJECT_NAME}")
355 include_directories(
356 "${CMAKE_SOURCE_DIR}"
357@@ -11,18 +13,16 @@
358 ${OPTS_GTK_INCLUDE_DIRS}
359 ${CMAKE_BINARY_DIR}
360 "${CMAKE_BINARY_DIR}/midori"
361+ "${CMAKE_BINARY_DIR}/ipc"
362 )
363 file(GLOB EXTENSIONS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
364-if (HALF_BRO_INCOM_WEBKIT2)
365+# TODO: port to WebKit2
366 list(REMOVE_ITEM EXTENSIONS
367 "cookie-permissions"
368 "addons.c"
369 "formhistory"
370- "external-download-manager.vala"
371 "nojs"
372- "nsplugin-manager.vala"
373 )
374-endif ()
375
376 # FIXME: re-enable webmedia extension
377 # once we have working notifications on win
378@@ -30,97 +30,106 @@
379 list(REMOVE_ITEM EXTENSIONS "webmedia-now-playing.vala")
380 endif()
381
382-foreach(UNIT_SRC ${EXTENSIONS})
383- string(FIND ${UNIT_SRC} ".c" UNIT_EXTENSION)
384- if (UNIT_EXTENSION GREATER -1)
385- string(REPLACE ".c" "" UNIT ${UNIT_SRC})
386- add_library(${UNIT} MODULE ${UNIT_SRC})
387- target_link_libraries(${UNIT}
388- ${LIBMIDORI}
389- )
390- set_target_properties(${UNIT} PROPERTIES
391- COMPILE_FLAGS ${CFLAGS}
392- )
393- install(TARGETS ${UNIT}
394- LIBRARY DESTINATION ${EXTENSIONDIR}
395- )
396- endif ()
397-endforeach ()
398+include(ParseArguments)
399+include(ValaPrecompile)
400
401-foreach(UNIT_SRC ${EXTENSIONS})
402- string(FIND ${UNIT_SRC} "." UNIT_EXTENSION)
403- if (UNIT_EXTENSION EQUAL -1)
404- file(GLOB UNIT_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${UNIT_SRC}/*.c")
405- file(GLOB UNIT_FILES_VALA RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${UNIT_SRC}/*.vala")
406- if (UNIT_FILES_VALA)
407- include(ValaPrecompile)
408- vala_precompile(UNIT_SRC_C ${UNIT_SRC}
409- ${UNIT_FILES_VALA}
410+macro(build_extension name)
411+ set(source "${ARGN}")
412+ set(SOURCE_VALA "")
413+ foreach(FILE ${source})
414+ string(FIND ${FILE} ".web." WEB_EXTENSION)
415+ string(FIND ${FILE} ".vala" VALA_EXTENSION)
416+ if (WEB_EXTENSION GREATER -1)
417+ string(REPLACE ".vala" "" WEB_NAME "${name}_${FILE}")
418+ string(REPLACE "." "_" WEB_NAME "${WEB_NAME}")
419+ vala_precompile(WEB_EXTENSION_C "${WEB_NAME}"
420+ ${FILE}
421 PACKAGES
422- ${PKGS}
423+ ${PACKAGES_CORE}
424 OPTIONS
425 ${VALAFLAGS}
426 GENERATE_HEADER
427- ${UNIT}
428+ ${FILE}
429 CUSTOM_VAPIS
430- ${EXTRA_VAPIS}
431- "${CMAKE_SOURCE_DIR}/midori/midori.vapi"
432- "${CMAKE_SOURCE_DIR}/katze/katze.vapi"
433- "${CMAKE_BINARY_DIR}/midori/${LIBMIDORI}.vapi"
434+ "${CMAKE_SOURCE_DIR}/midori/webkit2gtk-web-extension-4.0.vapi"
435+ "${CMAKE_BINARY_DIR}/ipc/${LIBMIDORI2}.vapi"
436 )
437- set(UNIT_FILES ${UNIT_FILES} ${UNIT_SRC_C})
438- endif ()
439- if (UNIT_FILES)
440- add_library(${UNIT_SRC} MODULE ${UNIT_FILES})
441- target_link_libraries(${UNIT_SRC}
442- ${LIBMIDORI}
443+ add_library(${WEB_NAME} MODULE ${WEB_EXTENSION_C})
444+ target_link_libraries(${WEB_NAME}
445+ ${LIBMIDORI2}
446 )
447- install(TARGETS ${UNIT_SRC}
448+ install(TARGETS ${WEB_NAME}
449 LIBRARY DESTINATION ${EXTENSIONDIR}
450 )
451- # extensions with vala code get the lenient VALA_CFLAGS
452- # others get the usual CFLAGS with -Wall and -Werror
453- if (UNIT_FILES_VALA)
454- set_target_properties(${UNIT_SRC} PROPERTIES
455- COMPILE_FLAGS ${VALA_CFLAGS}
456- )
457- else ()
458- set_target_properties(${UNIT_SRC} PROPERTIES
459- COMPILE_FLAGS ${CFLAGS}
460- )
461- endif ()
462+ # Extensions with Vala code get the lenient VALA_CFLAGS
463+ set_target_properties(${WEB_NAME} PROPERTIES
464+ COMPILE_FLAGS ${VALA_CFLAGS}
465+ )
466+ list(REMOVE_ITEM source ${FILE})
467+
468+ # Mandatory unit testing
469+ add_test(NAME "test-${WEB_NAME}" COMMAND $<TARGET_FILE:midori> -t $<TARGET_FILE:${WEB_NAME}>)
470+ contain_test("test-${WEB_NAME}" $<TARGET_FILE:midori> -t $<TARGET_FILE:${WEB_NAME}>)
471+ elseif (VALA_EXTENSION GREATER -1)
472+ list(APPEND SOURCE_VALA ${FILE})
473 endif ()
474- endif ()
475-endforeach ()
476-
477-foreach(UNIT_SRC ${EXTENSIONS})
478- string(FIND ${UNIT_SRC} ".vala" UNIT_EXTENSION)
479- if (UNIT_EXTENSION GREATER -1)
480- string(REPLACE ".vala" "" UNIT ${UNIT_SRC})
481- include(ValaPrecompile)
482- vala_precompile(UNIT_SRC_C ${UNIT}
483- ${UNIT_SRC}
484+ endforeach()
485+ if (SOURCE_VALA)
486+ vala_precompile(SOURCE_C ${name}
487+ ${SOURCE_VALA}
488 PACKAGES
489 ${PKGS}
490 OPTIONS
491 ${VALAFLAGS}
492 GENERATE_HEADER
493- ${UNIT}
494+ ${name}
495 CUSTOM_VAPIS
496- ${EXTRA_VAPIS}
497 "${CMAKE_SOURCE_DIR}/midori/midori.vapi"
498 "${CMAKE_SOURCE_DIR}/katze/katze.vapi"
499 "${CMAKE_BINARY_DIR}/midori/${LIBMIDORI}.vapi"
500 )
501- add_library(${UNIT} MODULE ${UNIT_SRC_C})
502- target_link_libraries(${UNIT}
503+ set(source ${SOURCE_C})
504+ endif ()
505+ if (source)
506+ add_library(${name} MODULE ${source})
507+ target_link_libraries(${name}
508 ${LIBMIDORI}
509 )
510- set_target_properties(${UNIT} PROPERTIES
511- COMPILE_FLAGS "${VALA_CFLAGS}"
512- )
513- install(TARGETS ${UNIT}
514+ install(TARGETS ${name}
515 LIBRARY DESTINATION ${EXTENSIONDIR}
516 )
517+ if (SOURCE_VALA)
518+ # Extensions with Vala code get the lenient VALA_CFLAGS
519+ set_target_properties(${name} PROPERTIES
520+ COMPILE_FLAGS ${VALA_CFLAGS}
521+ )
522+ else ()
523+ set_target_properties(${name} PROPERTIES
524+ COMPILE_FLAGS ${CFLAGS}
525+ )
526+ endif ()
527+ # Optional unit test
528+ add_test(NAME "test-${name}" COMMAND $<TARGET_FILE:midori> -t $<TARGET_FILE:${name}>)
529+ contain_test("test-${name}" $<TARGET_FILE:midori> -t $<TARGET_FILE:${name}>)
530+ endif ()
531+endmacro(build_extension)
532+
533+foreach(UNIT_SRC ${EXTENSIONS})
534+ string(FIND ${UNIT_SRC} ".c" UNIT_EXTENSION)
535+ if (UNIT_EXTENSION GREATER -1)
536+ string(REPLACE ".c" "" UNIT ${UNIT_SRC})
537+ build_extension(${UNIT} ${UNIT_SRC})
538+ endif ()
539+
540+ string(FIND ${UNIT_SRC} "." UNIT_EXTENSION)
541+ if (UNIT_EXTENSION EQUAL -1)
542+ file(GLOB UNIT_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${UNIT_SRC}/*.c" "${UNIT_SRC}/*.vala")
543+ build_extension(${UNIT_SRC} ${UNIT_FILES})
544+ endif ()
545+
546+ string(FIND ${UNIT_SRC} ".vala" UNIT_EXTENSION)
547+ if (UNIT_EXTENSION GREATER -1)
548+ string(REPLACE ".vala" "" UNIT ${UNIT_SRC})
549+ build_extension(${UNIT} ${UNIT_SRC})
550 endif ()
551 endforeach ()
552
553=== modified file 'extensions/about.vala'
554--- extensions/about.vala 2014-02-26 20:07:51 +0000
555+++ extensions/about.vala 2015-03-10 00:27:20 +0000
556@@ -15,11 +15,7 @@
557 public abstract string uri { get; set; }
558 public abstract void get_contents (Midori.View view, string uri);
559 protected void load_html (Midori.View view, string content, string uri) {
560- #if HAVE_WEBKIT2
561 view.web_view.load_html (content, uri);
562- #else
563- view.web_view.load_html_string (content, uri);
564- #endif
565 }
566 }
567
568@@ -91,6 +87,7 @@
569 private class Version : Page {
570 public override string uri { get; set; }
571 private GLib.HashTable<string, Page> about_pages;
572+ const string placeholder = "<em id=\"addons\">...</em>";
573
574 public Version (string alias, HashTable<string, Page> about_pages) {
575 this.uri = alias;
576@@ -104,13 +101,31 @@
577 return "<p>%s</p>".printf (links);
578 }
579
580+ async void add_addons (string html, Midori.View view, string uri) {
581+ GLib.StringBuilder replacement = new GLib.StringBuilder ();
582+ replacement.append ("<br><h2>Extensions:</h2>");
583+ bool debug = strcmp (Environment.get_variable ("MIDORI_DEBUG"), "addons") == 0;
584+ foreach (var addon in yield Midori.Addons.get_default ().list ()) {
585+ if (addon is Midori.ClassicExtension && (addon as Midori.ClassicExtension).intern && !debug)
586+ continue;
587+ if (addon is Midori.ClassicExtension && !((addon as Midori.ClassicExtension).is_active ()))
588+ continue;
589+ replacement.append_printf ("<tr><td><span style=\"%s\">%s</span>\t%s</td></tr>",
590+ addon.intern ? "font-style: italic" : "font-weight: bold",
591+ addon.name, addon.description);
592+ }
593+ this.load_html (view, html.replace (placeholder, replacement.str), uri);
594+ }
595+
596 public override void get_contents (Midori.View view, string uri) {
597 string contents = """<html>
598- <head><title>about:version</title></head>
599+ <head>
600+ <title>about:version</title>
601+ <meta name="theme-color" content="#00a132">
602+ </head>
603 <body>
604 <h1>a<span style="position: absolute; left: -1000px; top: -1000px">lias a=b; echo Copy carefully #</span>bout:version</h1>
605 <p>%s</p>
606- <img src="res://logo-shade.png" style="position: absolute; right: 15px; bottom: 15px; z-index: -9;">
607 <table>
608 <tr><td>Command line %s</td></tr>
609 %s
610@@ -137,44 +152,25 @@
611 GLib.StringBuilder video_formats = new GLib.StringBuilder ();
612 view.list_video_formats (video_formats, true);
613
614- GLib.StringBuilder ns_plugins = new GLib.StringBuilder ();
615- view.list_plugins (ns_plugins, true);
616-
617- /* TODO: list active extensions */
618-
619- this.load_html (view, contents.printf (
620+ string html = contents.printf (
621 _("Version numbers in brackets show the version used at runtime."),
622 Midori.Paths.get_command_line_str (true),
623 versions.str,
624 platform, sys_name, architecture != null ? architecture : "",
625 ident,
626 video_formats.str,
627- ns_plugins.str,
628- this.list_about_uris ()
629- ), uri);
630+ placeholder,
631+ this.list_about_uris ());
632+ this.load_html (view, html, uri);
633+
634+ add_addons.begin (html, view, uri);
635 }
636 }
637
638 private class Private : Page {
639 public override string uri { get; set; default = "about:private"; }
640 public override void get_contents (Midori.View view, string uri) {
641- this.load_html (view, """<html dir="ltr">
642- <head>
643- <title>%s</title>
644- <link rel="stylesheet" type="text/css" href="res://about.css">
645- </head>
646- <body>
647- <img id="logo" src="res://logo-shade.png" />
648- <div id="main" style="background-image: url(stock://dialog/gtk-dialog-info);">
649- <div id="text">
650- <h1>%s</h1>
651- <p class="message">%s</p><ul class=" suggestions"><li>%s</li><li>%s</li><li>%s</li></ul>
652- <p class="message">%s</p><ul class=" suggestions"><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>
653- </div><br style="clear: both"></div>
654- </body>
655- </html>""".printf (
656- _("Private Browsing"), _("Private Browsing"),
657- _("Midori doesn't store any personal data:"),
658+ string suggestions = "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s".printf (
659 _("No history or web cookies are being saved."),
660 _("Extensions are disabled."),
661 _("HTML5 storage, local database and application caches are disabled."),
662@@ -183,7 +179,9 @@
663 _("DNS prefetching is disabled."),
664 _("The language and timezone are not revealed to websites."),
665 _("Flash and other Netscape plugins cannot be listed by websites.")
666- ), uri);
667+ );
668+ view.widget = new Midori.Oops (uri, "security-high", _("Private Browsing"),
669+ _("Midori doesn't store any personal data:"), "", suggestions);
670 }
671 }
672
673
674=== modified file 'extensions/adblock/extension.vala'
675--- extensions/adblock/extension.vala 2015-01-02 19:30:24 +0000
676+++ extensions/adblock/extension.vala 2015-03-10 00:27:20 +0000
677@@ -55,7 +55,6 @@
678 internal string? js_hider_function_body;
679 #endif
680
681-#if HAVE_WEBKIT2
682 #if !HAVE_WEBKIT2_3_91
683 public Extension.WebExtension (WebKit.WebExtension web_extension) {
684 init ();
685@@ -70,7 +69,6 @@
686 return request_handled (request.uri, web_page.uri);
687 }
688 #endif
689-#endif
690
691 public Extension () {
692 GLib.Object (name: _("Advertisement blocker"),
693@@ -87,7 +85,6 @@
694 }
695
696 void extension_activated (Midori.App app) {
697-#if HAVE_WEBKIT2
698 string cache_dir = Environment.get_user_cache_dir ();
699 string wk2path = Path.build_path (Path.DIR_SEPARATOR_S, cache_dir, "wk2ext");
700 Midori.Paths.mkdir_with_parents (wk2path);
701@@ -101,7 +98,6 @@
702 } catch (Error error) {
703 critical ("Failed to create WebKit2 link: %s", error.message);
704 }
705-#endif
706 init ();
707 foreach (var browser in app.get_browsers ())
708 browser_added (browser);
709@@ -126,7 +122,7 @@
710 browser.remove_tab.connect (tab_removed);
711
712 var toggle_button = status_icon.add_button ();
713- browser.statusbar.pack_end (toggle_button, false, false, 3);
714+ browser.statusbar.add (toggle_button);
715 toggle_button.show ();
716 }
717
718@@ -139,17 +135,11 @@
719
720 void tab_added (Midori.View view) {
721 view.navigation_requested.connect (navigation_requested);
722-#if !HAVE_WEBKIT2
723- view.web_view.resource_request_starting.connect (resource_requested);
724-#endif
725 view.notify["load-status"].connect (load_status_changed);
726 view.context_menu.connect (context_menu);
727 }
728
729 void tab_removed (Midori.View view) {
730-#if !HAVE_WEBKIT2
731- view.web_view.resource_request_starting.disconnect (resource_requested);
732-#endif
733 view.navigation_requested.disconnect (navigation_requested);
734 view.notify["load-status"].disconnect (load_status_changed);
735 view.context_menu.disconnect (context_menu);
736@@ -182,16 +172,6 @@
737 menu.add (action);
738 }
739
740-#if !HAVE_WEBKIT2
741- void resource_requested (WebKit.WebView web_view, WebKit.WebFrame frame,
742- WebKit.WebResource resource, WebKit.NetworkRequest request, WebKit.NetworkResponse? response) {
743-
744- if (request_handled (request.uri, web_view.uri)) {
745- request.set_uri ("about:blank");
746- }
747- }
748-#endif
749-
750 bool navigation_requested (Midori.Tab tab, string uri) {
751 if (uri.has_prefix ("abp:")) {
752 string parsed_uri = parse_subscription_uri (uri);
753@@ -370,12 +350,8 @@
754 }
755
756 void load_config () {
757-#if HAVE_WEBKIT2
758 string config_dir = Path.build_filename (Environment.get_user_config_dir (), "midori", "extensions", "libadblock." + GLib.Module.SUFFIX);
759 Midori.Paths.mkdir_with_parents (config_dir);
760-#else
761- string config_dir = Midori.Paths.get_extension_config_dir ("adblock");
762-#endif
763 string presets = Midori.Paths.get_extension_preset_filename ("adblock", "config");
764 string filename = Path.build_filename (config_dir, "config");
765 config = new Config (filename, presets);
766@@ -476,14 +452,12 @@
767 }
768 }
769
770-#if HAVE_WEBKIT2
771 #if !HAVE_WEBKIT2_3_91
772 Adblock.Extension? filter;
773 public static void webkit_web_extension_initialize (WebKit.WebExtension web_extension) {
774 filter = new Adblock.Extension.WebExtension (web_extension);
775 }
776 #endif
777-#endif
778
779 public Midori.Extension extension_init () {
780 return new Adblock.Extension ();
781
782=== modified file 'extensions/adblock/widgets.vala'
783--- extensions/adblock/widgets.vala 2014-04-03 17:07:04 +0000
784+++ extensions/adblock/widgets.vala 2015-03-10 00:27:20 +0000
785@@ -130,15 +130,10 @@
786 public void add_subscription (string? uri) {
787 var dialog = new Gtk.Dialog.with_buttons (_("Configure Advertisement filters"),
788 null,
789-#if !HAVE_GTK3
790- Gtk.DialogFlags.NO_SEPARATOR |
791-#endif
792 Gtk.DialogFlags.DESTROY_WITH_PARENT,
793 Gtk.STOCK_HELP, Gtk.ResponseType.HELP,
794 Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE);
795-#if HAVE_GTK3
796 dialog.get_widget_for_response (Gtk.ResponseType.HELP).get_style_context ().add_class ("help_button");
797-#endif
798 dialog.set_icon_name (Gtk.STOCK_PROPERTIES);
799 dialog.set_response_sensitive (Gtk.ResponseType.HELP, false);
800
801@@ -289,9 +284,6 @@
802 public void show () {
803 this.dialog = new Gtk.Dialog.with_buttons (_("Edit rule"),
804 null,
805-#if !HAVE_GTK3
806- Gtk.DialogFlags.NO_SEPARATOR |
807-#endif
808 Gtk.DialogFlags.DESTROY_WITH_PARENT,
809 Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
810 Gtk.STOCK_ADD, Gtk.ResponseType.ACCEPT);
811
812=== modified file 'extensions/colorful-tabs.c'
813--- extensions/colorful-tabs.c 2013-10-30 00:19:27 +0000
814+++ extensions/colorful-tabs.c 2015-03-10 00:27:20 +0000
815@@ -240,11 +240,6 @@
816 void
817 extension_test (void)
818 {
819- #ifndef HAVE_WEBKIT2
820- g_object_set_data (G_OBJECT (webkit_get_default_session ()),
821- "midori-session-initialized", (void*)1);
822- #endif
823-
824 /* TODO: Add test which uses favicon codepath */
825
826 g_test_add_func ("/extensions/colorful_tabs/hostname_colour", test_colour_for_hostname);
827
828=== added file 'extensions/colorful-tabs.web.vala'
829--- extensions/colorful-tabs.web.vala 1970-01-01 00:00:00 +0000
830+++ extensions/colorful-tabs.web.vala 2015-03-10 00:27:20 +0000
831@@ -0,0 +1,69 @@
832+/*
833+ Copyright (C) 2015 Christian Dywan <christian@twotoasts.de>
834+
835+ This library is free software; you can redistribute it and/or
836+ modify it under the terms of the GNU Lesser General Public
837+ License as published by the Free Software Foundation; either
838+ version 2.1 of the License, or (at your option) any later version.
839+
840+ See the file COPYING for the full license text.
841+*/
842+
843+namespace ColorfulTabs {
844+ [DBus (name = "org.midori.ColorfulTabs")]
845+ public class Extension : Midori.WebExtension {
846+ public Extension (WebKit.WebExtension extension, Variant user_data) {
847+ Object (user_data: user_data, token: "colorfultabs");
848+ extension.page_created.connect (page_created);
849+ }
850+
851+ void page_created (WebKit.WebPage page) {
852+ page.document_loaded.connect (document_loaded);
853+ add_icon.begin (page.get_id ());
854+ }
855+
856+ async void add_icon (uint64 page_id) {
857+ var icon = new Midori.ContextItem ("click", _("Click me!"), null, _("Click me!")).to_user_data ();
858+ try {
859+ var tab = yield Midori.TabProxy.get_by_id (page_id);
860+ uint64 id = yield tab.add_action (icon);
861+ debug ("Adding icon %s with id %s", icon.print (true), id.to_string ());
862+ } catch (Error error) {
863+ critical ("Failed to set icon %s for page %s: %s\n", icon.print (true), page_id.to_string (), error.message);
864+ }
865+ }
866+
867+ void document_loaded (WebKit.WebPage page) {
868+ var nodes = page.get_dom_document ().get_elements_by_name ("theme-color");
869+ if (nodes.length == 0)
870+ return;
871+
872+ var meta = nodes.item (0) as WebKit.DOM.HTMLMetaElement;
873+ debug ("Color %s picked up from meta tag on %s", meta.content, page.uri);
874+ set_color.begin (page.get_id (), meta.content);
875+ }
876+
877+ async void set_color (uint64 page_id, string color) {
878+ try {
879+ var tab = yield Midori.TabProxy.get_by_id (page_id);
880+ tab.color = color;
881+ } catch (Error error) {
882+ critical ("Failed to propagate color %s for page %s: %s\n", color, page_id.to_string (), error.message);
883+ }
884+ }
885+ }
886+}
887+
888+ColorfulTabs.Extension? colorful_tabs;
889+public void webkit_web_extension_initialize_with_user_data (WebKit.WebExtension extension, Variant user_data) {
890+ colorful_tabs = new ColorfulTabs.Extension (extension, user_data);
891+}
892+
893+void colorful_tabs_html () {
894+ /* TODO */
895+}
896+
897+public void extension_test () {
898+ Test.add_func ("/colorful_tabs/html", colorful_tabs_html);
899+}
900+
901
902=== modified file 'extensions/cookie-manager/cookie-manager.c'
903--- extensions/cookie-manager/cookie-manager.c 2013-07-29 21:05:02 +0000
904+++ extensions/cookie-manager/cookie-manager.c 2015-03-10 00:27:20 +0000
905@@ -280,15 +280,9 @@
906 COOKIE_MANAGER_COL_NAME, GTK_SORT_ASCENDING);
907
908 /* setup soup */
909-#ifdef HAVE_WEBKIT2
910 gchar *filename = midori_paths_get_config_filename_for_writing ("cookies.db");
911 priv->jar = soup_cookie_jar_sqlite_new (filename, FALSE);
912 g_free(filename);
913-#else
914- SoupSession *session = webkit_get_default_session();
915- priv->jar = SOUP_COOKIE_JAR(soup_session_get_feature(session, soup_cookie_jar_get_type()));
916- g_object_ref(priv->jar);
917-#endif
918 g_signal_connect(priv->jar, "changed", G_CALLBACK(cookie_manager_jar_changed_cb), self);
919
920 cookie_manager_refresh_store(self);
921
922=== modified file 'extensions/cookie-permissions/cookie-permission-manager-preferences-window.c'
923--- extensions/cookie-permissions/cookie-permission-manager-preferences-window.c 2014-01-01 22:39:30 +0000
924+++ extensions/cookie-permissions/cookie-permission-manager-preferences-window.c 2015-03-10 00:27:20 +0000
925@@ -735,12 +735,8 @@
926
927 /* Get content area to add gui controls to */
928 priv->contentArea=gtk_dialog_get_content_area(GTK_DIALOG(self));
929-#ifdef HAVE_GTK3
930 vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
931 gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
932-#else
933- vbox=gtk_vbox_new(FALSE, 0);
934-#endif
935
936 /* Set up dialog */
937 dialogTitle=_("Configure cookie permission");
938@@ -786,12 +782,8 @@
939 gtk_tree_sortable_set_sort_column_id(sortableList, DOMAIN_COLUMN, GTK_SORT_ASCENDING);
940
941 /* Set up domain addition widgets */
942-#ifdef HAVE_GTK3
943 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
944 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
945-#else
946- hbox=gtk_hbox_new(FALSE, 0);
947-#endif
948
949 priv->addDomainEntry=gtk_entry_new();
950 gtk_entry_set_max_length(GTK_ENTRY(priv->addDomainEntry), 64);
951@@ -824,10 +816,6 @@
952 /* Set up cookie domain list */
953 priv->list=gtk_tree_view_new_with_model(GTK_TREE_MODEL(priv->listStore));
954
955-#ifndef HAVE_GTK3
956- gtk_widget_set_size_request(priv->list, -1, 300);
957-#endif
958-
959 priv->listSelection=gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->list));
960 gtk_tree_selection_set_mode(priv->listSelection, GTK_SELECTION_MULTIPLE);
961 g_signal_connect_swapped(priv->listSelection, "changed", G_CALLBACK(_cookie_permission_manager_preferences_changed_selection), self);
962@@ -853,21 +841,15 @@
963 gtk_tree_view_append_column(GTK_TREE_VIEW(priv->list), column);
964
965 scrolled=gtk_scrolled_window_new(NULL, NULL);
966-#ifdef HAVE_GTK3
967 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), height*10);
968-#endif
969 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
970 gtk_container_add(GTK_CONTAINER(scrolled), priv->list);
971 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
972 gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 5);
973
974 /* Set up cookie domain list management buttons */
975-#ifdef HAVE_GTK3
976 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
977 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
978-#else
979- hbox=gtk_hbox_new(FALSE, 0);
980-#endif
981
982 priv->deleteButton=gtk_button_new_from_stock(GTK_STOCK_DELETE);
983 gtk_widget_set_sensitive(priv->deleteButton, FALSE);
984@@ -883,12 +865,8 @@
985 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 5);
986
987 /* Add "unknown-policy" combo */
988-#ifdef HAVE_GTK3
989 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
990 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
991-#else
992- hbox=gtk_hbox_new(FALSE, 0);
993-#endif
994 widget=gtk_label_new(_("Policy for cookies from domains not in the list: "));
995 gtk_container_add(GTK_CONTAINER(hbox), widget);
996
997
998=== modified file 'extensions/cookie-permissions/cookie-permission-manager.c'
999--- extensions/cookie-permissions/cookie-permission-manager.c 2014-06-14 03:40:37 +0000
1000+++ extensions/cookie-permissions/cookie-permission-manager.c 2015-03-10 00:27:20 +0000
1001@@ -545,10 +545,6 @@
1002
1003 /* Create list and set up columns of list */
1004 list=gtk_tree_view_new_with_model(GTK_TREE_MODEL(listStore));
1005-#ifndef HAVE_GTK3
1006- gtk_widget_set_size_request(list, -1, 100);
1007-#endif
1008-
1009 renderer=gtk_cell_renderer_text_new();
1010 column=gtk_tree_view_column_new_with_attributes(_("Domain"),
1011 renderer,
1012@@ -589,9 +585,7 @@
1013 gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
1014
1015 scrolled=gtk_scrolled_window_new(NULL, NULL);
1016-#ifdef HAVE_GTK3
1017 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), 100);
1018-#endif
1019 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1020 gtk_container_add(GTK_CONTAINER(scrolled), list);
1021 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
1022
1023=== added file 'extensions/donottrack.web.vala'
1024--- extensions/donottrack.web.vala 1970-01-01 00:00:00 +0000
1025+++ extensions/donottrack.web.vala 2015-03-10 00:27:20 +0000
1026@@ -0,0 +1,141 @@
1027+/*
1028+ Copyright (C) 2014 Christian Dywan <christian@twotoasts.de>
1029+
1030+ This library is free software; you can redistribute it and/or
1031+ modify it under the terms of the GNU Lesser General Public
1032+ License as published by the Free Software Foundation; either
1033+ version 2.1 of the License, or (at your option) any later version.
1034+
1035+ See the file COPYING for the full license text.
1036+*/
1037+
1038+namespace DoNotTrack {
1039+ struct Stain {
1040+ string key;
1041+ string host;
1042+ }
1043+ const Stain[] stains = {
1044+ /* analytics.google.com */
1045+ { "utm_source" },
1046+ { "utm_medium" },
1047+ { "utm_term" },
1048+ { "utm_content" },
1049+ { "utm_campaign" },
1050+ { "utm_reader" },
1051+ /* metrika.yandex.ru */
1052+ { "yclid" },
1053+ /* youtube.com */
1054+ { "feature", "youtube.com" },
1055+ /* facebook.com */
1056+ { "fb_action_ids" },
1057+ { "fb_action_types" },
1058+ { "fb_ref" },
1059+ { "fb_source" },
1060+ { "action_object_map" },
1061+ { "action_type_map" },
1062+ { "action_ref_map" },
1063+ { "ref", "www.facebook.com" },
1064+ { "fref", "www.facebook.com" },
1065+ { "hc_location", "www.facebook.com" },
1066+ /* imdb.com */
1067+ { "ref_", "imdb.com" },
1068+ /* addons.mozilla.org */
1069+ { "src", "addons.mozilla.org" }
1070+ };
1071+
1072+ public class Cleanser : Object {
1073+ File config;
1074+ public bool active = false;
1075+
1076+ public Cleanser () {
1077+ config = File.new_for_path (Midori.Paths.get_config_filename_for_reading ("config"));
1078+ /* TODO: Determine if removal of dirt is enabled */
1079+ active = true;
1080+ }
1081+ bool has_stains (string host, string key) {
1082+ /*
1083+ See also https://addons.mozilla.org/en/firefox/addon/pure-url/
1084+ as well as Epiphany for a C version
1085+ */
1086+ foreach (var stain in stains) {
1087+ if (stain.host != null && host.has_suffix (stain.host))
1088+ continue;
1089+ if (stain.key == key)
1090+ return true;
1091+ }
1092+ return false;
1093+ }
1094+
1095+ public string? remove_dirt (string uri) {
1096+ string? host = uri.split ("/")[2];
1097+ string? query = uri.split ("?")[1];
1098+ if (query == null)
1099+ return null;
1100+ string[] variables = query.split("&");
1101+ string spotless = "";
1102+ foreach (string variable in variables) {
1103+ // Note: a single & may result in a null key
1104+ string? key = variable.split ("=")[0];
1105+ if (key != null && !has_stains (host, key))
1106+ spotless += variable + "&";
1107+ }
1108+ string pure = uri.replace (query, spotless);
1109+ return pure;
1110+ }
1111+ }
1112+
1113+ public class Extension : Object {
1114+ bool debug = false;
1115+ Cleanser cleanser;
1116+
1117+ public Extension (WebKit.WebExtension extension) {
1118+ if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "donottrack") == 0)
1119+ debug = true;
1120+ cleanser = new Cleanser ();
1121+ extension.page_created.connect (page_created);
1122+ }
1123+
1124+ void page_created (WebKit.WebPage page) {
1125+ page.send_request.connect (send_request);
1126+ }
1127+
1128+ bool send_request (WebKit.URIRequest request, WebKit.URIResponse? redirect) {
1129+ if (!cleanser.active)
1130+ return false;
1131+
1132+ Soup.MessageHeaders? headers = request.get_http_headers ();
1133+ if (headers == null)
1134+ return false;
1135+
1136+ /*
1137+ First instance: ask nicely to be left alone
1138+ See http://tools.ietf.org/id/draft-mayer-do-not-track-00.txt
1139+ */
1140+ headers.append ("DNT", "1");
1141+
1142+ /* Second instance: deal with what won't play nice */
1143+ string? pure = cleanser.remove_dirt (request.uri);
1144+ if (pure != null) {
1145+ request.uri = pure;
1146+ if (debug)
1147+ stdout.printf ("DoNotTrack: Removed dirt from %s leaving only %s\n", request.uri, pure);
1148+ }
1149+ return false;
1150+ }
1151+ }
1152+}
1153+
1154+DoNotTrack.Extension? do_not_track;
1155+public void webkit_web_extension_initialize_with_user_data (WebKit.WebExtension extension, Variant user_data) {
1156+ Midori.Paths.init_with_user_data (user_data);
1157+ do_not_track = new DoNotTrack.Extension (extension);
1158+}
1159+
1160+void do_not_track_urls () {
1161+ /* TODO */
1162+}
1163+
1164+public void extension_test () {
1165+ Test.add_func ("/donottrack/urls", do_not_track_urls);
1166+}
1167+
1168
1169=== modified file 'extensions/external-download-manager.vala'
1170--- extensions/external-download-manager.vala 2014-07-11 05:49:56 +0000
1171+++ extensions/external-download-manager.vala 2015-03-10 00:27:20 +0000
1172@@ -42,15 +42,8 @@
1173 if (download_type == Midori.DownloadType.SAVE) {
1174 var dlReq = new DownloadRequest ();
1175
1176- #if HAVE_WEBKIT2
1177- dlReq.uri = download.request.get_uri ();
1178- weak MessageHeaders headers = download.request.get_http_headers ();
1179- #else
1180- dlReq.uri = download.get_uri ();
1181- var request = download.get_network_request ();
1182- var message = request.get_message ();
1183- weak MessageHeaders headers = message.request_headers;
1184- #endif
1185+ dlReq.uri = download.get_request ().get_uri ();
1186+ weak MessageHeaders headers = download.get_request ().get_http_headers ();
1187
1188 dlReq.auth = headers.get ("Authorization");
1189 dlReq.referer = headers.get ("Referer");
1190@@ -107,11 +100,7 @@
1191 }
1192
1193 construct {
1194- #if HAVE_WEBKIT2
1195 var session= new Session ();
1196- #else
1197- var session = WebKit.get_default_session ();
1198- #endif
1199 this.cookie_jar = session.get_feature (typeof (CookieJar)) as CookieJar;
1200 }
1201 }
1202@@ -275,15 +264,9 @@
1203 this.input = new Entry ();
1204 this.input.set_text (this.commandline.get_string ("commandline"));
1205
1206-
1207-#if HAVE_GTK3
1208 Gtk.Box vbox = get_content_area () as Gtk.Box;
1209 vbox.pack_start (text, false, false, 0);
1210 vbox.pack_start (this.input, false, true, 0);
1211-#else
1212- this.vbox.pack_start (text, false, false, 0);
1213- this.vbox.pack_start (this.input, false, true, 0);
1214-#endif
1215
1216 this.add_button (Gtk.STOCK_CANCEL, ResponseType.CANCEL);
1217 this.add_button (Gtk.STOCK_APPLY, ResponseType.APPLY);
1218
1219=== modified file 'extensions/feed-panel/feed-panel.c'
1220--- extensions/feed-panel/feed-panel.c 2013-10-25 21:49:56 +0000
1221+++ extensions/feed-panel/feed-panel.c 2015-03-10 00:27:20 +0000
1222@@ -800,12 +800,8 @@
1223 NULL);
1224 gtk_widget_show (treeview);
1225
1226-#if GTK_CHECK_VERSION(3,0,0)
1227 font_desc = (PangoFontDescription*)gtk_style_context_get_font (
1228 gtk_widget_get_style_context (treeview), GTK_STATE_FLAG_NORMAL);
1229-#else
1230- font_desc = treeview->style->font_desc;
1231-#endif
1232 family = pango_font_description_get_family (font_desc);
1233 size = pango_font_description_get_size (font_desc) / PANGO_SCALE;
1234 settings = midori_web_settings_new ();
1235
1236=== modified file 'extensions/feed-panel/main.c'
1237--- extensions/feed-panel/main.c 2013-08-12 19:21:06 +0000
1238+++ extensions/feed-panel/main.c 2015-03-10 00:27:20 +0000
1239@@ -348,7 +348,7 @@
1240
1241 dialog = gtk_dialog_new_with_buttons (
1242 _("New feed"), GTK_WINDOW (priv->browser),
1243- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
1244+ GTK_DIALOG_DESTROY_WITH_PARENT,
1245 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1246 GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
1247 NULL);
1248
1249=== modified file 'extensions/formhistory/formhistory.c'
1250--- extensions/formhistory/formhistory.c 2013-11-26 19:08:06 +0000
1251+++ extensions/formhistory/formhistory.c 2015-03-10 00:27:20 +0000
1252@@ -99,7 +99,7 @@
1253 alive = 1;
1254 title = _("Form history");
1255 dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parent),
1256- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
1257+ GTK_DIALOG_DESTROY_WITH_PARENT,
1258 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1259 GTK_STOCK_OK, GTK_RESPONSE_OK,
1260 NULL);
1261
1262=== modified file 'extensions/history-list.vala'
1263--- extensions/history-list.vala 2013-10-28 22:33:16 +0000
1264+++ extensions/history-list.vala 2015-03-10 00:27:20 +0000
1265@@ -107,12 +107,8 @@
1266 Requisition requisition;
1267 int height;
1268 int max_lines = 10;
1269-#if HAVE_GTK3
1270 requisition = Requisition();
1271 this.treeview.get_preferred_size(out requisition, null);
1272-#else
1273- this.treeview.size_request (out requisition);
1274-#endif
1275 Gtk.ListStore model = this.treeview.get_model () as Gtk.ListStore;
1276 int length = model.iter_n_children(null);
1277 if (length > max_lines) {
1278@@ -217,12 +213,6 @@
1279
1280 model.get_iter (out iter, path);
1281 model.get (iter, TabTreeCells.TREE_CELL_POINTER, out view);
1282-#if !HAVE_GTK3
1283- /* removing the selected cursor causes a segfault when using GTK2 */
1284- if (path.prev () == false)
1285- path.next ();
1286- this.treeview.set_cursor (path, column, false);
1287-#endif
1288
1289 /*
1290 FixMe: the retrun value of `Gtk.ListStore.remove` should be checked
1291@@ -364,11 +354,7 @@
1292 table.attach_defaults (proxy, 0, 2, 1, 2);
1293 #endif
1294
1295-#if HAVE_GTK3
1296 (get_content_area() as Gtk.Box).pack_start (table, false, true, 0);
1297-#else
1298- this.vbox.pack_start (table, false, true, 0);
1299-#endif
1300
1301 this.add_button (Gtk.STOCK_CANCEL, ResponseType.CANCEL);
1302 this.add_button (Gtk.STOCK_APPLY, ResponseType.APPLY);
1303
1304=== added file 'extensions/hsts.web.vala'
1305--- extensions/hsts.web.vala 1970-01-01 00:00:00 +0000
1306+++ extensions/hsts.web.vala 2015-03-10 00:27:20 +0000
1307@@ -0,0 +1,173 @@
1308+/*
1309+ Copyright (C) 2012-2014 Christian Dywan <christian@twotoasts.de>
1310+
1311+ This library is free software; you can redistribute it and/or
1312+ modify it under the terms of the GNU Lesser General Public
1313+ License as published by the Free Software Foundation; either
1314+ version 2.1 of the License, or (at your option) any later version.
1315+
1316+ See the file COPYING for the full license text.
1317+*/
1318+
1319+namespace HSTS {
1320+ public class Directive {
1321+ public Soup.Date? expires = null;
1322+ public bool sub_domains = false;
1323+
1324+ public Directive (bool include_sub_domains) {
1325+ expires = new Soup.Date.from_now (int.MAX);
1326+ sub_domains = include_sub_domains;
1327+ }
1328+
1329+ public Directive.from_header (string header) {
1330+ var param_list = Soup.header_parse_param_list (header);
1331+ if (param_list == null)
1332+ return;
1333+
1334+ string? max_age = param_list.lookup ("max-age");
1335+ if (max_age != null)
1336+ expires = new Soup.Date.from_now (max_age.to_int ());
1337+ if ("includeSubDomains" in header)
1338+ sub_domains = true;
1339+ Soup.header_free_param_list (param_list);
1340+ }
1341+
1342+ public bool is_valid () {
1343+ return expires != null && !expires.is_past ();
1344+ }
1345+ }
1346+
1347+ public class Whitelist : Object {
1348+ HashTable<string, Directive> whitelist;
1349+ string preset = "/etc/xdg/midori/hsts";
1350+ File config;
1351+
1352+ public Whitelist () {
1353+ whitelist = new HashTable<string, Directive> (str_hash, str_equal);
1354+ read_cache.begin (File.new_for_path (preset));
1355+ config = File.new_for_path (Midori.Paths.get_config_filename_for_writing ("hsts"));
1356+ read_cache.begin (config);
1357+ }
1358+
1359+ async void read_cache (File file) {
1360+ try {
1361+ var stream = new DataInputStream (yield file.read_async ());
1362+ do {
1363+ string? line = yield stream.read_line_async ();
1364+ if (line == null)
1365+ break;
1366+ string[] parts = line.split (" ", 2);
1367+ if (parts[0] == null || parts[1] == null)
1368+ break;
1369+ var directive = new Directive.from_header (parts[1]);
1370+ if (directive.is_valid ())
1371+ append_to_whitelist (parts[0], directive);
1372+ } while (true);
1373+ } catch (IOError.NOT_FOUND exist_error) {
1374+ /* It's no error if no cache file exists */
1375+ } catch (Error error) {
1376+ warning ("Failed to read cache %s: %s", file.get_path (), error.message);
1377+ }
1378+ }
1379+
1380+ public bool should_secure_host (string host) {
1381+ Directive? directive = whitelist.lookup (host);
1382+ if (directive == null)
1383+ directive = whitelist.lookup ("*." + host);
1384+ return directive != null && directive.is_valid ();
1385+ }
1386+
1387+ void append_to_whitelist (string host, Directive directive) {
1388+ whitelist.insert (host, directive);
1389+ if (directive.sub_domains)
1390+ whitelist.insert ("*." + host, directive);
1391+ }
1392+
1393+ async void append_to_cache (string host, string header) {
1394+ /* FIXME: Don't write in private browsing */
1395+
1396+ try {
1397+ var stream = yield config.append_to_async (FileCreateFlags.NONE);
1398+ yield stream.write_async ((host + " " + header + "\n").data);
1399+ yield stream.flush_async ();
1400+ }
1401+ catch (Error error) {
1402+ critical ("Failed to update %s: %s", config.get_path (), error.message);
1403+ }
1404+ }
1405+
1406+ public Directive? strict_transport_security_handled (string host, Soup.MessageHeaders headers) {
1407+ unowned string? hsts = headers.get_one ("Strict-Transport-Security");
1408+ if (hsts == null)
1409+ return null;
1410+
1411+ var directive = new Directive.from_header (hsts);
1412+ if (directive.is_valid ()) {
1413+ append_to_whitelist (host, directive);
1414+ append_to_cache.begin (host, hsts);
1415+ }
1416+ return directive;
1417+ }
1418+
1419+ }
1420+
1421+ public class Extension : Object {
1422+ Whitelist whitelist;
1423+ bool debug = false;
1424+
1425+ public Extension (WebKit.WebExtension extension) {
1426+ if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "hsts") == 0)
1427+ debug = true;
1428+ whitelist = new Whitelist ();
1429+ extension.page_created.connect (page_created);
1430+ }
1431+
1432+ void page_created (WebKit.WebPage page) {
1433+ page.send_request.connect (send_request);
1434+ }
1435+
1436+ bool send_request (WebKit.URIRequest request, WebKit.URIResponse? redirect) {
1437+ Soup.MessageHeaders? headers = request.get_http_headers ();
1438+ if (headers == null || !request.uri.contains ("/"))
1439+ return false;
1440+
1441+ string host = request.uri.split ("/")[2];
1442+ if (whitelist.should_secure_host (host)) {
1443+ request.uri = request.uri.replace ("http://", "https://");
1444+ if (debug)
1445+ stdout.printf ("HSTS: Enforce %s\n", host);
1446+ } else if (request.uri.has_prefix ("http://")) {
1447+ var directive = whitelist.strict_transport_security_handled (host, headers);
1448+ if (debug)
1449+ stdout.printf ("HSTS: %s valid? %s\n",
1450+ host, directive != null ? directive.is_valid ().to_string () : "/");
1451+ }
1452+ return false;
1453+ }
1454+ }
1455+}
1456+
1457+HSTS.Extension? hsts;
1458+public void webkit_web_extension_initialize_with_user_data (WebKit.WebExtension extension, Variant user_data) {
1459+ Midori.Paths.init_with_user_data (user_data);
1460+ hsts = new HSTS.Extension (extension);
1461+}
1462+
1463+void hsts_directive () {
1464+ HSTS.Directive d;
1465+ d = new HSTS.Directive.from_header ("max-age=31536000");
1466+ assert (d.is_valid () && !d.sub_domains);
1467+ d = new HSTS.Directive.from_header ("max-age=15768000 ; includeSubDomains");
1468+ assert (d.is_valid () && d.sub_domains);
1469+
1470+ /* Invalid */
1471+ d = new HSTS.Directive.from_header ("");
1472+ assert (!d.is_valid () && !d.sub_domains);
1473+ d = new HSTS.Directive.from_header ("includeSubDomains");
1474+ assert (!d.is_valid () && d.sub_domains);
1475+}
1476+
1477+public void extension_test () {
1478+ Test.add_func ("/hsts/directive", hsts_directive);
1479+}
1480+
1481
1482=== modified file 'extensions/nojs/nojs-preferences.c'
1483--- extensions/nojs/nojs-preferences.c 2013-08-16 22:02:25 +0000
1484+++ extensions/nojs/nojs-preferences.c 2015-03-10 00:27:20 +0000
1485@@ -839,12 +839,8 @@
1486
1487 /* Get content area to add gui controls to */
1488 priv->contentArea=gtk_dialog_get_content_area(GTK_DIALOG(self));
1489-#if GTK_CHECK_VERSION (3, 0, 0)
1490 vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
1491 gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
1492-#else
1493- vbox=gtk_vbox_new(FALSE, 0);
1494-#endif
1495
1496 /* Set up dialog */
1497 dialogTitle=_("Configure NoJS");
1498@@ -887,12 +883,8 @@
1499 gtk_tree_sortable_set_sort_column_id(sortableList, DOMAIN_COLUMN, GTK_SORT_ASCENDING);
1500
1501 /* Set up domain addition widgets */
1502-#ifdef HAVE_GTK3
1503 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
1504 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
1505-#else
1506- hbox=gtk_hbox_new(FALSE, 0);
1507-#endif
1508
1509 priv->addDomainEntry=gtk_entry_new();
1510 gtk_entry_set_max_length(GTK_ENTRY(priv->addDomainEntry), 64);
1511@@ -925,10 +917,6 @@
1512 /* Set up domain list view */
1513 priv->list=gtk_tree_view_new_with_model(GTK_TREE_MODEL(priv->listStore));
1514
1515-#if !GTK_CHECK_VERSION (3, 0, 0)
1516- gtk_widget_set_size_request(priv->list, -1, 300);
1517-#endif
1518-
1519 priv->listSelection=gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->list));
1520 gtk_tree_selection_set_mode(priv->listSelection, GTK_SELECTION_MULTIPLE);
1521 g_signal_connect_swapped(priv->listSelection, "changed", G_CALLBACK(_nojs_preferences_changed_selection), self);
1522@@ -954,21 +942,15 @@
1523 gtk_tree_view_append_column(GTK_TREE_VIEW(priv->list), column);
1524
1525 scrolled=gtk_scrolled_window_new(NULL, NULL);
1526-#if GTK_CHECK_VERSION (3, 0, 0)
1527 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), height*10);
1528-#endif
1529 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1530 gtk_container_add(GTK_CONTAINER(scrolled), priv->list);
1531 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
1532 gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 5);
1533
1534 /* Set up JavaScript domain list management buttons */
1535-#if GTK_CHECK_VERSION (3, 0, 0)
1536 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
1537 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
1538-#else
1539- hbox=gtk_hbox_new(FALSE, 0);
1540-#endif
1541
1542 priv->deleteButton=gtk_button_new_from_stock(GTK_STOCK_DELETE);
1543 gtk_widget_set_sensitive(priv->deleteButton, FALSE);
1544
1545=== modified file 'extensions/nojs/nojs.c'
1546--- extensions/nojs/nojs.c 2013-09-16 23:18:48 +0000
1547+++ extensions/nojs/nojs.c 2015-03-10 00:27:20 +0000
1548@@ -513,7 +513,7 @@
1549 statusbarIcon=gtk_button_new();
1550 gtk_button_set_relief(GTK_BUTTON(statusbarIcon), GTK_RELIEF_NONE);
1551 gtk_widget_show_all(statusbarIcon);
1552- gtk_box_pack_end(GTK_BOX(statusbar), statusbarIcon, FALSE, FALSE, 0);
1553+ gtk_container_add(GTK_CONTAINER(statusbar), statusbarIcon);
1554 g_object_set_data_full(G_OBJECT(inBrowser), "nojs-statusicon", g_object_ref(statusbarIcon), (GDestroyNotify)gtk_widget_destroy);
1555
1556 /* Connect signals */
1557
1558=== removed file 'extensions/nsplugin-manager.vala'
1559--- extensions/nsplugin-manager.vala 2013-06-19 20:27:53 +0000
1560+++ extensions/nsplugin-manager.vala 1970-01-01 00:00:00 +0000
1561@@ -1,71 +0,0 @@
1562-/*
1563- Copyright (C) 2012 André Stösel <andre@stoesel.de>
1564-
1565- This library is free software; you can redistribute it and/or
1566- modify it under the terms of the GNU Lesser General Public
1567- License as published by the Free Software Foundation; either
1568- version 2.1 of the License, or (at your option) any later version.
1569-
1570- See the file COPYING for the full license text.
1571-*/
1572-
1573-namespace NSPlugins {
1574- private int active_plugins = 0;
1575-
1576- private class Extension : Midori.Extension {
1577- protected WebKit.WebPlugin plugin;
1578-
1579- void activated (Midori.App app) {
1580- active_plugins += 1;
1581- this.plugin.set_enabled (true);
1582- app.settings.enable_plugins = active_plugins > 0;
1583- }
1584-
1585- void deactivated () {
1586- Midori.App app = this.get_app ();
1587- active_plugins -= 1;
1588- this.plugin.set_enabled (false);
1589- app.settings.enable_plugins = active_plugins > 0;
1590- }
1591-
1592- internal Extension (WebKit.WebPlugin plugin) {
1593- string desc = plugin.get_description ();
1594- try {
1595- var regex = new Regex ("<a.+href.+>(.+)</a>");
1596- desc = regex.replace (desc, -1, 0, "<u>\\1</u>");
1597- desc = desc.replace ("<br>", "\n");
1598- }
1599- catch (Error error) { }
1600- GLib.Object (stock_id: Midori.Stock.PLUGINS,
1601- name: plugin.get_name (),
1602- description: desc,
1603- use_markup: true,
1604- key: GLib.Path.get_basename (plugin.get_path ()),
1605- version: "(%s)".printf ("Netscape plugins"),
1606- authors: "");
1607-
1608- this.plugin = plugin;
1609- this.plugin.set_enabled (false);
1610-
1611- this.activate.connect (activated);
1612- this.deactivate.connect (deactivated);
1613- }
1614- }
1615-}
1616-
1617-public Katze.Array? extension_init () {
1618- if (!Midori.WebSettings.has_plugin_support ())
1619- return null;
1620-
1621- var extensions = new Katze.Array( typeof (Midori.Extension));
1622- WebKit.WebPluginDatabase pdb = WebKit.get_web_plugin_database ();
1623- SList<WebKit.WebPlugin> plugins = pdb.get_plugins ();
1624-
1625- foreach (WebKit.WebPlugin plugin in plugins) {
1626- if (Midori.WebSettings.skip_plugin (plugin.get_path ()))
1627- continue;
1628- extensions.add_item (new NSPlugins.Extension (plugin));
1629- }
1630- return extensions;
1631-}
1632-
1633
1634=== modified file 'extensions/open-with.vala'
1635--- extensions/open-with.vala 2014-03-15 20:43:57 +0000
1636+++ extensions/open-with.vala 2015-03-10 00:27:20 +0000
1637@@ -157,9 +157,6 @@
1638 transient_for = browser;
1639
1640 title = _("Custom…");
1641-#if !HAVE_GTK3
1642- has_separator = false;
1643-#endif
1644 destroy_with_parent = true;
1645 set_icon_name (Gtk.STOCK_OPEN);
1646 resizable = false;
1647@@ -368,11 +365,7 @@
1648
1649 var browser = Midori.Browser.get_for_widget (widget);
1650 transient_for = browser;
1651-
1652 title = _("Choose application");
1653-#if !HAVE_GTK3
1654- has_separator = false;
1655-#endif
1656 destroy_with_parent = true;
1657 set_icon_name (Gtk.STOCK_OPEN);
1658 resizable = false;
1659@@ -547,11 +540,7 @@
1660 renderer.set ("markup",
1661 Markup.printf_escaped ("<b>%s</b>\n%s",
1662 desc, mime_type),
1663-#if HAVE_GTK3
1664 "max-width-chars", 30,
1665-#else
1666- "width-chars", 30,
1667-#endif
1668 "ellipsize", Pango.EllipsizeMode.END);
1669 }
1670
1671
1672=== modified file 'extensions/shortcuts.c'
1673--- extensions/shortcuts.c 2013-03-23 01:37:12 +0000
1674+++ extensions/shortcuts.c 2015-03-10 00:27:20 +0000
1675@@ -167,7 +167,7 @@
1676
1677 dialog_title = _("Customize Keyboard shortcuts");
1678 dialog = gtk_dialog_new_with_buttons (dialog_title, GTK_WINDOW (browser),
1679- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
1680+ GTK_DIALOG_DESTROY_WITH_PARENT,
1681 #if !HAVE_OSX
1682 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
1683 #endif
1684
1685=== modified file 'extensions/status-clock.c'
1686--- extensions/status-clock.c 2013-06-26 21:54:50 +0000
1687+++ extensions/status-clock.c 2015-03-10 00:27:20 +0000
1688@@ -105,7 +105,7 @@
1689 label = gtk_label_new (NULL);
1690
1691 statusbar = katze_object_get_object (browser, "statusbar");
1692- gtk_box_pack_end (GTK_BOX (statusbar), label, FALSE, FALSE, 0);
1693+ gtk_container_add (GTK_CONTAINER (statusbar), label);
1694
1695 g_object_set_data (G_OBJECT (browser), "clock-label", label);
1696 g_object_set_data (G_OBJECT (browser), "clock-extension", extension);
1697
1698=== modified file 'extensions/statusbar-features.c'
1699--- extensions/statusbar-features.c 2013-10-30 00:05:40 +0000
1700+++ extensions/statusbar-features.c 2015-03-10 00:27:20 +0000
1701@@ -34,33 +34,6 @@
1702 MidoriExtension* extension);
1703
1704 static void
1705-statusbar_features_toolbar_notify_toolbar_style_cb (GtkWidget* toolbar,
1706- GParamSpec* pspec,
1707- GtkWidget* button)
1708-{
1709- GtkToolbarStyle style = katze_object_get_enum (toolbar, "toolbar-style");
1710- const gchar* text = g_object_get_data (G_OBJECT (button), "feature-label");
1711- switch (style)
1712- {
1713- case GTK_TOOLBAR_BOTH:
1714- case GTK_TOOLBAR_BOTH_HORIZ:
1715- gtk_button_set_label (GTK_BUTTON (button), text);
1716- gtk_widget_show (gtk_button_get_image (GTK_BUTTON (button)));
1717- break;
1718- case GTK_TOOLBAR_TEXT:
1719- gtk_button_set_label (GTK_BUTTON (button), text);
1720- gtk_widget_hide (gtk_button_get_image (GTK_BUTTON (button)));
1721- break;
1722- case GTK_TOOLBAR_ICONS:
1723- gtk_button_set_label (GTK_BUTTON (button), "");
1724- gtk_widget_show (gtk_button_get_image (GTK_BUTTON (button)));
1725- break;
1726- default:
1727- g_assert_not_reached ();
1728- }
1729-}
1730-
1731-static void
1732 statusbar_features_browser_notify_tab_cb (MidoriBrowser* browser,
1733 GParamSpec* pspec,
1734 GtkWidget* combobox)
1735@@ -85,8 +58,6 @@
1736 GtkWidget* toolbar = katze_object_get_object (browser, "navigationbar");
1737
1738 gtk_widget_destroy (bbox);
1739- g_signal_handlers_disconnect_matched (toolbar, G_SIGNAL_MATCH_FUNC,
1740- 0, -1, NULL, statusbar_features_toolbar_notify_toolbar_style_cb, NULL);
1741 g_object_unref (toolbar);
1742 g_signal_handlers_disconnect_by_func (
1743 extension, statusbar_features_deactivate_cb, bbox);
1744@@ -149,35 +120,23 @@
1745
1746 if (!strcmp (property, "auto-load-images"))
1747 {
1748- g_object_set_data (G_OBJECT (button), "feature-label", _("Images"));
1749 image = gtk_image_new_from_stock (STOCK_IMAGE, GTK_ICON_SIZE_MENU);
1750 gtk_button_set_image (GTK_BUTTON (button), image);
1751 gtk_widget_set_tooltip_text (button, _("Load images automatically"));
1752- statusbar_features_toolbar_notify_toolbar_style_cb (toolbar, NULL, button);
1753- g_signal_connect (toolbar, "notify::toolbar-style",
1754- G_CALLBACK (statusbar_features_toolbar_notify_toolbar_style_cb), button);
1755 }
1756 if (!strcmp (property, "enable-javascript"))
1757 {
1758- g_object_set_data (G_OBJECT (button), "feature-label", _("Scripts"));
1759 image = gtk_image_new_from_stock (STOCK_SCRIPT, GTK_ICON_SIZE_MENU);
1760 gtk_button_set_image (GTK_BUTTON (button), image);
1761 gtk_widget_set_tooltip_text (button, _("Enable scripts"));
1762- statusbar_features_toolbar_notify_toolbar_style_cb (toolbar, NULL, button);
1763- g_signal_connect (toolbar, "notify::toolbar-style",
1764- G_CALLBACK (statusbar_features_toolbar_notify_toolbar_style_cb), button);
1765 }
1766 else if (!strcmp (property, "enable-plugins"))
1767 {
1768 if (!midori_web_settings_has_plugin_support ())
1769 gtk_widget_hide (button);
1770- g_object_set_data (G_OBJECT (button), "feature-label", _("Netscape plugins"));
1771 image = gtk_image_new_from_stock (MIDORI_STOCK_PLUGINS, GTK_ICON_SIZE_MENU);
1772 gtk_button_set_image (GTK_BUTTON (button), image);
1773 gtk_widget_set_tooltip_text (button, _("Enable Netscape plugins"));
1774- statusbar_features_toolbar_notify_toolbar_style_cb (toolbar, NULL, button);
1775- g_signal_connect (toolbar, "notify::toolbar-style",
1776- G_CALLBACK (statusbar_features_toolbar_notify_toolbar_style_cb), button);
1777 }
1778 return button;
1779 }
1780@@ -228,7 +187,7 @@
1781 gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2);
1782 }
1783 gtk_widget_show_all (bbox);
1784- gtk_box_pack_end (GTK_BOX (statusbar), bbox, FALSE, FALSE, 3);
1785+ gtk_container_add (GTK_CONTAINER (statusbar), bbox);
1786 g_object_unref (statusbar);
1787 g_object_unref (toolbar);
1788
1789
1790=== modified file 'extensions/tabby.vala'
1791--- extensions/tabby.vala 2014-04-25 19:49:26 +0000
1792+++ extensions/tabby.vala 2015-03-10 00:27:20 +0000
1793@@ -236,12 +236,7 @@
1794 }
1795 }
1796
1797-#if HAVE_GTK3
1798 protected bool delete_event (Gtk.Widget widget, Gdk.EventAny event) {
1799-#else
1800- protected bool delete_event (Gtk.Widget widget, Gdk.Event event) {
1801-#endif
1802-
1803 this.close ();
1804 return false;
1805
1806
1807=== modified file 'extensions/transfers.vala'
1808--- extensions/transfers.vala 2014-02-22 22:35:42 +0000
1809+++ extensions/transfers.vala 2015-03-10 00:27:20 +0000
1810@@ -31,27 +31,14 @@
1811 internal double progress { get {
1812 return Midori.Download.get_progress (download);
1813 } }
1814-#if HAVE_WEBKIT2
1815 public bool succeeded { get; protected set; default = false; }
1816 public bool finished { get; protected set; default = false; }
1817 internal string destination { get {
1818 return download.destination;
1819 } }
1820-#else
1821- internal bool succeeded { get {
1822- return download.status == WebKit.DownloadStatus.FINISHED;
1823- } }
1824- internal bool finished { get {
1825- return Midori.Download.is_finished (download);
1826- } }
1827- internal string destination { get {
1828- return download.destination_uri;
1829- } }
1830-#endif
1831
1832 internal Transfer (WebKit.Download download) {
1833 this.download = download;
1834- #if HAVE_WEBKIT2
1835 download.notify["estimated-progress"].connect (transfer_changed);
1836 download.finished.connect (() => {
1837 succeeded = finished = true;
1838@@ -62,10 +49,6 @@
1839 finished = true;
1840 changed ();
1841 });
1842- #else
1843- download.notify["status"].connect (transfer_changed);
1844- download.notify["progress"].connect (transfer_changed);
1845- #endif
1846 }
1847
1848 void transfer_changed (GLib.ParamSpec pspec) {
1849@@ -316,9 +299,7 @@
1850
1851 var box = new Gtk.HBox (false, 0);
1852 progress = new Gtk.ProgressBar ();
1853-#if HAVE_GTK3
1854 progress.show_text = true;
1855-#endif
1856 progress.ellipsize = Pango.EllipsizeMode.MIDDLE;
1857 string filename = Midori.Download.get_basename_for_display (transfer.destination);
1858 progress.text = filename;
1859@@ -489,11 +470,7 @@
1860 transfer.removed ();
1861 }
1862
1863-#if HAVE_GTK3
1864 bool browser_closed (Gtk.Widget widget, Gdk.EventAny event) {
1865-#else
1866- bool browser_closed (Gtk.Widget widget, Gdk.Event event) {
1867-#endif
1868 var browser = widget as Midori.Browser;
1869 if (pending_transfers (array)) {
1870 var dialog = new Gtk.MessageDialog (browser,
1871@@ -518,11 +495,7 @@
1872 browser.panel.append_page (viewable);
1873 widgets.append (viewable);
1874 var toolbar = new Toolbar (array);
1875-#if HAVE_GTK3
1876- browser.statusbar.pack_end (toolbar, false, false);
1877-#else
1878- browser.statusbar.pack_start (toolbar, false, false);
1879-#endif
1880+ browser.add_toolbar (toolbar);
1881 widgets.append (toolbar);
1882 // TODO: popover
1883 // TODO: progress in dock item
1884
1885=== added directory 'ipc'
1886=== added file 'ipc/CMakeLists.txt'
1887--- ipc/CMakeLists.txt 1970-01-01 00:00:00 +0000
1888+++ ipc/CMakeLists.txt 2015-03-10 00:27:20 +0000
1889@@ -0,0 +1,47 @@
1890+include(ValaPrecompile)
1891+
1892+set(LIBMIDORI2_VERSION 0.6.0)
1893+set(LIBMIDORI2_SOVERSION 0)
1894+file(GLOB LIBMIDORI2_SOURCE *.vala)
1895+
1896+vala_precompile(LIBMIDORI2_SOURCE_C ${LIBMIDORI2}
1897+ ${LIBMIDORI2_SOURCE}
1898+PACKAGES
1899+ ${PACKAGES_CORE}
1900+OPTIONS
1901+ ${VALAFLAGS}
1902+GENERATE_VAPI
1903+ "${LIBMIDORI2}"
1904+GENERATE_HEADER
1905+ "${LIBMIDORI2}"
1906+)
1907+
1908+add_library("${LIBMIDORI2}" SHARED ${LIBMIDORI2_SOURCE_C})
1909+target_link_libraries("${LIBMIDORI2}"
1910+ ${DEPS_LIBRARIES}
1911+ )
1912+set_target_properties("${LIBMIDORI2}" PROPERTIES
1913+ COMPILE_FLAGS "${VALA_CFLAGS}"
1914+ POSITION_INDEPENDENT_CODE ON
1915+ VERSION ${LIBMIDORI2_VERSION}
1916+ SOVERSION ${LIBMIDORI2_SOVERSION}
1917+ )
1918+
1919+include_directories(
1920+ ${CMAKE_SOURCE_DIR}
1921+ ${CMAKE_CURRENT_SOURCE_DIR}
1922+ ${CMAKE_BINARY_DIR}
1923+ ${DEPS_INCLUDE_DIRS}
1924+ ${OPTS_INCLUDE_DIRS}
1925+ ${DEPS_GTK_INCLUDE_DIRS}
1926+ )
1927+if (WIN32)
1928+ install(TARGETS ${LIBMIDORI2}
1929+ LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}
1930+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1931+ )
1932+else ()
1933+ install(TARGETS ${LIBMIDORI2}
1934+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1935+ )
1936+endif ()
1937
1938=== added file 'ipc/ipc-contextaction.vala'
1939--- ipc/ipc-contextaction.vala 1970-01-01 00:00:00 +0000
1940+++ ipc/ipc-contextaction.vala 2015-03-10 00:27:20 +0000
1941@@ -0,0 +1,56 @@
1942+/*
1943+ Copyright (C) 2013-2015 Christian Dywan <christian@twotoasts.de>
1944+
1945+ This library is free software; you can redistribute it and/or
1946+ modify it under the terms of the GNU Lesser General Public
1947+ License as published by the Free Software Foundation; either
1948+ version 2.1 of the License, or (at your option) any later version.
1949+
1950+ See the file COPYING for the full license text.
1951+*/
1952+
1953+namespace Midori {
1954+ /* A context item that make a menu, toolbar or button.
1955+ Since: 0.6.0 */
1956+ public class ContextItem : Gtk.Action {
1957+ List<Gtk.Action> children;
1958+ public ContextItem (string name, string? label, string? tooltip, string? stock_id) {
1959+ GLib.Object (name: name, label: label, tooltip: tooltip, stock_id: stock_id);
1960+ children = new List<ContextItem> ();
1961+ }
1962+
1963+ public Variant to_user_data () {
1964+ var user_data = new HashTable<string, string> (str_hash, str_equal);
1965+ user_data.insert ("name", name);
1966+ user_data.insert ("label", label ?? "");
1967+ user_data.insert ("tooltip", tooltip ?? "");
1968+ user_data.insert ("stock_id", stock_id ?? "");
1969+ return user_data;
1970+ }
1971+
1972+ /*
1973+ The action label will be escaped for mnemonics so for example
1974+ "a_fairy_tale" will not get accel keys on "f" or "t".
1975+ */
1976+ public ContextItem.escaped (string name, string label, string? tooltip, string? stock_id) {
1977+ string? escaped_label = label.replace ("_", "__");
1978+ GLib.Object (name: name, label: escaped_label, tooltip: tooltip, stock_id: stock_id);
1979+ children = new List<ContextItem> ();
1980+ }
1981+
1982+ public void add (Gtk.Action? action) {
1983+ if (action == null) {
1984+ add (new SeparatorContextItem ());
1985+ return;
1986+ }
1987+
1988+ children.append (action);
1989+ }
1990+ }
1991+
1992+ public class SeparatorContextItem : ContextItem {
1993+ public SeparatorContextItem () {
1994+ GLib.Object (name: "SeparatorContextAction", label: null, tooltip: null, stock_id: null);
1995+ }
1996+ }
1997+}
1998
1999=== added file 'ipc/ipc-paths.vala'
2000--- ipc/ipc-paths.vala 1970-01-01 00:00:00 +0000
2001+++ ipc/ipc-paths.vala 2015-03-10 00:27:20 +0000
2002@@ -0,0 +1,132 @@
2003+/*
2004+ Copyright (C) 2012-2015 Christian Dywan <christian@twotoasts.de>
2005+
2006+ This library is free software; you can redistribute it and/or
2007+ modify it under the terms of the GNU Lesser General Public
2008+ License as published by the Free Software Foundation; either
2009+ version 2.1 of the License, or (at your option) any later version.
2010+
2011+ See the file COPYING for the full license text.
2012+*/
2013+
2014+extern const string MDATADIR;
2015+extern const string PACKAGE_NAME;
2016+
2017+namespace Midori {
2018+ public enum RuntimeMode {
2019+ UNDEFINED,
2020+ NORMAL,
2021+ APP,
2022+ PRIVATE,
2023+ PORTABLE
2024+ }
2025+
2026+ namespace Paths {
2027+ static RuntimeMode mode = RuntimeMode.UNDEFINED;
2028+ static string? exec_path = null;
2029+ static string? config_dir = null;
2030+ static string? readonly_dir = null;
2031+ static string? app_name = null;
2032+
2033+ public static void mkdir_with_parents (string path, int mode = 0700) {
2034+ /* Use g_access instead of g_file_test for better performance */
2035+ if (Posix.access (path, Posix.F_OK) == 0)
2036+ return;
2037+ int i = path.index_of_char (Path.DIR_SEPARATOR, 0);
2038+ do {
2039+ string fn = path.substring (i, -1);
2040+ if (Posix.access (fn, Posix.F_OK) != 0) {
2041+ if (DirUtils.create (fn, mode) == -1) {
2042+ /* Slow fallback; if this fails we fail */
2043+ DirUtils.create_with_parents (path, mode);
2044+ return;
2045+ }
2046+ }
2047+ else if (!FileUtils.test (fn, FileTest.IS_SYMLINK))
2048+ return; /* Failed */
2049+
2050+ i = path.index_of_char (Path.DIR_SEPARATOR, i);
2051+ }
2052+ while (i != -1);
2053+ }
2054+
2055+ public static void init_with_user_data (Variant user_data) {
2056+ /* Web extensions may run in the same process */
2057+ if (mode != RuntimeMode.UNDEFINED)
2058+ return;
2059+ if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "addons") == 0)
2060+ stdout.printf ("Addons: Serialized config %s\n", user_data.print (true));
2061+ var config = user_data as HashTable<string, string>;
2062+ mode = (RuntimeMode)config["mode"];
2063+ assert (mode != RuntimeMode.UNDEFINED);
2064+ readonly_dir = config["readonly_dir"];
2065+ config_dir = config["config_dir"];
2066+ assert (readonly_dir != null || config_dir != null);
2067+ exec_path = config["exec_path"];
2068+ assert (exec_path != null);
2069+ app_name = config["app_name"];
2070+ assert (app_name != null);
2071+ }
2072+
2073+ public static string get_config_dir_for_reading () {
2074+ assert (mode != RuntimeMode.UNDEFINED);
2075+ return readonly_dir ?? config_dir;
2076+ }
2077+
2078+ /* returns the path to a user configuration file whose contents should not be modified.
2079+ to get the path to save settings, use get_config_filename() */
2080+ public static string get_config_filename_for_reading (string filename) {
2081+ assert (mode != RuntimeMode.UNDEFINED);
2082+ return Path.build_path (Path.DIR_SEPARATOR_S,
2083+ readonly_dir ?? config_dir, filename);
2084+ }
2085+
2086+ /* returns the path to a user configuration file to which it is permitted to write.
2087+ this is also necessary for files whose state is synchronized to disk by a manager,
2088+ e.g. cookies. */
2089+ public static string get_config_filename_for_writing (string filename) {
2090+ assert (mode != RuntimeMode.UNDEFINED);
2091+ assert (config_dir != null);
2092+ mkdir_with_parents (config_dir);
2093+ return Path.build_path (Path.DIR_SEPARATOR_S, config_dir, filename);
2094+ }
2095+
2096+ #if !HAVE_WIN32
2097+ string? build_folder (string folder, string? middle, string filename) {
2098+ /* Fallback to build folder */
2099+ File? parent = File.new_for_path (exec_path);
2100+ while (parent != null) {
2101+ var data = parent.get_child (folder);
2102+ if (middle != null)
2103+ data = data.get_child (middle);
2104+ var child = data.get_child (filename);
2105+ if (child.query_exists ())
2106+ return child.get_path ();
2107+ parent = parent.get_parent ();
2108+ }
2109+ return null;
2110+ }
2111+ #endif
2112+
2113+ public static string get_res_filename (string filename) {
2114+ assert (exec_path != null);
2115+ assert (filename != "");
2116+ #if HAVE_WIN32
2117+ return Path.build_filename (exec_path, "share", PACKAGE_NAME, "res", filename);
2118+ #else
2119+ string path = Path.build_filename (exec_path, "share", PACKAGE_NAME, "res", filename);
2120+ if (Posix.access (path, Posix.F_OK) == 0)
2121+ return path;
2122+
2123+ return build_folder ("data", null, filename) ??
2124+ Path.build_filename (MDATADIR, PACKAGE_NAME, "res", filename);
2125+ #endif
2126+ }
2127+
2128+ public static string get_app_name () {
2129+ assert (mode != RuntimeMode.UNDEFINED);
2130+ assert (app_name != null);
2131+ return app_name;
2132+ }
2133+ }
2134+}
2135
2136=== renamed file 'midori/midori-database.vala' => 'ipc/midori-database.vala'
2137=== added file 'ipc/midori-tabproxy.vala'
2138--- ipc/midori-tabproxy.vala 1970-01-01 00:00:00 +0000
2139+++ ipc/midori-tabproxy.vala 2015-03-10 00:27:20 +0000
2140@@ -0,0 +1,29 @@
2141+/*
2142+ Copyright (C) 2015 Christian Dywan <christian@twotoasts.de>
2143+
2144+ This library is free software; you can redistribute it and/or
2145+ modify it under the terms of the GNU Lesser General Public
2146+ License as published by the Free Software Foundation; either
2147+ version 2.1 of the License, or (at your option) any later version.
2148+
2149+ See the file COPYING for the full license text.
2150+*/
2151+
2152+namespace Midori {
2153+ [DBus (name = "org.midori.Remote.tab")]
2154+ public interface TabProxy : Object {
2155+ public abstract uint64 id { get; }
2156+ public abstract string color { owned get; set; }
2157+ public async abstract uint64 add_action (Variant user_data) throws IOError;
2158+ public signal void action_added (uint64 id, Variant user_data);
2159+ public signal void action_activated (uint64 id, string name);
2160+ public async static TabProxy? get_by_id (uint64 page_id, Cancellable? cancellable=null) throws Error {
2161+ var app = new Application (Midori.Paths.get_app_name (), ApplicationFlags.IS_LAUNCHER);
2162+ app.register (cancellable);
2163+ var connection = app.get_dbus_connection ();
2164+ return yield connection.get_proxy<TabProxy> (app.get_application_id (),
2165+ "/org/midori/Remote/tab/" + page_id.to_string (), DBusProxyFlags.NONE, cancellable);
2166+ }
2167+ }
2168+}
2169+
2170
2171=== added file 'ipc/midori-webextension.vala'
2172--- ipc/midori-webextension.vala 1970-01-01 00:00:00 +0000
2173+++ ipc/midori-webextension.vala 2015-03-10 00:27:20 +0000
2174@@ -0,0 +1,40 @@
2175+/*
2176+ Copyright (C) 2015 Christian Dywan <christian@twotoats.de>
2177+
2178+ This library is free software; you can redistribute it and/or
2179+ modify it under the terms of the GNU Lesser General Public
2180+ License as published by the Free Software Foundation; either
2181+ version 2.1 of the License, or (at your option) any later version.
2182+
2183+ See the file COPYING for the full license text.
2184+*/
2185+
2186+namespace Midori {
2187+ /*
2188+ * The WebExtension is a base class for out-of-process extensions.
2189+ *
2190+ * Since: 0.6.0
2191+ */
2192+ public class WebExtension : Object {
2193+ protected string? token { get; set; default = null; }
2194+
2195+ /*
2196+ * The user data is used to initialize Midori.Paths.
2197+ */
2198+ public Variant user_data { set {
2199+ Midori.Paths.init_with_user_data (value);
2200+ } }
2201+
2202+ /*
2203+ * Debug messages will be printed if MIDORI_DEBUG contains @token.
2204+ */
2205+ protected void debug (string format, ...) {
2206+ return_if_fail (token != null);
2207+ if (!(token in (Environment.get_variable ("MIDORI_DEBUG") ?? "")))
2208+ return;
2209+
2210+ var args = va_list ();
2211+ stdout.vprintf (token + ": " + format + "\n", args);
2212+ }
2213+ }
2214+}
2215
2216=== removed file 'katze/gtk3-compat.c'
2217--- katze/gtk3-compat.c 2012-12-13 22:58:45 +0000
2218+++ katze/gtk3-compat.c 1970-01-01 00:00:00 +0000
2219@@ -1,119 +0,0 @@
2220-/*
2221- Copyright (C) 2011-2012 Christian Dywan <christian@twotoasts.de>
2222-
2223- This library is free software; you can redistribute it and/or
2224- modify it under the terms of the GNU Lesser General Public
2225- License as published by the Free Software Foundation; either
2226- version 2.1 of the License, or (at your option) any later version.
2227-
2228- See the file COPYING for the full license text.
2229-*/
2230-
2231-#include "katze/gtk3-compat.h"
2232-
2233-#if !GTK_CHECK_VERSION (3, 2, 0)
2234-static void
2235-sokoke_widget_set_pango_font_style (GtkWidget* widget,
2236- PangoStyle style)
2237-{
2238- /* Conveniently change the pango font style
2239- For some reason we need to reset if we actually want the normal style */
2240- if (style == PANGO_STYLE_NORMAL)
2241- gtk_widget_modify_font (widget, NULL);
2242- else
2243- {
2244- PangoFontDescription* font_description = pango_font_description_new ();
2245- pango_font_description_set_style (font_description, PANGO_STYLE_ITALIC);
2246- gtk_widget_modify_font (widget, font_description);
2247- pango_font_description_free (font_description);
2248- }
2249-}
2250-
2251-static gboolean
2252-sokoke_on_entry_focus_in_event (GtkEntry* entry,
2253- GdkEventFocus* event,
2254- gpointer userdata)
2255-{
2256- gint has_default = GPOINTER_TO_INT (
2257- g_object_get_data (G_OBJECT (entry), "sokoke_has_default"));
2258- if (has_default)
2259- {
2260- g_object_set_data (G_OBJECT (entry), "sokoke_has_default",
2261- GINT_TO_POINTER (0));
2262- gtk_entry_set_text (entry, "");
2263- sokoke_widget_set_pango_font_style (GTK_WIDGET (entry),
2264- PANGO_STYLE_NORMAL);
2265- }
2266- return FALSE;
2267-}
2268-
2269-static gboolean
2270-sokoke_on_entry_focus_out_event (GtkEntry* entry,
2271- GdkEventFocus* event,
2272- gpointer userdata)
2273-{
2274- const gchar* text = gtk_entry_get_text (entry);
2275- if (text && !*text)
2276- {
2277- const gchar* default_text = (const gchar*)g_object_get_data (
2278- G_OBJECT (entry), "sokoke_default_text");
2279- g_object_set_data (G_OBJECT (entry),
2280- "sokoke_has_default", GINT_TO_POINTER (1));
2281- gtk_entry_set_text (entry, default_text);
2282- sokoke_widget_set_pango_font_style (GTK_WIDGET (entry),
2283- PANGO_STYLE_ITALIC);
2284- }
2285- return FALSE;
2286-}
2287-
2288-static void
2289-sokoke_on_entry_drag_data_received (GtkEntry* entry,
2290- GdkDragContext* drag_context,
2291- gint x,
2292- gint y,
2293- guint timestamp,
2294- gpointer user_data)
2295-{
2296- sokoke_on_entry_focus_in_event (entry, NULL, NULL);
2297-}
2298-
2299-void
2300-gtk_entry_set_placeholder_text (GtkEntry* entry,
2301- const gchar* default_text)
2302-{
2303- /* Note: The default text initially overwrites any previous text */
2304- gchar* old_value = g_object_get_data (G_OBJECT (entry), "sokoke_default_text");
2305- g_object_set_data (G_OBJECT (entry), "sokoke_default_text", (gpointer)default_text);
2306-
2307- if (default_text == NULL)
2308- g_object_set_data (G_OBJECT (entry), "sokoke_has_default", GINT_TO_POINTER (0));
2309- else if (!old_value)
2310- {
2311- g_object_set_data (G_OBJECT (entry), "sokoke_has_default", GINT_TO_POINTER (1));
2312- sokoke_widget_set_pango_font_style (GTK_WIDGET (entry), PANGO_STYLE_ITALIC);
2313- gtk_entry_set_text (entry, default_text);
2314- g_signal_connect (entry, "drag-data-received",
2315- G_CALLBACK (sokoke_on_entry_drag_data_received), NULL);
2316- g_signal_connect (entry, "focus-in-event",
2317- G_CALLBACK (sokoke_on_entry_focus_in_event), NULL);
2318- g_signal_connect (entry, "focus-out-event",
2319- G_CALLBACK (sokoke_on_entry_focus_out_event), NULL);
2320- }
2321- else if (!gtk_widget_has_focus (GTK_WIDGET (entry)))
2322- {
2323- gint has_default = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (entry), "sokoke_has_default"));
2324- if (has_default)
2325- {
2326- gtk_entry_set_text (entry, default_text);
2327- sokoke_widget_set_pango_font_style (GTK_WIDGET (entry), PANGO_STYLE_ITALIC);
2328- }
2329- }
2330-}
2331-
2332-const gchar*
2333-gtk_entry_get_placeholder_text (GtkEntry* entry)
2334-{
2335- return g_object_get_data (G_OBJECT (entry), "sokoke_default_text");
2336-}
2337-#endif
2338-
2339
2340=== removed file 'katze/gtk3-compat.h'
2341--- katze/gtk3-compat.h 2013-06-26 21:54:50 +0000
2342+++ katze/gtk3-compat.h 1970-01-01 00:00:00 +0000
2343@@ -1,93 +0,0 @@
2344-/*
2345- Copyright (C) 2011-2012 Christian Dywan <christian@twotoasts.de>
2346-
2347- This library is free software; you can redistribute it and/or
2348- modify it under the terms of the GNU Lesser General Public
2349- License as published by the Free Software Foundation; either
2350- version 2.1 of the License, or (at your option) any later version.
2351-
2352- See the file COPYING for the full license text.
2353-*/
2354-
2355-#include <gtk/gtk.h>
2356-#include <gdk/gdkkeysyms.h>
2357-
2358-#ifndef H_GTK3_COMPAT_20110110
2359-#define H_GTK3_COMPAT_20110110
2360-
2361-G_BEGIN_DECLS
2362-
2363-#if GTK_CHECK_VERSION (3, 2, 0) && defined (GTK_DISABLE_DEPRECATED)
2364- #define GTK_TYPE_VBOX GTK_TYPE_BOX
2365- #define GtkVBox GtkBox
2366- #define GtkVBoxClass GtkBoxClass
2367- #define gtk_vbox_new(hmg,spc) g_object_new (GTK_TYPE_BOX, \
2368- "homogeneous", hmg, "spacing", spc, \
2369- "orientation", GTK_ORIENTATION_VERTICAL, NULL)
2370- #define GTK_TYPE_HBOX GTK_TYPE_BOX
2371- #define GtkHBox GtkBox
2372- #define GtkHBoxClass GtkBoxClass
2373- #define gtk_hbox_new(hmg,spc) g_object_new (GTK_TYPE_BOX, \
2374- "homogeneous", hmg, "spacing", spc, \
2375- "orientation", GTK_ORIENTATION_HORIZONTAL, NULL)
2376- #define gtk_hseparator_new() g_object_new (GTK_TYPE_SEPARATOR, NULL)
2377- #define gtk_hpaned_new() g_object_new (GTK_TYPE_PANED, NULL)
2378- #define gtk_vpaned_new() g_object_new (GTK_TYPE_PANED, \
2379- "orientation", GTK_ORIENTATION_VERTICAL, NULL)
2380- /* FIXME */
2381- #define gtk_widget_render_icon(wdgt, stk, sz, dtl) \
2382- gtk_widget_render_icon_pixbuf(wdgt, stk, sz)
2383- #define gtk_widget_size_request(wdgt, req) \
2384- gtk_widget_get_preferred_size(wdgt, req, NULL)
2385-#endif
2386-
2387-#if GTK_CHECK_VERSION (3, 0, 0)
2388- #define GTK_DIALOG_NO_SEPARATOR 0
2389-#endif
2390-
2391-#if !GTK_CHECK_VERSION (3, 2, 0)
2392- void gtk_entry_set_placeholder_text (GtkEntry* entry, const gchar* text);
2393- const gchar* gtk_entry_get_placeholder_text (GtkEntry* entry);
2394-#endif
2395-
2396-#ifndef GDK_KEY_Return
2397- #define GDK_KEY_0 GDK_0
2398- #define GDK_KEY_BackSpace GDK_BackSpace
2399- #define GDK_KEY_space GDK_space
2400- #define GDK_KEY_F5 GDK_F5
2401- #define GDK_KEY_KP_Equal GDK_KP_Equal
2402- #define GDK_KEY_KP_Enter GDK_KP_Enter
2403- #define GDK_KEY_KP_Left GDK_KP_Left
2404- #define GDK_KEY_KP_Right GDK_KP_Right
2405- #define GDK_KEY_KP_Delete GDK_KP_Delete
2406- #define GDK_KEY_KP_Down GDK_KP_Down
2407- #define GDK_KEY_KP_Up GDK_KP_Up
2408- #define GDK_KEY_KP_Divide GDK_KP_Divide
2409- #define GDK_KEY_Tab GDK_Tab
2410- #define GDK_KEY_ISO_Left_Tab GDK_ISO_Left_Tab
2411- #define GDK_KEY_equal GDK_equal
2412- #define GDK_KEY_ISO_Enter GDK_ISO_Enter
2413- #define GDK_KEY_Left GDK_Left
2414- #define GDK_KEY_Right GDK_Right
2415- #define GDK_KEY_Escape GDK_Escape
2416- #define GDK_KEY_Page_Up GDK_Page_Up
2417- #define GDK_KEY_Page_Down GDK_Page_Down
2418- #define GDK_KEY_Delete GDK_Delete
2419- #define GDK_KEY_Down GDK_Down
2420- #define GDK_KEY_Up GDK_Up
2421- #define GDK_KEY_B GDK_B
2422- #define GDK_KEY_H GDK_H
2423- #define GDK_KEY_J GDK_J
2424- #define GDK_KEY_Return GDK_Return
2425-#endif
2426-
2427-#ifdef GDK_WINDOWING_X11
2428- #include <gdk/gdkx.h>
2429- #ifndef GDK_IS_X11_DISPLAY
2430- #define GDK_IS_X11_DISPLAY(display) TRUE
2431- #endif
2432-#endif
2433-
2434-G_END_DECLS
2435-
2436-#endif
2437
2438=== modified file 'katze/katze-cellrenderercomboboxtext.c'
2439--- katze/katze-cellrenderercomboboxtext.c 2014-05-20 02:15:05 +0000
2440+++ katze/katze-cellrenderercomboboxtext.c 2015-03-10 00:27:20 +0000
2441@@ -39,16 +39,11 @@
2442 static void
2443 katze_cell_renderer_combobox_text_get_size (GtkCellRenderer* cell,
2444 GtkWidget* widget,
2445-#if GTK_CHECK_VERSION(3,0,0)
2446 const GdkRectangle* cell_area,
2447-#else
2448- GdkRectangle* cell_area,
2449-#endif
2450 gint* x_offset,
2451 gint* y_offset,
2452 gint* width,
2453 gint* height);
2454-#if GTK_CHECK_VERSION(3,0,0)
2455 static void
2456 katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,
2457 cairo_t* cr,
2458@@ -56,16 +51,6 @@
2459 const GdkRectangle *background_area,
2460 const GdkRectangle *cell_area,
2461 GtkCellRendererState flags);
2462-#else
2463-static void
2464-katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,
2465- GdkDrawable *window,
2466- GtkWidget *widget,
2467- GdkRectangle *background_area,
2468- GdkRectangle *cell_area,
2469- GdkRectangle *expose_area,
2470- GtkCellRendererState flags);
2471-#endif
2472
2473 enum {
2474 PROP_0,
2475@@ -425,11 +410,7 @@
2476 static void
2477 katze_cell_renderer_combobox_text_get_size (GtkCellRenderer *cell,
2478 GtkWidget *widget,
2479-#if GTK_CHECK_VERSION(3,0,0)
2480 const GdkRectangle* cell_area,
2481-#else
2482- GdkRectangle* cell_area,
2483-#endif
2484 gint *x_offset,
2485 gint *y_offset,
2486 gint *width,
2487@@ -450,22 +431,12 @@
2488 }
2489
2490 static void
2491-#if GTK_CHECK_VERSION(3,0,0)
2492 katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,
2493 cairo_t* cr,
2494 GtkWidget *widget,
2495 const GdkRectangle *background_area,
2496 const GdkRectangle *cell_area,
2497 GtkCellRendererState flags)
2498-#else
2499-katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,
2500- GdkDrawable *window,
2501- GtkWidget *widget,
2502- GdkRectangle *background_area,
2503- GdkRectangle *cell_area,
2504- GdkRectangle *expose_area,
2505- GtkCellRendererState flags)
2506-#endif
2507 {
2508 const gchar *text = NULL;
2509
2510@@ -473,22 +444,12 @@
2511
2512 set_text (KATZE_CELL_RENDERER_COMBOBOX_TEXT (cell), widget, text);
2513
2514-#if GTK_CHECK_VERSION(3,0,0)
2515 GTK_CELL_RENDERER_CLASS (katze_cell_renderer_combobox_text_parent_class)->render (cell,
2516 cr,
2517 widget,
2518 background_area,
2519 cell_area,
2520 flags);
2521-#else
2522- GTK_CELL_RENDERER_CLASS (katze_cell_renderer_combobox_text_parent_class)->render (cell,
2523- window,
2524- widget,
2525- background_area,
2526- cell_area,
2527- expose_area,
2528- flags);
2529-#endif
2530
2531 g_object_set (G_OBJECT (cell), "text", text, NULL);
2532 g_free ((gpointer)text);
2533
2534=== removed file 'katze/katze-http-auth.c'
2535--- katze/katze-http-auth.c 2013-08-12 19:21:06 +0000
2536+++ katze/katze-http-auth.c 1970-01-01 00:00:00 +0000
2537@@ -1,464 +0,0 @@
2538-/*
2539- Copyright (C) 2008-2009 Christian Dywan <christian@twotoasts.de>
2540-
2541- This library is free software; you can redistribute it and/or
2542- modify it under the terms of the GNU Lesser General Public
2543- License as published by the Free Software Foundation; either
2544- version 2.1 of the License, or (at your option) any later version.
2545-
2546- See the file COPYING for the full license text.
2547-*/
2548-
2549-#if HAVE_CONFIG_H
2550- #include <config.h>
2551-#endif
2552-
2553-#include "katze-http-auth.h"
2554-#include "gtk3-compat.h"
2555-
2556-#include <libsoup/soup.h>
2557-#include <gtk/gtk.h>
2558-#include <glib/gi18n.h>
2559-#include <glib/gstdio.h>
2560-
2561-struct _KatzeHttpAuth
2562-{
2563- GObject parent_instance;
2564- gchar* filename;
2565- GHashTable* logins;
2566-};
2567-
2568-struct _KatzeHttpAuthClass
2569-{
2570- GObjectClass parent_class;
2571-};
2572-
2573-typedef struct
2574-{
2575- KatzeHttpAuth* http_auth;
2576- SoupAuth* auth;
2577- gchar* username;
2578- gchar* password;
2579-} KatzeHttpAuthSave;
2580-
2581-typedef struct
2582-{
2583- gchar* username;
2584- gchar* password;
2585-} KatzeHttpAuthLogin;
2586-
2587-static void
2588-katze_http_auth_session_feature_iface_init (SoupSessionFeatureInterface *iface,
2589- gpointer data);
2590-
2591-G_DEFINE_TYPE_WITH_CODE (KatzeHttpAuth, katze_http_auth, G_TYPE_OBJECT,
2592- G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE,
2593- katze_http_auth_session_feature_iface_init));
2594-
2595-enum
2596-{
2597- PROP_0,
2598-
2599- PROP_FILENAME
2600-};
2601-
2602-static void
2603-katze_http_auth_set_property (GObject* object,
2604- guint prop_id,
2605- const GValue* value,
2606- GParamSpec* pspec);
2607-
2608-static void
2609-katze_http_auth_get_property (GObject* object,
2610- guint prop_id,
2611- GValue* value,
2612- GParamSpec* pspec);
2613-
2614-static void
2615-katze_http_auth_finalize (GObject* object);
2616-
2617-static gchar*
2618-katze_http_auth_soup_auth_get_hash (SoupAuth* auth)
2619-{
2620- return g_strdup_printf ("%s:%s:%s",
2621- soup_auth_get_host (auth),
2622- soup_auth_get_scheme_name (auth),
2623- soup_auth_get_realm (auth));
2624-}
2625-
2626-static void
2627-authentication_message_got_headers_cb (SoupMessage* msg,
2628- KatzeHttpAuthSave* save)
2629-{
2630- /* Anything but 401 and 5xx means the password was accepted */
2631- if (msg->status_code != 401 && msg->status_code < 500)
2632- {
2633- gchar* opaque_info;
2634- FILE* file;
2635-
2636- opaque_info = katze_http_auth_soup_auth_get_hash (save->auth);
2637-
2638- if (!g_hash_table_lookup (save->http_auth->logins, opaque_info))
2639- {
2640- KatzeHttpAuthLogin* login = g_slice_new (KatzeHttpAuthLogin);
2641- login->username = save->username;
2642- login->password = save->password;
2643- g_hash_table_insert (save->http_auth->logins, opaque_info, login);
2644-
2645- if ((file = g_fopen (save->http_auth->filename, "a")))
2646- {
2647- fprintf (file, "%s\t%s\t%s\n", opaque_info,
2648- login->username, login->password);
2649- fclose (file);
2650- g_chmod (save->http_auth->filename, 0600);
2651- }
2652- }
2653- else
2654- {
2655- /* FIXME g_free (save->username);
2656- g_free (save->password); */
2657- }
2658- }
2659- else
2660- {
2661- /* FIXME g_free (save->username);
2662- g_free (save->password); */
2663- }
2664-
2665- /* FIXME g_object_unref (save->auth); */
2666- /* FIXME g_slice_free (KatzeHttpAuthSave, save); */
2667- g_signal_handlers_disconnect_by_func (msg,
2668- authentication_message_got_headers_cb, save);
2669-}
2670-
2671-static void
2672-authentication_dialog_response_cb (GtkWidget* dialog,
2673- gint response,
2674- KatzeHttpAuthSave* save)
2675-{
2676- SoupSession* session;
2677- SoupMessage* msg;
2678-
2679- msg = g_object_get_data (G_OBJECT (dialog), "msg");
2680-
2681- if (response == GTK_RESPONSE_OK)
2682- {
2683- GtkEntry* username = g_object_get_data (G_OBJECT (dialog), "username");
2684- GtkEntry* password = g_object_get_data (G_OBJECT (dialog), "password");
2685- GtkToggleButton* remember = g_object_get_data (G_OBJECT (dialog), "remember");
2686-
2687- soup_auth_authenticate (save->auth,
2688- gtk_entry_get_text (username), gtk_entry_get_text (password));
2689-
2690- if (gtk_toggle_button_get_active (remember) && save->http_auth->filename)
2691- {
2692- save->username = g_strdup (gtk_entry_get_text (username));
2693- save->password = g_strdup (gtk_entry_get_text (password));
2694- g_signal_connect (msg, "got-headers",
2695- G_CALLBACK (authentication_message_got_headers_cb), save);
2696- }
2697- else
2698- {
2699- g_object_unref (save->auth);
2700- g_slice_free (KatzeHttpAuthSave, save);
2701- }
2702- }
2703-
2704- session = g_object_get_data (G_OBJECT (dialog), "session");
2705- if (g_object_get_data (G_OBJECT (msg), "paused"))
2706- soup_session_unpause_message (session, msg);
2707- gtk_widget_destroy (dialog);
2708- g_object_unref (msg);
2709-}
2710-
2711-static void
2712-katze_http_auth_session_authenticate_cb (SoupSession* session,
2713- SoupMessage* msg,
2714- SoupAuth* auth,
2715- gboolean retrying,
2716- KatzeHttpAuth* http_auth)
2717-{
2718- gchar* opaque_info;
2719- KatzeHttpAuthLogin* login;
2720- GtkWidget* dialog;
2721- GtkSizeGroup* sizegroup;
2722- GtkWidget* hbox;
2723- GtkWidget* image;
2724- GtkWidget* label;
2725- GtkWidget* align;
2726- GtkWidget* entry;
2727- KatzeHttpAuthSave* save;
2728-
2729- /* We want to ask for authentication exactly once, so we
2730- enforce this with a tag. There might be a better way. */
2731- if (!retrying && g_object_get_data (G_OBJECT (msg), "katze-session-tag"))
2732- return;
2733-
2734- if (1)
2735- {
2736- /* We use another tag to indicate whether a message is paused.
2737- There doesn't seem to be API in libSoup to find that out. */
2738- soup_session_pause_message (session, g_object_ref (msg));
2739- g_object_set_data (G_OBJECT (msg), "paused", (void*)1);
2740- }
2741- g_object_set_data (G_OBJECT (msg), "katze-session-tag", (void*)1);
2742-
2743- opaque_info = katze_http_auth_soup_auth_get_hash (auth);
2744- login = g_hash_table_lookup (http_auth->logins, opaque_info);
2745- g_free (opaque_info);
2746-
2747- dialog = gtk_dialog_new_with_buttons (_("Authentication Required"),
2748- NULL,
2749- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
2750- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
2751- GTK_STOCK_OK, GTK_RESPONSE_OK,
2752- NULL);
2753- gtk_window_set_icon_name (GTK_WINDOW (dialog),
2754- GTK_STOCK_DIALOG_AUTHENTICATION);
2755- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
2756- gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 5);
2757-
2758- gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 5);
2759- hbox = gtk_hbox_new (FALSE, 6);
2760- image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION,
2761- GTK_ICON_SIZE_DIALOG);
2762- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
2763- label = gtk_label_new (_("A username and a password are required\n"
2764- "to open this location:"));
2765- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
2766- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
2767- label = gtk_label_new (soup_auth_get_host (auth));
2768- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label, FALSE, TRUE, 0);
2769- /* If the realm is merely the host, omit the realm label */
2770- if (g_strcmp0 (soup_auth_get_host (auth), soup_auth_get_realm (auth)))
2771- {
2772- label = gtk_label_new (soup_auth_get_realm (auth));
2773- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label, FALSE, TRUE, 0);
2774- }
2775- sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
2776- hbox = gtk_hbox_new (FALSE, 6);
2777- label = gtk_label_new (_("Username"));
2778- align = gtk_alignment_new (0, 0.5, 0, 0);
2779- gtk_container_add (GTK_CONTAINER (align), label);
2780- gtk_size_group_add_widget (sizegroup, align);
2781- gtk_box_pack_start (GTK_BOX (hbox), align, TRUE, TRUE, 0);
2782- entry = gtk_entry_new ();
2783- if (login)
2784- gtk_entry_set_text (GTK_ENTRY (entry), login->username);
2785- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
2786- gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
2787- g_object_set_data (G_OBJECT (dialog), "username", entry);
2788- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
2789- hbox = gtk_hbox_new (FALSE, 6);
2790- label = gtk_label_new (_("Password"));
2791- align = gtk_alignment_new (0, 0.5, 0, 0);
2792- gtk_container_add (GTK_CONTAINER (align), label);
2793- gtk_size_group_add_widget (sizegroup, align);
2794- gtk_box_pack_start (GTK_BOX (hbox), align, TRUE, TRUE, 0);
2795- entry = gtk_entry_new ();
2796- if (login)
2797- gtk_entry_set_text (GTK_ENTRY (entry), login->password);
2798- gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
2799- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
2800- gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
2801- g_object_set_data (G_OBJECT (dialog), "password", entry);
2802- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
2803- hbox = gtk_hbox_new (FALSE, 6);
2804- label = gtk_check_button_new_with_mnemonic (_("_Remember password"));
2805- gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
2806- g_object_set_data (G_OBJECT (dialog), "remember", label);
2807- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label), (login != NULL));
2808- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
2809- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
2810- gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
2811-
2812- g_object_set_data (G_OBJECT (dialog), "session", session);
2813- g_object_set_data (G_OBJECT (dialog), "msg", msg);
2814-
2815- save = g_slice_new0 (KatzeHttpAuthSave);
2816- save->http_auth = http_auth;
2817- save->auth = g_object_ref (auth);
2818- g_signal_connect (dialog, "response",
2819- G_CALLBACK (authentication_dialog_response_cb), save);
2820- gtk_widget_show (dialog);
2821-}
2822-
2823-static void
2824-katze_http_auth_session_request_queued_cb (SoupSession* session,
2825- SoupMessage* msg,
2826- KatzeHttpAuth* http_auth)
2827-{
2828- /* WebKit has its own authentication dialog in recent versions.
2829- We want only one, and we choose our own to have localization. */
2830- GType type = g_type_from_name ("WebKitSoupAuthDialog");
2831- if (type)
2832- soup_session_remove_feature_by_type (session, type);
2833-
2834- g_signal_connect (session, "authenticate",
2835- G_CALLBACK (katze_http_auth_session_authenticate_cb), http_auth);
2836- g_signal_handlers_disconnect_by_func (session,
2837- katze_http_auth_session_request_queued_cb, http_auth);
2838-}
2839-
2840-static void
2841-katze_http_auth_attach (SoupSessionFeature* feature,
2842- SoupSession* session)
2843-{
2844- g_signal_connect (session, "request-queued",
2845- G_CALLBACK (katze_http_auth_session_request_queued_cb), feature);
2846-}
2847-
2848-static void
2849-katze_http_auth_detach (SoupSessionFeature* feature,
2850- SoupSession* session)
2851-{
2852- g_signal_handlers_disconnect_by_func (session,
2853- katze_http_auth_session_authenticate_cb, NULL);
2854- g_signal_handlers_disconnect_by_func (session,
2855- katze_http_auth_session_request_queued_cb, NULL);
2856-}
2857-
2858-static void
2859-katze_http_auth_session_feature_iface_init (SoupSessionFeatureInterface *iface,
2860- gpointer data)
2861-{
2862- iface->attach = katze_http_auth_attach;
2863- iface->detach = katze_http_auth_detach;
2864-}
2865-
2866-static void
2867-katze_http_auth_class_init (KatzeHttpAuthClass* class)
2868-{
2869- GObjectClass* gobject_class;
2870- GParamFlags flags;
2871-
2872- gobject_class = G_OBJECT_CLASS (class);
2873- gobject_class->finalize = katze_http_auth_finalize;
2874- gobject_class->set_property = katze_http_auth_set_property;
2875- gobject_class->get_property = katze_http_auth_get_property;
2876-
2877- flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
2878-
2879- /**
2880- * KatzeHttpAuth:filename:
2881- *
2882- * An absolute path and name of a file for storing logins.
2883- *
2884- * Since: 0.1.10
2885- */
2886- g_object_class_install_property (gobject_class,
2887- PROP_FILENAME,
2888- g_param_spec_string (
2889- "filename",
2890- "Filename",
2891- "An absolute path and name of a file for storing logins",
2892- NULL,
2893- flags));
2894-}
2895-
2896-static void
2897-katze_http_auth_login_free (KatzeHttpAuthLogin* login)
2898-{
2899- g_free (login->username);
2900- g_free (login->password);
2901- g_slice_free (KatzeHttpAuthLogin, login);
2902-}
2903-
2904-static void
2905-katze_http_auth_set_filename (KatzeHttpAuth* http_auth,
2906- const gchar* filename)
2907-{
2908- FILE* file;
2909-
2910- katze_assign (http_auth->filename, g_strdup (filename));
2911-
2912- g_hash_table_remove_all (http_auth->logins);
2913-
2914- if ((file = g_fopen (filename, "r")))
2915- {
2916- gchar line[255];
2917- guint number = 0;
2918-
2919- while (fgets (line, 255, file))
2920- {
2921- gchar** parts = g_strsplit (line, "\t", 3);
2922- if (parts && parts[0] && parts[1] && parts[2])
2923- {
2924- gint length = strlen (parts[2]);
2925- KatzeHttpAuthLogin* login = g_slice_new (KatzeHttpAuthLogin);
2926- login->username = parts[1];
2927- if (parts[2][length - 1] == '\n')
2928- length--;
2929- login->password = g_strndup (parts[2], length);
2930- g_hash_table_insert (http_auth->logins, parts[0], login);
2931- g_free (parts);
2932- }
2933- else
2934- {
2935- g_strfreev (parts);
2936- g_warning ("Error in line %d in HTTP Auth file", number);
2937- }
2938- number++;
2939- }
2940- fclose (file);
2941- }
2942-}
2943-
2944-static void
2945-katze_http_auth_init (KatzeHttpAuth* http_auth)
2946-{
2947- http_auth->filename = NULL;
2948-
2949- http_auth->logins = g_hash_table_new_full (g_str_hash, g_str_equal,
2950- (GDestroyNotify)g_free, (GDestroyNotify)katze_http_auth_login_free);
2951-}
2952-
2953-static void
2954-katze_http_auth_finalize (GObject* object)
2955-{
2956- KatzeHttpAuth* http_auth = KATZE_HTTP_AUTH (object);
2957-
2958- g_free (http_auth->filename);
2959-
2960- g_hash_table_unref (http_auth->logins);
2961-
2962- G_OBJECT_CLASS (katze_http_auth_parent_class)->finalize (object);
2963-}
2964-
2965-static void
2966-katze_http_auth_set_property (GObject* object,
2967- guint prop_id,
2968- const GValue* value,
2969- GParamSpec* pspec)
2970-{
2971- KatzeHttpAuth* http_auth = KATZE_HTTP_AUTH (object);
2972-
2973- switch (prop_id)
2974- {
2975- case PROP_FILENAME:
2976- katze_http_auth_set_filename (http_auth, g_value_get_string (value));
2977- break;
2978- default:
2979- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
2980- break;
2981- }
2982-}
2983-
2984-static void
2985-katze_http_auth_get_property (GObject* object,
2986- guint prop_id,
2987- GValue* value,
2988- GParamSpec* pspec)
2989-{
2990- KatzeHttpAuth* http_auth = KATZE_HTTP_AUTH (object);
2991-
2992- switch (prop_id)
2993- {
2994- case PROP_FILENAME:
2995- g_value_set_string (value, http_auth->filename);
2996- break;
2997- default:
2998- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
2999- break;
3000- }
3001-}
3002
3003=== removed file 'katze/katze-http-auth.h'
3004--- katze/katze-http-auth.h 2010-01-17 17:14:48 +0000
3005+++ katze/katze-http-auth.h 1970-01-01 00:00:00 +0000
3006@@ -1,42 +0,0 @@
3007-/*
3008- Copyright (C) 2009 Christian Dywan <christian@twotoasts.de>
3009-
3010- This library is free software; you can redistribute it and/or
3011- modify it under the terms of the GNU Lesser General Public
3012- License as published by the Free Software Foundation; either
3013- version 2.1 of the License, or (at your option) any later version.
3014-
3015- See the file COPYING for the full license text.
3016-*/
3017-
3018-#ifndef __KATZE_HTTP_AUTH_H__
3019-#define __KATZE_HTTP_AUTH_H__
3020-
3021-#include "katze-utils.h"
3022-
3023-#include <glib-object.h>
3024-
3025-G_BEGIN_DECLS
3026-
3027-#define KATZE_TYPE_HTTP_AUTH \
3028- (katze_http_auth_get_type ())
3029-#define KATZE_HTTP_AUTH(obj) \
3030- (G_TYPE_CHECK_INSTANCE_CAST ((obj), KATZE_TYPE_HTTP_AUTH, KatzeHttpAuth))
3031-#define KATZE_HTTP_AUTH_CLASS(klass) \
3032- (G_TYPE_CHECK_CLASS_CAST ((klass), KATZE_TYPE_HTTP_AUTH, KatzeHttpAuthClass))
3033-#define KATZE_IS_HTTP_AUTH(obj) \
3034- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KATZE_TYPE_HTTP_AUTH))
3035-#define KATZE_IS_HTTP_AUTH_CLASS(klass) \
3036- (G_TYPE_CHECK_CLASS_TYPE ((klass), KATZE_TYPE_HTTP_AUTH))
3037-#define KATZE_HTTP_AUTH_GET_CLASS(obj) \
3038- (G_TYPE_INSTANCE_GET_CLASS ((obj), KATZE_TYPE_HTTP_AUTH, KatzeHttpAuthClass))
3039-
3040-typedef struct _KatzeHttpAuth KatzeHttpAuth;
3041-typedef struct _KatzeHttpAuthClass KatzeHttpAuthClass;
3042-
3043-GType
3044-katze_http_auth_get_type (void) G_GNUC_CONST;
3045-
3046-G_END_DECLS
3047-
3048-#endif /* __KATZE_HTTP_AUTH_H__ */
3049
3050=== modified file 'katze/katze-preferences.c'
3051--- katze/katze-preferences.c 2014-05-20 02:15:05 +0000
3052+++ katze/katze-preferences.c 2015-03-10 00:27:20 +0000
3053@@ -67,9 +67,6 @@
3054 g_object_set (preferences,
3055 "icon-name", GTK_STOCK_PREFERENCES,
3056 "title", dialog_title,
3057-#if !GTK_CHECK_VERSION (3, 0, 0)
3058- "has-separator", FALSE,
3059-#endif
3060 NULL);
3061 g_free (dialog_title);
3062
3063@@ -144,7 +141,7 @@
3064 {
3065 KatzePreferencesPrivate* priv = preferences->priv;
3066
3067- #if GTK_CHECK_VERSION (3, 10, 0) && !HAVE_OSX
3068+ #if !HAVE_OSX
3069 priv->notebook = gtk_stack_new ();
3070 #else
3071 priv->notebook = gtk_notebook_new ();
3072@@ -160,7 +157,7 @@
3073 gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),
3074 priv->toolbar, FALSE, FALSE, 0);
3075 #else
3076- #if GTK_CHECK_VERSION (3, 10, 0) && !HAVE_OSX
3077+ #if !HAVE_OSX
3078 priv->toolbar = gtk_stack_switcher_new ();
3079 gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (priv->toolbar), GTK_STACK (priv->notebook));
3080 gtk_widget_set_halign (priv->toolbar, GTK_ALIGN_CENTER);
3081@@ -200,7 +197,7 @@
3082 gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (preferences)));
3083 }
3084
3085-#if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX
3086+#if !HAVE_OSX
3087 /* these functions are used to clear the 100-px width set in GTK3's
3088 update_button function in gtk/gtkstackswitcher.c */
3089
3090@@ -252,7 +249,7 @@
3091 priv->sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
3092 gtk_widget_show (priv->page);
3093 gtk_container_set_border_width (GTK_CONTAINER (priv->page), 4);
3094- #if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX
3095+ #if !HAVE_OSX
3096 gtk_stack_add_titled (GTK_STACK (priv->notebook),
3097 priv->page, label, label);
3098 workaround_stack_switcher_sizing (GTK_STACK_SWITCHER (priv->toolbar));
3099
3100=== modified file 'katze/katze-utils.c'
3101--- katze/katze-utils.c 2014-05-20 02:15:05 +0000
3102+++ katze/katze-utils.c 2015-03-10 00:27:20 +0000
3103@@ -9,8 +9,6 @@
3104 See the file COPYING for the full license text.
3105 */
3106
3107-#include "gtk3-compat.h"
3108-
3109 #include "katze-utils.h"
3110 #include "katze-array.h"
3111 #include "midori-core.h"
3112@@ -70,7 +68,6 @@
3113 g_object_set (object, property, file, NULL);
3114 }
3115
3116-#if GTK_CHECK_VERSION (3, 2, 0)
3117 static void
3118 proxy_font_chooser_font_activated_cb (GtkFontChooser* chooser,
3119 GObject* object)
3120@@ -89,17 +86,6 @@
3121 gboolean monospace = GPOINTER_TO_INT (data);
3122 return monospace == pango_font_family_is_monospace (family);
3123 }
3124-#else
3125-static void
3126-proxy_combo_box_text_changed_cb (GtkComboBoxText* button,
3127- GObject* object)
3128-{
3129- gchar* text = gtk_combo_box_text_get_active_text (button);
3130- const gchar* property = g_object_get_data (G_OBJECT (button), "property");
3131- g_object_set (object, property, text, NULL);
3132- g_free (text);
3133-}
3134-#endif
3135
3136 static gboolean
3137 proxy_entry_focus_out_event_cb (GtkEntry* entry,
3138@@ -423,7 +409,6 @@
3139 katze_assign (string, g_strdup ("sans"));
3140 gboolean monospace = _hint == I_("font-monospace");
3141
3142- #if GTK_CHECK_VERSION (3, 2, 0)
3143 widget = gtk_font_button_new ();
3144 gtk_font_button_set_show_size (GTK_FONT_BUTTON (widget), FALSE);
3145 gtk_font_chooser_set_font (GTK_FONT_CHOOSER (widget), string);
3146@@ -432,36 +417,6 @@
3147 G_CALLBACK (proxy_font_chooser_font_activated_cb), object);
3148 gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (widget),
3149 (GtkFontFilterFunc)proxy_font_chooser_filter_monospace_cb, GINT_TO_POINTER (monospace), NULL);
3150- #else
3151- GtkComboBox* combo;
3152- gint n_families, i;
3153- PangoContext* context;
3154- PangoFontFamily** families;
3155-
3156- widget = gtk_combo_box_text_new ();
3157- combo = GTK_COMBO_BOX (widget);
3158- context = gtk_widget_get_pango_context (widget);
3159- pango_context_list_families (context, &families, &n_families);
3160- if (string)
3161- {
3162- gint j = 0;
3163- for (i = 0; i < n_families; i++)
3164- {
3165- if (monospace != pango_font_family_is_monospace (families[i]))
3166- continue;
3167- const gchar* font = pango_font_family_get_name (families[i]);
3168- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), font);
3169- if (!g_ascii_strcasecmp (font, string))
3170- gtk_combo_box_set_active (combo, j);
3171- j++;
3172- }
3173- }
3174- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (
3175- gtk_combo_box_get_model (combo)), 0, GTK_SORT_ASCENDING);
3176- g_signal_connect (widget, "changed",
3177- G_CALLBACK (proxy_combo_box_text_changed_cb), object);
3178- g_free (families);
3179- #endif
3180 }
3181 else if (type == G_TYPE_PARAM_STRING)
3182 {
3183@@ -656,23 +611,13 @@
3184 if (!window)
3185 return;
3186
3187- #if !GTK_CHECK_VERSION (3, 0, 0)
3188- if (GTK_IS_ENTRY (widget))
3189- window = gdk_window_get_parent (window);
3190- #endif
3191-
3192 /* Retrieve size and position of both widget and menu */
3193 gtk_widget_get_allocation (widget, &allocation);
3194 gdk_window_get_origin (window, &wx, &wy);
3195 wx += allocation.x;
3196 wy += allocation.y;
3197- #if GTK_CHECK_VERSION (3, 0, 0)
3198 gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL);
3199 gtk_widget_get_preferred_size (widget, &widget_req, NULL);
3200- #else
3201- gtk_widget_size_request (GTK_WIDGET (menu), &menu_req);
3202- gtk_widget_size_request (widget, &widget_req);
3203- #endif
3204 menu_width = menu_req.width;
3205 widget_height = widget_req.height; /* Better than allocation.height */
3206
3207@@ -1037,31 +982,13 @@
3208 if (!valid)
3209 valid = midori_uri_is_ip_address (uri);
3210
3211- #if GTK_CHECK_VERSION (3, 2, 0)
3212 g_object_set_data (G_OBJECT (entry), "invalid", GINT_TO_POINTER (uri && *uri && !valid));
3213 gtk_widget_queue_draw (entry);
3214- #else
3215- if (uri && *uri && !valid)
3216- {
3217- GdkColor bg_color = { 0 };
3218- GdkColor fg_color = { 0 };
3219- gdk_color_parse ("#ef7070", &bg_color);
3220- gdk_color_parse ("#000", &fg_color);
3221- gtk_widget_modify_base (entry, GTK_STATE_NORMAL, &bg_color);
3222- gtk_widget_modify_text (entry, GTK_STATE_NORMAL, &fg_color);
3223- }
3224- else
3225- {
3226- gtk_widget_modify_base (entry, GTK_STATE_NORMAL, NULL);
3227- gtk_widget_modify_text (entry, GTK_STATE_NORMAL, NULL);
3228- }
3229- #endif
3230
3231 if (other_widget != NULL)
3232 gtk_widget_set_sensitive (other_widget, valid);
3233 }
3234
3235-#if GTK_CHECK_VERSION (3, 2, 0)
3236 static gboolean
3237 katze_uri_entry_draw_cb (GtkWidget* entry,
3238 cairo_t* cr,
3239@@ -1081,7 +1008,6 @@
3240 width * 0.75, height / 1.9 / 2);
3241 return TRUE;
3242 }
3243-#endif
3244
3245 /**
3246 * katze_uri_entry_new:
3247@@ -1100,18 +1026,14 @@
3248 katze_uri_entry_new (GtkWidget* other_widget)
3249 {
3250 GtkWidget* entry = gtk_entry_new ();
3251- #if GTK_CHECK_VERSION (3, 6, 0)
3252 gtk_entry_set_input_purpose (GTK_ENTRY (entry), GTK_INPUT_PURPOSE_URL);
3253- #endif
3254
3255 gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY,
3256 g_themed_icon_new_with_default_fallbacks ("text-html-symbolic"));
3257 g_signal_connect (entry, "changed",
3258 G_CALLBACK (katze_uri_entry_changed_cb), other_widget);
3259- #if GTK_CHECK_VERSION (3, 2, 0)
3260 g_signal_connect_after (entry, "draw",
3261 G_CALLBACK (katze_uri_entry_draw_cb), other_widget);
3262- #endif
3263 return entry;
3264 }
3265
3266@@ -1119,10 +1041,8 @@
3267 katze_widget_add_class (GtkWidget* widget,
3268 const gchar* class_name)
3269 {
3270- #if GTK_CHECK_VERSION (3,0,0)
3271 GtkStyleContext* context = gtk_widget_get_style_context (widget);
3272 gtk_style_context_add_class (context, class_name);
3273- #endif
3274 }
3275
3276 /**
3277
3278=== modified file 'katze/katze-utils.h'
3279--- katze/katze-utils.h 2013-04-16 22:10:56 +0000
3280+++ katze/katze-utils.h 2015-03-10 00:27:20 +0000
3281@@ -15,7 +15,6 @@
3282
3283 #include <gtk/gtk.h>
3284 #include "katze-array.h"
3285-#include "gtk3-compat.h"
3286
3287 G_BEGIN_DECLS
3288
3289
3290=== modified file 'katze/katze.h'
3291--- katze/katze.h 2013-10-22 22:38:26 +0000
3292+++ katze/katze.h 2015-03-10 00:27:20 +0000
3293@@ -12,17 +12,12 @@
3294 #ifndef __KATZE_H__
3295 #define __KATZE_H__
3296
3297-#include "katze-http-auth.h"
3298 #include "katze-utils.h"
3299 #include "katze-item.h"
3300 #include "katze-array.h"
3301 #include "katze-arrayaction.h"
3302 #include "katze-preferences.h"
3303
3304-#ifndef HAVE_WEBKIT2
3305- #include <webkit/webkit.h>
3306-#else
3307 #include <webkit2/webkit2.h>
3308-#endif
3309
3310 #endif /* __KATZE_H__ */
3311
3312=== removed file 'katze/midori-hsts.vala'
3313--- katze/midori-hsts.vala 2012-11-18 20:24:32 +0000
3314+++ katze/midori-hsts.vala 1970-01-01 00:00:00 +0000
3315@@ -1,145 +0,0 @@
3316-/*
3317- Copyright (C) 2012 Christian Dywan <christian@twotoasts.de>
3318-
3319- This library is free software; you can redistribute it and/or
3320- modify it under the terms of the GNU Lesser General Public
3321- License as published by the Free Software Foundation; either
3322- version 2.1 of the License, or (at your option) any later version.
3323-
3324- See the file COPYING for the full license text.
3325-*/
3326-
3327-namespace Midori {
3328- public class HSTS : GLib.Object, Soup.SessionFeature {
3329- public class Directive {
3330- public Soup.Date? expires = null;
3331- public bool sub_domains = false;
3332-
3333- public Directive (bool include_sub_domains) {
3334- expires = new Soup.Date.from_now (int.MAX);
3335- sub_domains = include_sub_domains;
3336- }
3337-
3338- public Directive.from_header (string header) {
3339- var param_list = Soup.header_parse_param_list (header);
3340- if (param_list == null)
3341- return;
3342-
3343- string? max_age = param_list.lookup ("max-age");
3344- if (max_age != null)
3345- expires = new Soup.Date.from_now (max_age.to_int ());
3346- // if (param_list.lookup_extended ("includeSubDomains", null, null))
3347- if ("includeSubDomains" in header)
3348- sub_domains = true;
3349- Soup.header_free_param_list (param_list);
3350- }
3351-
3352- public bool is_valid () {
3353- return expires != null && !expires.is_past ();
3354- }
3355- }
3356-
3357- HashTable<string, Directive> whitelist;
3358- bool debug = false;
3359-
3360- public HSTS () {
3361- whitelist = new HashTable<string, Directive> (str_hash, str_equal);
3362- read_cache.begin (File.new_for_path (Paths.get_preset_filename (null, "hsts")));
3363- read_cache.begin (File.new_for_path (Paths.get_config_filename_for_reading ("hsts")));
3364- if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "hsts") == 0)
3365- debug = true;
3366- }
3367-
3368- async void read_cache (File file) {
3369- try {
3370- var stream = new DataInputStream (yield file.read_async ());
3371- do {
3372- string? line = yield stream.read_line_async ();
3373- if (line == null)
3374- break;
3375- string[] parts = line.split (" ", 2);
3376- if (parts[0] == null || parts[1] == null)
3377- break;
3378- var directive = new Directive.from_header (parts[1]);
3379- if (directive.is_valid ())
3380- append_to_whitelist (parts[0], directive);
3381- } while (true);
3382- }
3383- catch (Error error) { }
3384- }
3385-
3386-#if HAVE_LIBSOUP_2_34_0
3387- /* No sub-features */
3388- public bool add_feature (Type type) { return false; }
3389- public bool remove_feature (Type type) { return false; }
3390- public bool has_feature (Type type) { return false; }
3391-#endif
3392-
3393- public void attach (Soup.Session session) { session.request_queued.connect (queued); }
3394- public void detach (Soup.Session session) { /* FIXME disconnect */ }
3395-
3396- /* Never called but required by the interface */
3397- public void request_started (Soup.Session session, Soup.Message msg, Soup.Socket socket) { }
3398- public void request_queued (Soup.Session session, Soup.Message message) { }
3399- public void request_unqueued (Soup.Session session, Soup.Message msg) { }
3400-
3401- bool should_secure_host (string host) {
3402- Directive? directive = whitelist.lookup (host);
3403- if (directive == null)
3404- directive = whitelist.lookup ("*." + host);
3405- return directive != null && directive.is_valid ();
3406- }
3407-
3408- void queued (Soup.Session session, Soup.Message message) {
3409- if (should_secure_host (message.uri.host)) {
3410- message.uri.set_scheme ("https");
3411- session.requeue_message (message);
3412- if (debug)
3413- stdout.printf ("HSTS: Enforce %s\n", message.uri.host);
3414- }
3415- else if (message.uri.scheme == "http")
3416- message.finished.connect (strict_transport_security_handled);
3417- }
3418-
3419- void append_to_whitelist (string host, Directive directive) {
3420- whitelist.insert (host, directive);
3421- if (directive.sub_domains)
3422- whitelist.insert ("*." + host, directive);
3423- }
3424-
3425- async void append_to_cache (string host, string header) {
3426- if (Midori.Paths.is_readonly ())
3427- return;
3428-
3429- string filename = Paths.get_config_filename_for_writing ("hsts");
3430- try {
3431- var file = File.new_for_path (filename);
3432- var stream = file.append_to/* FIXME _async*/ (FileCreateFlags.NONE);
3433- yield stream.write_async ((host + " " + header + "\n").data);
3434- yield stream.flush_async ();
3435- }
3436- catch (Error error) {
3437- critical ("Failed to update %s: %s", filename, error.message);
3438- }
3439- }
3440-
3441- void strict_transport_security_handled (Soup.Message message) {
3442- if (message == null || message.uri == null)
3443- return;
3444-
3445- unowned string? hsts = message.response_headers.get_one ("Strict-Transport-Security");
3446- if (hsts == null)
3447- return;
3448-
3449- var directive = new Directive.from_header (hsts);
3450- if (directive.is_valid ()) {
3451- append_to_whitelist (message.uri.host, directive);
3452- append_to_cache.begin (message.uri.host, hsts);
3453- }
3454- if (debug)
3455- stdout.printf ("HSTS: '%s' sets '%s' valid? %s\n",
3456- message.uri.host, hsts, directive.is_valid ().to_string ());
3457- }
3458-
3459- }
3460-}
3461
3462=== modified file 'katze/midori-paths.vala'
3463--- katze/midori-paths.vala 2014-04-03 00:49:01 +0000
3464+++ katze/midori-paths.vala 2015-03-10 00:27:20 +0000
3465@@ -16,30 +16,16 @@
3466 }
3467
3468 extern const string LIBDIR;
3469-extern const string MDATADIR;
3470-extern const string PACKAGE_NAME;
3471 extern const string SYSCONFDIR;
3472 extern const string MIDORI_VERSION_SUFFIX;
3473 const string MODULE_PREFIX = "lib";
3474 const string MODULE_SUFFIX = "." + GLib.Module.SUFFIX;
3475
3476 namespace Midori {
3477- public enum RuntimeMode {
3478- UNDEFINED,
3479- NORMAL,
3480- APP,
3481- PRIVATE,
3482- PORTABLE
3483- }
3484-
3485 namespace Paths {
3486- static string? exec_path = null;
3487 static string[] command_line = null;
3488 static string? runtime_dir = null;
3489- static RuntimeMode mode = RuntimeMode.UNDEFINED;
3490
3491- static string? config_dir = null;
3492- static string? readonly_dir = null;
3493 static string? cache_dir = null;
3494 static string? cache_dir_for_reading = null;
3495 static string? user_data_dir = null;
3496@@ -52,19 +38,6 @@
3497 }
3498 }
3499
3500- public static string get_config_dir_for_reading () {
3501- assert (mode != RuntimeMode.UNDEFINED);
3502- return readonly_dir ?? config_dir;
3503- }
3504-
3505- /* returns the path to a user configuration file whose contents should not be modified.
3506- to get the path to save settings, use get_config_filename() */
3507- public static string get_config_filename_for_reading (string filename) {
3508- assert (mode != RuntimeMode.UNDEFINED);
3509- return Path.build_path (Path.DIR_SEPARATOR_S,
3510- readonly_dir ?? config_dir, filename);
3511- }
3512-
3513 public bool is_readonly () {
3514 assert (mode != RuntimeMode.UNDEFINED);
3515 return readonly_dir != null;
3516@@ -99,6 +72,7 @@
3517
3518 public static void init (RuntimeMode new_mode, string? config) {
3519 assert (mode == RuntimeMode.UNDEFINED);
3520+ assert (exec_path != null);
3521 assert (new_mode != RuntimeMode.UNDEFINED);
3522 mode = new_mode;
3523 if (mode == RuntimeMode.PORTABLE || mode == RuntimeMode.PRIVATE)
3524@@ -133,11 +107,9 @@
3525 tmp_dir = get_runtime_dir ();
3526 }
3527 else {
3528-#if HAVE_WEBKIT2_3_91
3529 /* Allow WebKit to spawn more than one rendering process */
3530 if (!("wk2:no-multi-render-process" in (Environment.get_variable ("MIDORI_DEBUG") ?? "")))
3531 WebKit.WebContext.get_default ().set_process_model (WebKit.ProcessModel.MULTIPLE_SECONDARY_PROCESSES);
3532-#endif
3533 string? real_config = config != null && !Path.is_absolute (config)
3534 ? Path.build_filename (Environment.get_current_dir (), config) : config;
3535 config_dir = real_config ?? Path.build_path (Path.DIR_SEPARATOR_S,
3536@@ -147,11 +119,15 @@
3537 user_data_dir = Environment.get_user_data_dir ();
3538 tmp_dir = get_runtime_dir ();
3539 }
3540-#if HAVE_WEBKIT2
3541+
3542+ /* Cache and extension dir MUST be set no later than here to work */
3543+ WebKit.WebContext.get_default ().set_web_extensions_directory (
3544+ get_lib_path (PACKAGE_NAME));
3545+ WebKit.WebContext.get_default ().initialize_web_extensions.connect (() => {
3546+ app_name = Application.get_default ().get_application_id ();
3547+ WebKit.WebContext.get_default ().set_web_extensions_initialization_user_data (user_data_for_config ());
3548+ });
3549 if (cache_dir != null) {
3550- /* Cache and extension dir MUST be set no later than here to work */
3551- WebKit.WebContext.get_default ().set_web_extensions_directory (
3552- Path.build_path (Path.DIR_SEPARATOR_S, cache_dir, "wk2ext"));
3553 WebKit.WebContext.get_default ().set_disk_cache_directory (
3554 Path.build_path (Path.DIR_SEPARATOR_S, cache_dir, "web"));
3555 }
3556@@ -161,27 +137,19 @@
3557 cookie_manager.set_persistent_storage (Path.build_filename (config_dir, "cookies.db"),
3558 WebKit.CookiePersistentStorage.SQLITE);
3559 }
3560-#endif
3561 if (user_data_dir != null) {
3562 string folder = Path.build_filename (user_data_dir, "webkit", "icondatabase");
3563-#if HAVE_WEBKIT2
3564 WebKit.WebContext.get_default ().set_favicon_database_directory (folder);
3565-#else
3566- WebKit.get_favicon_database ().set_path (folder);
3567-#endif
3568 }
3569 else
3570 {
3571-#if HAVE_WEBKIT2
3572 /* with wk2 set_favicon_database_directory can only be called once and actually
3573 initializes and enables the favicon database, so we do not call it in this case */
3574-#else
3575- /* wk1 documentation claims that the favicon database is not enabled unless
3576- a call to favicon_database.set_path is made, but in fact it must be explicitly
3577- disabled by setting to null (verified as of webkitgtk 2.3.1) */
3578- WebKit.get_favicon_database ().set_path (null);
3579-#endif
3580 }
3581+ if (("wk2:ignore-tls" in (Environment.get_variable ("MIDORI_DEBUG") ?? "")))
3582+ WebKit.WebContext.get_default ().set_tls_errors_policy (WebKit.TLSErrorsPolicy.IGNORE);
3583+ else
3584+ WebKit.WebContext.get_default ().set_tls_errors_policy (WebKit.TLSErrorsPolicy.FAIL);
3585
3586 if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "paths") == 0) {
3587 stdout.printf ("config: %s\ncache: %s\nuser_data: %s\ntmp: %s\n",
3588@@ -189,26 +157,15 @@
3589 }
3590 }
3591
3592- public static void mkdir_with_parents (string path, int mode = 0700) {
3593- /* Use g_access instead of g_file_test for better performance */
3594- if (Posix.access (path, Posix.F_OK) == 0)
3595- return;
3596- int i = path.index_of_char (Path.DIR_SEPARATOR, 0);
3597- do {
3598- string fn = path.substring (i, -1);
3599- if (Posix.access (fn, Posix.F_OK) != 0) {
3600- if (DirUtils.create (fn, mode) == -1) {
3601- /* Slow fallback; if this fails we fail */
3602- DirUtils.create_with_parents (path, mode);
3603- return;
3604- }
3605- }
3606- else if (!FileUtils.test (fn, FileTest.IS_SYMLINK))
3607- return; /* Failed */
3608-
3609- i = path.index_of_char (Path.DIR_SEPARATOR, i);
3610- }
3611- while (i != -1);
3612+ static Variant user_data_for_config () {
3613+ assert (mode != RuntimeMode.UNDEFINED);
3614+ HashTable<string, string?> config = new HashTable<string, string> (str_hash, str_equal);
3615+ config.insert ("mode", "%d".printf ((int)mode));
3616+ config.insert ("readonly_dir", get_config_dir_for_reading ());
3617+ config.insert ("config_dir", get_config_dir_for_reading ());
3618+ config.insert ("exec_path", exec_path);
3619+ config.insert ("app_name", get_app_name ());
3620+ return config;
3621 }
3622
3623 public static void remove_path (string path) {
3624@@ -255,16 +212,6 @@
3625 return get_preset_filename (Path.build_filename ("extensions", preset_filename), filename);
3626 }
3627
3628- /* returns the path to a user configuration file to which it is permitted to write.
3629- this is also necessary for files whose state is synchronized to disk by a manager,
3630- e.g. cookies. */
3631- public static string get_config_filename_for_writing (string filename) {
3632- assert (mode != RuntimeMode.UNDEFINED);
3633- assert (config_dir != null);
3634- mkdir_with_parents (config_dir);
3635- return Path.build_path (Path.DIR_SEPARATOR_S, config_dir, filename);
3636- }
3637-
3638 public static unowned string get_cache_dir () {
3639 assert (cache_dir != null);
3640 return cache_dir;
3641@@ -369,38 +316,6 @@
3642 #endif
3643 }
3644
3645- public static string get_res_filename (string filename) {
3646- assert (command_line != null);
3647- assert (filename != "");
3648- #if HAVE_WIN32
3649- return Path.build_filename (exec_path, "share", PACKAGE_NAME, "res", filename);
3650- #else
3651- string path = Path.build_filename (exec_path, "share", PACKAGE_NAME, "res", filename);
3652- if (Posix.access (path, Posix.F_OK) == 0)
3653- return path;
3654-
3655- return build_folder ("data", null, filename) ??
3656- Path.build_filename (MDATADIR, PACKAGE_NAME, "res", filename);
3657- #endif
3658- }
3659-
3660- #if !HAVE_WIN32
3661- string? build_folder (string folder, string? middle, string filename) {
3662- /* Fallback to build folder */
3663- File? parent = File.new_for_path (exec_path);
3664- while (parent != null) {
3665- var data = parent.get_child (folder);
3666- if (middle != null)
3667- data = data.get_child (middle);
3668- var child = data.get_child (filename);
3669- if (child.query_exists ())
3670- return child.get_path ();
3671- parent = parent.get_parent ();
3672- }
3673- return null;
3674- }
3675- #endif
3676-
3677 /* returns the path to a file containing read-only data installed with the application
3678 if @res is true, looks in the midori resource folder specifically */
3679 public static string get_data_filename (string filename, bool res) {
3680@@ -446,11 +361,7 @@
3681 public static void clear_icons () {
3682 assert (cache_dir != null);
3683 assert (user_data_dir != null);
3684-#if HAVE_WEBKIT2
3685 WebKit.WebContext.get_default ().get_favicon_database ().clear ();
3686-#else
3687- WebKit.get_favicon_database ().clear ();
3688-#endif
3689 /* FIXME: Exclude search engine icons */
3690 remove_path (Path.build_filename (user_data_dir, "webkit", "icondatabase"));
3691 }
3692
3693=== modified file 'katze/midori-uri.vala'
3694--- katze/midori-uri.vala 2014-04-02 23:51:06 +0000
3695+++ katze/midori-uri.vala 2015-03-10 00:27:20 +0000
3696@@ -229,16 +229,10 @@
3697 * Since: 0.5.8
3698 **/
3699 public static async GLib.Icon? get_icon (string uri, Cancellable? cancellable=null) throws Error {
3700-#if HAVE_WEBKIT2
3701 var database = WebKit.WebContext.get_default ().get_favicon_database ();
3702 var surface = yield database.get_favicon (uri, cancellable);
3703 var image = (Cairo.ImageSurface)surface;
3704 var pixbuf = Gdk.pixbuf_get_from_surface (image, 0, 0, image.get_width (), image.get_height ());
3705-#else
3706- var database = WebKit.get_favicon_database ();
3707- // We must not pass a Cancellable due to a crasher bug
3708- var pixbuf = yield database.get_favicon_pixbuf (uri, 0, 0, null);
3709-#endif
3710 return pixbuf as GLib.Icon;
3711 }
3712
3713
3714=== modified file 'midori/CMakeLists.txt'
3715--- midori/CMakeLists.txt 2013-09-08 21:38:36 +0000
3716+++ midori/CMakeLists.txt 2015-03-10 00:27:20 +0000
3717@@ -1,15 +1,13 @@
3718 # Copyright (C) 2013 Christian Dywan <christian@twotoasts.de>
3719
3720-set(LIBMIDORI_VERSION 0.5.5)
3721+set(LIBMIDORI_VERSION 0.6.0)
3722 set(LIBMIDORI_SOVERSION 0)
3723
3724-file(GLOB MIDORI_VALA_SOURCE ../katze/*.vala *.vala ../panels/*.vala)
3725-file(GLOB LIBMIDORI_SOURCE ../katze/*.c ../panels/*.c ../toolbars/*.c midori-*.vala midori-*.c sokoke.c)
3726+# FIXME: Eventually core should link against ipc
3727+file(GLOB MIDORI_VALA_SOURCE ../katze/*.vala *.vala ../panels/*.vala ../ipc/*.vala)
3728+file(GLOB LIBMIDORI_SOURCE ../katze/*.c ../panels/*.c ../toolbars/*.c midori-*.c sokoke.c)
3729 include(GLibHelpers)
3730 add_glib_marshal(LIBMIDORI_SOURCE marshal ${CMAKE_PROJECT_NAME}_cclosure_marshal "midori.h")
3731-set(MIDORI_SOURCE
3732- main.c
3733- )
3734
3735 include(ValaPrecompile)
3736 vala_precompile(LIBMIDORI_SOURCE_C ${CMAKE_PROJECT_NAME}
3737@@ -21,18 +19,18 @@
3738 CUSTOM_VAPIS
3739 ${EXTRA_VAPIS}
3740 GENERATE_VAPI
3741- "${CMAKE_PROJECT_NAME}-core"
3742+ "${LIBMIDORI}"
3743 GENERATE_HEADER
3744- "${CMAKE_PROJECT_NAME}-core"
3745+ "${LIBMIDORI}"
3746 )
3747
3748-add_library("${LIBMIDORI}-vala" STATIC ${LIBMIDORI_SOURCE_C})
3749-target_link_libraries("${LIBMIDORI}-vala"
3750+add_library("${LIBMIDORIV}" STATIC ${LIBMIDORI_SOURCE_C})
3751+target_link_libraries("${LIBMIDORIV}"
3752 ${DEPS_LIBRARIES}
3753 ${OPTS_LIBRARIES}
3754 ${DEPS_GTK_LIBRARIES}
3755 )
3756-set_target_properties("${LIBMIDORI}-vala" PROPERTIES
3757+set_target_properties("${LIBMIDORIV}" PROPERTIES
3758 COMPILE_FLAGS "${VALA_CFLAGS}"
3759 POSITION_INDEPENDENT_CODE ON
3760 )
3761@@ -49,7 +47,7 @@
3762 ${DEPS_GTK_INCLUDE_DIRS}
3763 )
3764 target_link_libraries(${LIBMIDORI}
3765- "${LIBMIDORI}-vala"
3766+ ${LIBMIDORIV}
3767 ${DEPS_LIBRARIES}
3768 ${OPTS_LIBRARIES}
3769 ${DEPS_GTK_LIBRARIES}
3770
3771=== modified file 'midori/main.c'
3772--- midori/main.c 2014-04-23 03:34:23 +0000
3773+++ midori/main.c 2015-03-10 00:27:20 +0000
3774@@ -62,6 +62,7 @@
3775 gchar* config;
3776 gboolean private;
3777 gboolean portable;
3778+ gchar* test;
3779 gboolean plain;
3780 gboolean diagnostic_dialog = FALSE;
3781 gboolean debug = FALSE;
3782@@ -85,6 +86,8 @@
3783 { "portable", 'P', 0, G_OPTION_ARG_NONE, &portable,
3784 N_("Portable mode, all runtime files are stored in one place"), NULL },
3785 #endif
3786+ { "test", 't', 0, G_OPTION_ARG_STRING, &test,
3787+ N_("Run unit tests for the specified extension"), NULL },
3788 { "plain", '\0', 0, G_OPTION_ARG_NONE, &plain,
3789 N_("Plain GTK+ window with WebKit, akin to GtkLauncher"), NULL },
3790 { "diagnostic-dialog", 'd', 0, G_OPTION_ARG_NONE, &diagnostic_dialog,
3791@@ -118,6 +121,7 @@
3792 config = NULL;
3793 private = FALSE;
3794 portable = FALSE;
3795+ test = NULL;
3796 plain = FALSE;
3797 run = FALSE;
3798 snapshot = NULL;
3799@@ -287,24 +291,62 @@
3800 return 0;
3801 }
3802
3803+ if (test != NULL)
3804+ {
3805+ g_assert (g_module_supported ());
3806+
3807+ GModule* module = g_module_open (test, G_MODULE_BIND_LOCAL);
3808+ if (module == NULL)
3809+ g_error (_("Failed to load %s."), test);
3810+
3811+ midori_test_init (&argc, &argv);
3812+
3813+ typedef void (*extension_test_func)(void);
3814+ extension_test_func extension_test;
3815+ /* Midori.Extension */
3816+ typedef GObject* (*extension_init_func)(void);
3817+ extension_init_func extension_init;
3818+ /* WebKit.WebExtension */
3819+ typedef void (*webkit_web_extension_initialize_func)(GObject* extension);
3820+ webkit_web_extension_initialize_func web_extension_init;
3821+
3822+ if (g_module_symbol (module, "extension_init",
3823+ (gpointer) &extension_init))
3824+ {
3825+ /* It's fine to conditionally return no extension */
3826+ if (!(extension_init ()))
3827+ return 0;
3828+ midori_paths_init (MIDORI_RUNTIME_MODE_NORMAL, NULL);
3829+
3830+ /* Not all extensions have unit tests :-( */
3831+ if (!g_module_symbol (module, "extension_test", (gpointer) &extension_test))
3832+ return 0;
3833+ }
3834+ else if (g_module_symbol (module, "webkit_web_extension_initialize",
3835+ (gpointer) &web_extension_init)
3836+ || g_module_symbol (module, "webkit_web_extension_initialize_with_user_data",
3837+ (gpointer) &web_extension_init))
3838+ {
3839+ if (!g_module_symbol (module, "extension_test", (gpointer) &extension_test))
3840+ g_error (_("%s doesn't provide unit tests."), test);
3841+ }
3842+ else
3843+ g_error (_("%s doesn't look like a Midori extension."), test);
3844+
3845+ extension_test ();
3846+ return g_test_run ();
3847+ }
3848+
3849 if (plain)
3850 {
3851 GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
3852 GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
3853 GtkWidget* entry = gtk_entry_new ();
3854-#ifndef HAVE_WEBKIT2
3855- GtkWidget* scrolled = gtk_scrolled_window_new (NULL, NULL);
3856-#endif
3857 GtkWidget* web_view = webkit_web_view_new ();
3858 katze_window_set_sensible_default_size (GTK_WINDOW (window));
3859
3860 gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
3861-#ifndef HAVE_WEBKIT2
3862- gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE, 0);
3863- gtk_container_add (GTK_CONTAINER (scrolled), web_view);
3864-#else
3865 gtk_box_pack_start (GTK_BOX (vbox), web_view, TRUE, TRUE, 0);
3866-#endif
3867 gtk_container_add (GTK_CONTAINER (window), vbox);
3868 gtk_entry_set_text (GTK_ENTRY (entry), uris && *uris ? *uris : "http://www.example.com");
3869 plain_entry_activate_cb (entry, web_view);
3870@@ -330,9 +372,6 @@
3871
3872 MidoriBrowser* browser = midori_browser_new ();
3873 MidoriWebSettings* settings = midori_browser_get_settings (browser);
3874-#ifndef HAVE_WEBKIT2
3875- g_object_set_data (G_OBJECT (webkit_get_default_session ()), "pass-through-console", (void*)1);
3876-#endif
3877 midori_load_soup_session (settings);
3878
3879 gchar* msg = NULL;
3880
3881=== added file 'midori/midori-addons.vala'
3882--- midori/midori-addons.vala 1970-01-01 00:00:00 +0000
3883+++ midori/midori-addons.vala 2015-03-10 00:27:20 +0000
3884@@ -0,0 +1,415 @@
3885+/*
3886+ Copyright (C) 2014 Christian Dywan <christian@twotoats.de>
3887+
3888+ This library is free software; you can redistribute it and/or
3889+ modify it under the terms of the GNU Lesser General Public
3890+ License as published by the Free Software Foundation; either
3891+ version 2.1 of the License, or (at your option) any later version.
3892+
3893+ See the file COPYING for the full license text.
3894+*/
3895+
3896+namespace Midori {
3897+ public class Addon : Object {
3898+ public string name { get; set; }
3899+ public string description { get; set; }
3900+ public bool intern { get; internal set; }
3901+ public Addon (string name, string description) {
3902+ Object (name: name, description: description);
3903+ }
3904+ }
3905+
3906+ public class UserContent : Addon {
3907+ internal UserContent (string name, string description) {
3908+ Object (name: name, description: description);
3909+ }
3910+ }
3911+
3912+ public class ClassicExtension : Addon {
3913+ string? _version = null;
3914+ public string? version { get {
3915+ return _version;
3916+ } set {
3917+ /* Don't show version suffix if it matches the running Midori */
3918+ if (value != null && value.has_suffix (MIDORI_VERSION_SUFFIX))
3919+ _version = value.replace (MIDORI_VERSION_SUFFIX, "");
3920+ /* No version suffix at all, must be 0.4.1 or 0.4.1 git */
3921+ else if (value != null && !("-" in value) && !("(" in value))
3922+ _version = value + " (0.4.1)";
3923+ else
3924+ _version = value;
3925+ } }
3926+ public string? authors { get; set; default = null; }
3927+ public string? website { get; set; default = null; }
3928+ public string? stock_id { get; set; default = null; }
3929+ public bool use_markup { get; set; }
3930+ /* If there's more than one extension in an array.
3931+ Since: 0.4.5 */
3932+ public string? key { get; set; default = null; }
3933+
3934+ public string? config_dir { get; /* FIXME: internal */ set; default = null; }
3935+ KeyFile? keyfile = null;
3936+ /* Since: 0.1.3 */
3937+ public void install_boolean (string name, bool default) {
3938+ keyfile.set_boolean ("settings", name, default);
3939+ }
3940+ /* Since: 0.1.3 */
3941+ public bool get_boolean (string name) {
3942+ try {
3943+ return keyfile.get_boolean ("settings", name);
3944+ } catch (Error error) {
3945+ return false;
3946+ }
3947+ }
3948+ /* Since: 0.1.3 */
3949+ public void set_boolean (string name, bool value) {
3950+ keyfile.set_boolean ("settings", name, value);
3951+ save ();
3952+ }
3953+ /* Since: 0.1.3 */
3954+ public void install_integer (string name, int default) {
3955+ keyfile.set_integer ("settings", name, default);
3956+ }
3957+ public int get_integer (string name) {
3958+ try {
3959+ return keyfile.get_integer ("settings", name);
3960+ } catch (Error error) {
3961+ return 0;
3962+ }
3963+ }
3964+ public void set_integer (string name, int value) {
3965+ keyfile.set_integer ("settings", name, value);
3966+ save ();
3967+ }
3968+ /* Since: 0.1.3 */
3969+ public void install_string (string name, string default) {
3970+ keyfile.set_string ("settings", name, default);
3971+ }
3972+ public string? get_string (string name) {
3973+ try {
3974+ return keyfile.get_string ("settings", name);
3975+ } catch (Error error) {
3976+ return null;
3977+ }
3978+ }
3979+ public void set_string (string name, string value) {
3980+ keyfile.set_string ("settings", name, value);
3981+ save ();
3982+ }
3983+ /* Since: 0.1.7 */
3984+ public void install_string_list (string name, string[]? default) {
3985+ if (default != null)
3986+ keyfile.set_string_list ("settings", name, default);
3987+ }
3988+ /* Since: 0.1.7 */
3989+ public string[]? get_string_list (string name) {
3990+ try {
3991+ return keyfile.get_string_list ("settings", name);
3992+ } catch (Error error) {
3993+ return null;
3994+ }
3995+ }
3996+ /* Since: 0.1.7 */
3997+ public void set_string_list (string name, string[]? value) {
3998+ keyfile.set_string_list ("settings", name, value);
3999+ save ();
4000+ }
4001+ void save () {
4002+ Katze.mkdir_with_parents (config_dir, 0700);
4003+ string config = Path.build_filename (config_dir, "config");
4004+ try {
4005+ keyfile.save_to_file (config);
4006+ } catch (Error error) {
4007+ warning (_("The configuration of the extension '%s' couldn't be saved: %s\n"), name, error.message);
4008+ }
4009+ }
4010+
4011+ public bool is_prepared () {
4012+ // FIXME: has 'activate' handler pending?
4013+ return name != null && description != null && version != null && authors != null;
4014+ }
4015+ /* Since: 0.1.6 */
4016+ public Object? app { get; protected set; default = null; }
4017+ /* Since: 0.1.2 */
4018+ public bool is_active () { return app != null; }
4019+
4020+ public signal void activate (Object? app);
4021+ public signal void deactivate ();
4022+ /* Since: 0.4.0 */
4023+ public signal void open_preferences ();
4024+ public bool has_preferences () {
4025+ // FIXME: has 'open-preferences' handler pending?
4026+ return false;
4027+ }
4028+
4029+ protected ClassicExtension (string name, string description) {
4030+ Object (name: name, description: description);
4031+ }
4032+ void activated (Object? app) {
4033+ assert (is_prepared ());
4034+ this.app = app != null ? app : this.app;
4035+ string? filename = get_data<string?>("filename");
4036+ if (!Midori.Paths.is_readonly ()) {
4037+ this.config_dir = Paths.get_extension_config_dir (filename);
4038+ string preset = Paths.get_extension_preset_filename (filename, "config");
4039+ try {
4040+ keyfile.load_from_file (preset, KeyFileFlags.KEEP_COMMENTS);
4041+ } catch (FileError.NOENT exist_error) {
4042+ /* It's no error if no config file exists */
4043+ } catch (Error error) {
4044+ warning ("Failed to load config for %s from %s: %s", name, preset, error.message);
4045+ }
4046+ string config = Path.build_filename (config_dir, "config");
4047+ try {
4048+ keyfile.load_from_file (config, KeyFileFlags.KEEP_COMMENTS);
4049+ } catch (FileError.NOENT exist_error) {
4050+ /* It's no error if no config file exists */
4051+ } catch (Error error) {
4052+ warning ("Failed to load config for %s from %s: %s", name, config, error.message);
4053+ }
4054+ }
4055+ }
4056+ void deactivated () {
4057+ this.app = null;
4058+ }
4059+
4060+ construct {
4061+ keyfile = new KeyFile ();
4062+ activate.connect (activated);
4063+ deactivate.connect (deactivated);
4064+ }
4065+ }
4066+
4067+ delegate Object? ExtensionInitFunction ();
4068+ delegate void WebExtensionInitializeFunction (Object extension);
4069+
4070+ public class Addons : Object {
4071+ bool debug = false;
4072+ public WebKit.UserContentManager content_manager;
4073+
4074+ Addons () {
4075+ addons = new List<Addon> ();
4076+ modules = new HashTable<string, Object> (str_hash, str_equal);
4077+ content_manager = new WebKit.UserContentManager ();
4078+ if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "addons") == 0)
4079+ debug = true;
4080+ }
4081+
4082+ static Addons? _instance = null;
4083+ public static unowned Addons get_default () {
4084+ if (_instance == null)
4085+ _instance = new Addons ();
4086+ return _instance;
4087+ }
4088+
4089+ public Object? app { private get; set; default = null; }
4090+ string? _interns = null;
4091+ /* A comma separated list of extension names that are always loaded and
4092+ acctive but won't show up in GUI. Can only be set once. */
4093+ public string? interns { get {
4094+ return _interns;
4095+ } set {
4096+ assert (_interns == null);
4097+ _interns = value;
4098+ if (debug)
4099+ stdout.printf ("Addons: internal extensions '%s'\n", _interns);
4100+ foreach (string name in _interns.split (" ")) {
4101+ if (name == "")
4102+ continue;
4103+ var extension = load_by_name (name);
4104+ assert (extension != null);
4105+ assert (extension is ClassicExtension);
4106+ (extension as ClassicExtension).activate (app);
4107+ }
4108+ } }
4109+ /* GModule detects repeated loading but exposes no API zo check it */
4110+ HashTable<string, Object> modules;
4111+
4112+ public Object? load_by_name (string name) {
4113+ return load_by_filename ("lib" + name + "." + Module.SUFFIX);
4114+ }
4115+
4116+ public Object? load_by_filename (string filename) {
4117+ var libs = File.new_for_path (Midori.Paths.get_lib_path (PACKAGE_NAME));
4118+ string fullname = "/" in filename ? filename.split ("/")[0] : filename;
4119+ return load_from_file (libs.get_child (fullname));
4120+ }
4121+
4122+ public Object? load_from_file (File file) {
4123+ /* Not a module of any sort */
4124+ if (!(file.get_basename ().has_suffix (Module.SUFFIX)))
4125+ return null;
4126+ if (debug)
4127+ stdout.printf ("Addons: Module %s\n", file.get_basename ());
4128+
4129+ var addon = modules.lookup (file.get_basename ());
4130+ if (addon != null)
4131+ return addon;
4132+
4133+ Module? module = Module.open (file.get_path (), ModuleFlags.BIND_LOCAL);
4134+ void* extension_init;
4135+ void* web_extension_init;
4136+ if (module == null)
4137+ warning ("'%s' failed to open: %s", file.get_basename (), Module.error ());
4138+ else if (module.symbol ("extension_init", out extension_init)) {
4139+ if (debug)
4140+ stdout.printf ("^^ Midori.Extension\n");
4141+ var extension_or_array = ((ExtensionInitFunction)extension_init) ();
4142+ modules.insert (file.get_basename (), extension_or_array);
4143+ module.make_resident ();
4144+ if (extension_or_array is Addon) {
4145+ var extension = extension_or_array as Addon;
4146+ string bare_name = file.get_basename ().replace ("lib", "").replace ("." + Module.SUFFIX, "");
4147+ extension.intern = (bare_name in interns);
4148+ extension.set_data<string> ("filename", file.get_basename ());
4149+ if (debug)
4150+ stdout.printf ("^^ internal\n");
4151+ addons.append (extension);
4152+ return extension;
4153+ } else if (extension_or_array != null) {
4154+ if (debug)
4155+ stdout.printf ("^^ Katze.Array\n");
4156+ foreach (var extension in Katze.array_peek_items (extension_or_array))
4157+ addons.append (extension as Addon);
4158+ return extension_or_array;
4159+ }
4160+ } else if (module.symbol ("webkit_web_extension_initialize", out web_extension_init)
4161+ || module.symbol ("webkit_web_extension_initialize_with_user_data", out web_extension_init)) {
4162+ if (debug)
4163+ stdout.printf ("^^ WebKit.WebExtension\n");
4164+ var web_extension = new Addon (file.get_basename (), "WebExtension");
4165+ web_extension.intern = true;
4166+ addons.append (web_extension);
4167+ return web_extension;
4168+ } else
4169+ warning ("'%s' is not a known type of extension", file.get_basename ());
4170+ return null;
4171+ }
4172+
4173+ async UserContent parse_user_content (File file) {
4174+ string name = file.get_basename ();
4175+ string description = "";
4176+
4177+ if (file.get_basename ().has_suffix (".js")) {
4178+ try {
4179+ var stream = new DataInputStream (yield file.read_async ());
4180+ var source = new StringBuilder ();
4181+ do {
4182+ string? line = yield stream.read_line_async ();
4183+ if (line == null)
4184+ break;
4185+ // TODO: Parse metadata
4186+ source.append (line);
4187+ } while (true);
4188+
4189+ // TODO: whitelist, blacklist
4190+ var script = new WebKit.UserScript (source.str,
4191+ WebKit.UserContentInjectedFrames.ALL_FRAMES,
4192+ WebKit.UserScriptInjectionTime.END, null, null);
4193+ content_manager.add_script (script);
4194+ } catch (Error error) {
4195+ description = error.message;
4196+ warning ("Failed to read user script %s: %s", file.get_path (), error.message);
4197+ }
4198+ } else if (file.get_basename ().has_suffix (".css")) {
4199+ try {
4200+ var stream = new DataInputStream (yield file.read_async ());
4201+ var source = new StringBuilder ();
4202+ do {
4203+ string? line = yield stream.read_line_async ();
4204+ if (line == null)
4205+ break;
4206+ // TODO: Parse @-moz-document
4207+ source.append (line);
4208+ } while (true);
4209+
4210+ // TODO: whitelist, blacklist
4211+ var script = new WebKit.UserStyleSheet (source.str,
4212+ WebKit.UserContentInjectedFrames.ALL_FRAMES,
4213+ WebKit.UserStyleLevel.USER, null, null);
4214+ content_manager.add_style_sheet (script);
4215+ } catch (Error error) {
4216+ description = error.message;
4217+ warning ("Failed to read user style sheet %s: %s", file.get_path (), error.message);
4218+ }
4219+ } else {
4220+ assert_not_reached ();
4221+ }
4222+
4223+ // TODO: Handle activation
4224+ return new UserContent (name, description);
4225+ }
4226+
4227+ async void scan_user_content_folder (string folder, string extension) {
4228+ var scripts = File.new_for_path (Midori.Paths.get_user_data_dir ())
4229+ .get_child (PACKAGE_NAME).get_child (folder);
4230+ if (debug)
4231+ stdout.printf ("Addons: Scanning %s for user content\n", scripts.get_path ());
4232+ try {
4233+ var enumerator = yield scripts.enumerate_children_async ("standard::name", 0);
4234+ while (true) {
4235+ var files = yield enumerator.next_files_async (10);
4236+ if (files == null)
4237+ break;
4238+ foreach (var info in files) {
4239+ var file = scripts.get_child (info.get_name ());
4240+ /* Not a user script/ style? */
4241+ if (!(file.get_basename ().has_suffix (extension)))
4242+ continue;
4243+ if (debug)
4244+ stdout.printf ("Addons: User content %s\n", file.get_basename ());
4245+ var script = yield parse_user_content (file);
4246+ addons.append (script);
4247+ }
4248+ }
4249+ } catch (Error error) {
4250+ critical ("Failed to list user content: %s", error.message);
4251+ }
4252+ }
4253+
4254+ List<Addon>? addons;
4255+ public async unowned List<unowned Addon> list (Cancellable? cancellable=null) {
4256+ var libs = File.new_for_path (Midori.Paths.get_lib_path (PACKAGE_NAME));
4257+ if (debug)
4258+ stdout.printf ("Addons: Scanning %s for modules\n", libs.get_path ());
4259+ try {
4260+ var enumerator = yield libs.enumerate_children_async ("standard::name", 0);
4261+ while (true) {
4262+ var files = yield enumerator.next_files_async (10);
4263+ if (files == null)
4264+ break;
4265+ foreach (var info in files) {
4266+ var file = libs.get_child (info.get_name ());
4267+ var addon = load_from_file (file);
4268+ if (addon == null)
4269+ continue;
4270+ }
4271+ }
4272+ } catch (Error error) {
4273+ critical ("Failed to list (web) extensions: %s", error.message);
4274+ }
4275+
4276+ if (debug)
4277+ stdout.printf ("Addons: Reading WebKit.Plugin's\n");
4278+ try {
4279+ List<WebKit.Plugin> plugins = yield WebKit.WebContext.get_default ().get_plugins (cancellable);
4280+ foreach (WebKit.Plugin plugin in plugins) {
4281+ if (debug)
4282+ stdout.printf ("Addons: WebKit.Plugin %s\n", plugin.get_path ());
4283+ // FIXME: Skip plugin?
4284+ var regex = new Regex ("<a.+href.+>(.+)</a>");
4285+ string desc = regex.replace (
4286+ plugin.get_description (), -1, 0, "<u>\\1</u>").replace ("<br>", "\n");
4287+ addons.append (new Addon (plugin.get_name (), desc));
4288+ }
4289+ } catch (Error error) {
4290+ critical ("Failed to list plugins: %s", error.message);
4291+ }
4292+
4293+ yield scan_user_content_folder ("scripts", ".js");
4294+ yield scan_user_content_folder ("styles", ".css");
4295+
4296+ return addons;
4297+ }
4298+ }
4299+}
4300
4301=== modified file 'midori/midori-app.c'
4302--- midori/midori-app.c 2014-04-14 06:53:01 +0000
4303+++ midori/midori-app.c 2015-03-10 00:27:20 +0000
4304@@ -202,7 +202,6 @@
4305 G_CALLBACK (midori_app_send_notification), app);
4306 katze_array_add_item (app->browsers, browser);
4307
4308- #if GTK_CHECK_VERSION (3, 0, 0)
4309 if (app->browser == NULL)
4310 {
4311 gchar* filename;
4312@@ -226,7 +225,6 @@
4313 g_free (filename);
4314 }
4315 }
4316- #endif
4317
4318 app->browser = browser;
4319 }
4320@@ -1232,14 +1230,8 @@
4321 textdomain (GETTEXT_PACKAGE);
4322 #endif
4323
4324- #if GTK_CHECK_VERSION (3, 0, 0)
4325 success = gtk_init_with_args (argc, argument_vector, _("[Addresses]"),
4326 entries, GETTEXT_PACKAGE, &error);
4327- #else
4328- success = gtk_init_with_args (argc, argument_vector, _("[Addresses]"),
4329- (GOptionEntry*)entries, GETTEXT_PACKAGE, &error);
4330- #endif
4331-
4332 factory = gtk_icon_factory_new ();
4333 for (i = 0; i < G_N_ELEMENTS (items); i++)
4334 {
4335@@ -1276,7 +1268,10 @@
4336 midori_debug (const gchar* token)
4337 {
4338 static const gchar* debug_token = NULL;
4339- const gchar* debug_tokens = "wk2:no-multi-render-process adblock:match adblock:parse adblock:time adblock:element adblock:css startup headers body referer cookies paths hsts unarmed db:bookmarks db:history db:tabby mouse app database ";
4340+ const gchar* debug_tokens = "wk2:no-multi-render-process \
4341+ adblock:match adblock:parse adblock:time adblock:element adblock:css \
4342+ startup headers body referer cookies paths addons hsts unarmed \
4343+ db:bookmarks db:history db:tabby mouse app database dnt ";
4344 if (debug_token == NULL)
4345 {
4346 gchar* found_token;
4347
4348=== modified file 'midori/midori-app.h'
4349--- midori/midori-app.h 2013-03-28 17:27:56 +0000
4350+++ midori/midori-app.h 2015-03-10 00:27:20 +0000
4351@@ -103,6 +103,11 @@
4352 midori_error (const gchar* format,
4353 ...);
4354
4355+void
4356+midori_app_set_browsers (MidoriApp* app,
4357+ KatzeArray* browsers,
4358+ MidoriBrowser* browser);
4359+
4360 G_END_DECLS
4361
4362 #endif /* __MIDORI_APP_H__ */
4363
4364=== modified file 'midori/midori-browser.c'
4365--- midori/midori-browser.c 2014-11-22 17:20:43 +0000
4366+++ midori/midori-browser.c 2015-03-10 00:27:20 +0000
4367@@ -1,5 +1,5 @@
4368 /*
4369- Copyright (C) 2007-2013 Christian Dywan <christian@twotoasts.de>
4370+ Copyright (C) 2007-2014 Christian Dywan <christian@twotoasts.de>
4371 Copyright (C) 2008 Dale Whittaker <dayul@users.sf.net>
4372 Copyright (C) 2009 Jérôme Geulfucci <jeromeg@xfce.org>
4373
4374@@ -61,7 +61,7 @@
4375
4376 struct _MidoriBrowser
4377 {
4378- GtkWindow parent_instance;
4379+ MidoriWindow parent_instance;
4380 GtkActionGroup* action_group;
4381 GtkWidget* menubar;
4382 GtkWidget* throbber;
4383@@ -70,16 +70,8 @@
4384
4385 GtkWidget* panel;
4386 GtkWidget* notebook;
4387-
4388- GtkWidget* inspector;
4389- GtkWidget* inspector_view;
4390-
4391 GtkWidget* find;
4392
4393- GtkWidget* statusbar;
4394- GtkWidget* statusbar_contents;
4395- gchar* statusbar_text;
4396-
4397 gint last_window_width, last_window_height;
4398 guint alloc_timeout;
4399 guint panel_timeout;
4400@@ -95,14 +87,13 @@
4401 gboolean show_tabs;
4402
4403 gboolean show_navigationbar;
4404- gboolean show_statusbar;
4405 guint maximum_history_age;
4406 guint last_web_search;
4407
4408 gboolean bookmarkbar_populate;
4409 };
4410
4411-G_DEFINE_TYPE (MidoriBrowser, midori_browser, GTK_TYPE_WINDOW)
4412+G_DEFINE_TYPE (MidoriBrowser, midori_browser, MIDORI_TYPE_WINDOW)
4413
4414 enum
4415 {
4416@@ -153,11 +144,9 @@
4417 static void
4418 midori_browser_finalize (GObject* object);
4419
4420-#ifdef HAVE_WEBKIT2
4421 void download_created_destination_cb (WebKitDownload *download,
4422 gchar *destination,
4423 gpointer user_data);
4424-#endif
4425
4426 static void
4427 midori_browser_set_property (GObject* object,
4428@@ -237,7 +226,8 @@
4429 gboolean show_tabs = !midori_browser_is_fullscreen (browser) || ignore_fullscreen;
4430 if (!browser->show_tabs)
4431 show_tabs = FALSE;
4432- midori_notebook_set_labels_visible (MIDORI_NOTEBOOK (browser->notebook), show_tabs);
4433+ if (browser->notebook)
4434+ midori_notebook_set_labels_visible (MIDORI_NOTEBOOK (browser->notebook), show_tabs);
4435 return has_tabs;
4436 }
4437
4438@@ -286,13 +276,6 @@
4439 {
4440 GtkAction* action;
4441
4442- _action_set_sensitive (browser, "Back", midori_view_can_go_back (view));
4443- _action_set_sensitive (browser, "Forward", midori_tab_can_go_forward (MIDORI_TAB (view)));
4444- _action_set_sensitive (browser, "Previous",
4445- midori_view_get_previous_page (view) != NULL);
4446- _action_set_sensitive (browser, "Next",
4447- midori_view_get_next_page (view) != NULL);
4448-
4449 _action_set_sensitive (browser, "AddSpeedDial", !midori_view_is_blank (view));
4450 _action_set_sensitive (browser, "BookmarkAdd", !midori_view_is_blank (view));
4451 _action_set_sensitive (browser, "MailTo", !midori_view_is_blank (view));
4452@@ -305,24 +288,6 @@
4453 midori_tab_can_view_source (MIDORI_TAB (view)));
4454 _action_set_sensitive (browser, "SourceView",
4455 midori_tab_can_view_source (MIDORI_TAB (view)));
4456- _action_set_sensitive (browser, "SourceViewDom",
4457- midori_tab_can_view_source (MIDORI_TAB (view)));
4458-
4459- action = _action_by_name (browser, "NextForward");
4460- if (midori_tab_can_go_forward (MIDORI_TAB (view)))
4461- {
4462- g_object_set (action,
4463- "stock-id", GTK_STOCK_GO_FORWARD,
4464- "tooltip", _("Go forward to the next page"),
4465- "sensitive", TRUE, NULL);
4466- }
4467- else
4468- {
4469- g_object_set (action,
4470- "stock-id", GTK_STOCK_MEDIA_NEXT,
4471- "tooltip", _("Go to the next sub-page"),
4472- "sensitive", midori_view_get_next_page (view) != NULL, NULL);
4473- }
4474
4475 action = _action_by_name (browser, "Location");
4476 if (midori_tab_is_blank (MIDORI_TAB (view)))
4477@@ -339,55 +304,6 @@
4478 midori_browser_update_secondary_icon (browser, view, action);
4479 }
4480
4481-static void
4482-_midori_browser_set_statusbar_text (MidoriBrowser* browser,
4483- MidoriView* view,
4484- const gchar* text)
4485-{
4486- #if GTK_CHECK_VERSION (3, 2, 0)
4487- gboolean is_location = FALSE;
4488- #else
4489- GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
4490- gboolean is_location = widget && GTK_IS_ENTRY (widget)
4491- && GTK_IS_ALIGNMENT (gtk_widget_get_parent (widget));
4492- #endif
4493-
4494- katze_assign (browser->statusbar_text, midori_uri_format_for_display (text));
4495- if (view == NULL)
4496- return;
4497-
4498- if (!gtk_widget_get_visible (browser->statusbar) && !is_location
4499- && text && *text)
4500- {
4501- #if GTK_CHECK_VERSION (3, 2, 0)
4502- midori_view_set_overlay_text (view, browser->statusbar_text);
4503- #else
4504- GtkAction* action = _action_by_name (browser, "Location");
4505- MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
4506- midori_location_action_set_text (location_action, browser->statusbar_text);
4507- midori_location_action_set_secondary_icon (location_action, NULL);
4508- #endif
4509- }
4510- else if (!gtk_widget_get_visible (browser->statusbar) && !is_location)
4511- {
4512- #if GTK_CHECK_VERSION (3, 2, 0)
4513- midori_view_set_overlay_text (view, NULL);
4514- #else
4515- GtkAction* action = _action_by_name (browser, "Location");
4516- MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
4517- midori_browser_update_secondary_icon (browser, view, action);
4518- midori_location_action_set_text (location_action,
4519- midori_view_get_display_uri (view));
4520- #endif
4521- }
4522- else
4523- {
4524- gtk_statusbar_pop (GTK_STATUSBAR (browser->statusbar), 1);
4525- gtk_statusbar_push (GTK_STATUSBAR (browser->statusbar), 1,
4526- katze_str_non_null (browser->statusbar_text));
4527- }
4528-}
4529-
4530 void
4531 midori_browser_set_current_page_smartly (MidoriBrowser* browser,
4532 gint n)
4533@@ -576,11 +492,6 @@
4534 }
4535 }
4536
4537-void
4538-midori_app_set_browsers (MidoriApp* app,
4539- KatzeArray* browsers,
4540- MidoriBrowser* browser);
4541-
4542 static void
4543 _midori_browser_activate_action (MidoriBrowser* browser,
4544 const gchar* name)
4545@@ -619,17 +530,9 @@
4546 }
4547 else
4548 {
4549- gchar* extension_path = midori_paths_get_lib_path (PACKAGE_NAME);
4550+ gchar* extension_path = NULL;
4551 GObject* extension = midori_extension_load_from_file (extension_path, parts[0], TRUE, FALSE);
4552- MidoriApp* app = midori_app_new_proxy (NULL);
4553- g_object_set (app,
4554- "settings", browser->settings,
4555- NULL);
4556- /* FIXME: tabs of multiple windows */
4557- KatzeArray* browsers = katze_array_new (MIDORI_TYPE_BROWSER);
4558- katze_array_add_item (browsers, browser);
4559- midori_app_set_browsers (app, browsers, browser);
4560- g_free (extension_path);
4561+ MidoriApp* app = NULL;
4562 if (extension && !strcmp (parts[1], "true"))
4563 midori_extension_activate (extension, parts[0], TRUE, app);
4564 else if (extension && !strcmp (parts[1], "false"))
4565@@ -650,6 +553,16 @@
4566 }
4567
4568 static void
4569+midori_view_action_added_cb (MidoriView* view,
4570+ guint64 id,
4571+ GVariant* user_data,
4572+ MidoriBrowser* browser)
4573+{
4574+ MidoriContextAction* action = midori_context_action_new_from_user_data (user_data);
4575+ midori_window_add_action (MIDORI_WINDOW (browser), GTK_ACTION (action));
4576+}
4577+
4578+static void
4579 midori_view_notify_icon_cb (MidoriView* view,
4580 GParamSpec* pspec,
4581 MidoriBrowser* browser)
4582@@ -684,7 +597,6 @@
4583 }
4584
4585 _midori_browser_update_interface (browser, view);
4586- _midori_browser_set_statusbar_text (browser, view, NULL);
4587 }
4588
4589 if (load_status == MIDORI_LOAD_FINISHED)
4590@@ -714,8 +626,6 @@
4591 const gchar* uri = midori_view_get_display_uri (view);
4592 GtkAction* action = _action_by_name (browser, "Location");
4593 midori_location_action_set_text (MIDORI_LOCATION_ACTION (action), uri);
4594- _action_set_sensitive (browser, "Back", midori_view_can_go_back (view));
4595- _action_set_sensitive (browser, "Forward", midori_tab_can_go_forward (MIDORI_TAB (view)));
4596 g_object_notify (G_OBJECT (browser), "uri");
4597 }
4598 }
4599@@ -810,21 +720,6 @@
4600 midori_view_get_zoom_level (MIDORI_VIEW (view)) != 1.0f);
4601 }
4602
4603-static void
4604-midori_view_notify_statusbar_text_cb (GtkWidget* view,
4605- GParamSpec* pspec,
4606- MidoriBrowser* browser)
4607-{
4608- gchar* text;
4609-
4610- if (view == midori_browser_get_current_tab (browser))
4611- {
4612- g_object_get (view, "statusbar-text", &text, NULL);
4613- _midori_browser_set_statusbar_text (browser, MIDORI_VIEW (view), text);
4614- g_free (text);
4615- }
4616-}
4617-
4618 static gboolean
4619 midori_bookmark_folder_button_reach_parent (GtkTreeModel* model, GtkTreeIter *iter, gint64 parentid)
4620 {
4621@@ -1124,7 +1019,7 @@
4622 #endif
4623 {
4624 dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (browser),
4625- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, NULL, NULL);
4626+ GTK_DIALOG_DESTROY_WITH_PARENT, NULL, NULL);
4627 }
4628 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
4629 gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
4630@@ -1255,54 +1150,11 @@
4631 if (!midori_download_has_enough_space (download, uri, FALSE))
4632 return FALSE;
4633
4634-#ifdef HAVE_WEBKIT2
4635 webkit_download_set_destination (download, uri);
4636-#else
4637- webkit_download_set_destination_uri (download, uri);
4638-#endif
4639 g_signal_emit (browser, signals[ADD_DOWNLOAD], 0, download);
4640 return TRUE;
4641 }
4642
4643-#ifndef HAVE_WEBKIT2
4644-static void
4645-midori_browser_save_resources (GList* resources,
4646- const gchar* folder)
4647-{
4648- GList* list;
4649- katze_mkdir_with_parents (folder, 0700);
4650-
4651- for (list = resources; list; list = g_list_next (list))
4652- {
4653- WebKitWebResource* resource = WEBKIT_WEB_RESOURCE (list->data);
4654- GString* data = webkit_web_resource_get_data (resource);
4655-
4656- /* Resource could be adblocked, skip it in that case */
4657- if (!g_strcmp0 (webkit_web_resource_get_uri (resource), "about:blank"))
4658- continue;
4659-
4660- gchar* sub_filename = midori_download_get_filename_suggestion_for_uri (
4661- webkit_web_resource_get_mime_type (resource),
4662- webkit_web_resource_get_uri (resource));
4663- gchar* sub_path = g_build_filename (folder, sub_filename, NULL);
4664- sub_path = midori_download_get_unique_filename (sub_path);
4665- if (data)
4666- {
4667- GError* error = NULL;
4668- if (!g_file_set_contents (sub_path, data->str, data->len, &error))
4669- {
4670- g_warning ("Failed to save %s: %s", sub_filename, error->message);
4671- g_error_free (error);
4672- }
4673- }
4674- else
4675- g_warning ("Skipping empty resource %s", sub_filename);
4676- g_free (sub_filename);
4677- g_free (sub_path);
4678- }
4679-}
4680-#endif
4681-
4682 void
4683 midori_browser_save_uri (MidoriBrowser* browser,
4684 MidoriView* view,
4685@@ -1331,50 +1183,6 @@
4686 g_free (dirname);
4687 }
4688
4689-#ifndef HAVE_WEBKIT2
4690- GList* resources = midori_view_get_resources (view);
4691- gboolean file_only = TRUE;
4692- GtkWidget* checkbox = NULL;
4693-
4694- if (resources != NULL && g_list_nth_data (resources, 1) != NULL)
4695- {
4696- file_only = FALSE;
4697- checkbox = gtk_check_button_new_with_mnemonic (_("Save associated _resources"));
4698- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE);
4699- gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), checkbox);
4700- }
4701-
4702- if (!file_only && !g_str_equal (title, uri))
4703- filename = midori_download_clean_filename (title);
4704- else
4705- {
4706- gchar* mime_type = katze_object_get_object (view, "mime-type");
4707- filename = midori_download_get_filename_suggestion_for_uri (mime_type, uri);
4708- g_free (mime_type);
4709- }
4710- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename);
4711- g_free (filename);
4712-
4713- if (midori_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
4714- {
4715- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
4716- if (checkbox != NULL)
4717- file_only = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
4718- if (!file_only)
4719- {
4720- gchar* fullname = g_strconcat (filename, ".html", NULL);
4721- midori_view_save_source (view, uri, fullname, FALSE);
4722- g_free (fullname);
4723- midori_browser_save_resources (resources, filename);
4724- }
4725- else
4726- midori_view_save_source (view, uri, filename, FALSE);
4727- katze_assign (last_dir,
4728- gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
4729- }
4730- g_list_foreach (resources, (GFunc)g_object_unref, NULL);
4731- g_list_free (resources);
4732-#else
4733 filename = midori_download_clean_filename (title);
4734 gchar* suggested_filename = g_strconcat (filename, ".mht", NULL);
4735 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested_filename);
4736@@ -1392,7 +1200,6 @@
4737 katze_assign (last_dir,
4738 gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
4739 }
4740-#endif
4741 gtk_widget_destroy (dialog);
4742 }
4743
4744@@ -1416,15 +1223,6 @@
4745 midori_view_get_display_title (MIDORI_VIEW (view)), NULL);
4746 }
4747
4748-static gboolean
4749-midori_browser_tab_leave_notify_event_cb (GtkWidget* widget,
4750- GdkEventCrossing* event,
4751- MidoriBrowser* browser)
4752-{
4753- _midori_browser_set_statusbar_text (browser, MIDORI_VIEW (widget), NULL);
4754- return TRUE;
4755-}
4756-
4757 static void
4758 midori_browser_view_copy_to_item_history (GtkWidget* view,
4759 KatzeItem* item)
4760@@ -1476,41 +1274,6 @@
4761 }
4762
4763 static void
4764-midori_view_attach_inspector_cb (GtkWidget* view,
4765- GtkWidget* inspector_view,
4766- MidoriBrowser* browser)
4767-{
4768- GtkWidget* toplevel = gtk_widget_get_toplevel (inspector_view);
4769- GtkWidget* scrolled = gtk_widget_get_parent (browser->inspector_view);
4770- if (browser->inspector_view == inspector_view)
4771- return;
4772-
4773- gtk_widget_hide (toplevel);
4774- gtk_widget_destroy (browser->inspector_view);
4775- gtk_widget_reparent (inspector_view, scrolled);
4776- gtk_widget_show_all (browser->inspector);
4777- browser->inspector_view = inspector_view;
4778- gtk_widget_destroy (toplevel);
4779- if (!katze_object_get_boolean (browser->settings, "last-inspector-attached"))
4780- g_object_set (browser->settings, "last-inspector-attached", TRUE, NULL);
4781-}
4782-
4783-static void
4784-midori_view_detach_inspector_cb (GtkWidget* view,
4785- GtkWidget* inspector_view,
4786- MidoriBrowser* browser)
4787-{
4788- GtkWidget* scrolled = gtk_widget_get_parent (GTK_WIDGET (inspector_view));
4789- GtkWidget* paned = gtk_widget_get_parent (scrolled);
4790- browser->inspector_view = gtk_viewport_new (NULL, NULL);
4791- gtk_container_remove (GTK_CONTAINER (scrolled), GTK_WIDGET (inspector_view));
4792- gtk_container_add (GTK_CONTAINER (scrolled), browser->inspector_view);
4793- gtk_widget_hide (paned);
4794- if (katze_object_get_boolean (browser->settings, "last-inspector-attached"))
4795- g_object_set (browser->settings, "last-inspector-attached", FALSE, NULL);
4796-}
4797-
4798-static void
4799 midori_browser_view_copy_history (GtkWidget* view_to,
4800 GtkWidget* view_from,
4801 gboolean omit_last)
4802@@ -1652,10 +1415,6 @@
4803 }
4804
4805 static void
4806-_midori_browser_set_toolbar_items (MidoriBrowser* browser,
4807- const gchar* items);
4808-
4809-static void
4810 midori_view_new_view_cb (GtkWidget* view,
4811 GtkWidget* new_view,
4812 MidoriNewView where,
4813@@ -1675,9 +1434,8 @@
4814 NULL);
4815 sokoke_widget_set_visible (new_browser->menubar, FALSE);
4816 sokoke_widget_set_visible (new_browser->bookmarkbar, FALSE);
4817- sokoke_widget_set_visible (new_browser->statusbar, FALSE);
4818 _action_set_visible (new_browser, "CompactMenu", FALSE);
4819- _midori_browser_set_toolbar_items (new_browser, "Location");
4820+ midori_window_set_actions (MIDORI_WINDOW (new_browser), "Location");
4821 sokoke_widget_set_visible (new_browser->panel, FALSE);
4822 midori_browser_add_tab (new_browser, new_view);
4823 midori_browser_set_current_tab (new_browser, new_view);
4824@@ -1724,7 +1482,6 @@
4825 }
4826 }
4827
4828-#ifdef HAVE_WEBKIT2
4829 static void
4830 midori_browser_close_tab_idle (GObject* resource,
4831 GAsyncResult* result,
4832@@ -1734,16 +1491,8 @@
4833 result, NULL, NULL);
4834 if (data != NULL)
4835 return;
4836-#else
4837-static gboolean
4838-midori_browser_close_tab_idle (gpointer view)
4839-{
4840-#endif
4841 MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
4842 midori_browser_close_tab (browser, GTK_WIDGET (view));
4843-#ifndef HAVE_WEBKIT2
4844- return G_SOURCE_REMOVE;
4845-#endif
4846 }
4847
4848 static gboolean
4849@@ -1759,11 +1508,7 @@
4850 {
4851 handled = FALSE;
4852 }
4853- #ifdef HAVE_WEBKIT2
4854 else if (!webkit_download_get_destination (download))
4855- #else
4856- else if (!webkit_download_get_destination_uri (download))
4857- #endif
4858 {
4859 if (type == MIDORI_DOWNLOAD_SAVE_AS)
4860 {
4861@@ -1772,12 +1517,8 @@
4862
4863 if (!dialog)
4864 {
4865- #ifdef HAVE_WEBKIT2
4866 const gchar* download_uri = webkit_uri_response_get_uri (
4867 webkit_download_get_response (download));
4868- #else
4869- const gchar* download_uri = webkit_download_get_uri (download);
4870- #endif
4871 gchar* folder;
4872 dialog = (GtkWidget*)midori_file_chooser_dialog_new (_("Save file"),
4873 GTK_WINDOW (browser), GTK_FILE_CHOOSER_ACTION_SAVE);
4874@@ -1822,24 +1563,14 @@
4875 midori_browser_prepare_download (browser, download, destination_uri);
4876 g_free (destination_uri);
4877 }
4878- #ifndef HAVE_WEBKIT2
4879- webkit_download_start (download);
4880- #endif
4881 }
4882
4883 /* Close empty tabs due to download links with a target */
4884 if (midori_view_is_blank (MIDORI_VIEW (view)))
4885 {
4886 GtkWidget* web_view = midori_view_get_web_view (MIDORI_VIEW (view));
4887- #ifdef HAVE_WEBKIT2
4888 WebKitWebResource* resource = webkit_web_view_get_main_resource (WEBKIT_WEB_VIEW (web_view));
4889 webkit_web_resource_get_data (resource, NULL, midori_browser_close_tab_idle, view);
4890- #else
4891- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
4892- WebKitWebDataSource* datasource = webkit_web_frame_get_data_source (web_frame);
4893- if (webkit_web_data_source_get_data (datasource) == NULL)
4894- g_idle_add (midori_browser_close_tab_idle, view);
4895- #endif
4896 }
4897 return handled;
4898 }
4899@@ -1880,6 +1611,8 @@
4900 katze_array_add_item (browser->proxy_array, item);
4901
4902 g_object_connect (view,
4903+ "signal::action-added",
4904+ midori_view_action_added_cb, browser,
4905 "signal::notify::icon",
4906 midori_view_notify_icon_cb, browser,
4907 "signal::notify::load-status",
4908@@ -1892,12 +1625,6 @@
4909 midori_view_notify_title_cb, browser,
4910 "signal::notify::zoom-level",
4911 midori_view_notify_zoom_level_cb, browser,
4912- "signal::notify::statusbar-text",
4913- midori_view_notify_statusbar_text_cb, browser,
4914- "signal::attach-inspector",
4915- midori_view_attach_inspector_cb, browser,
4916- "signal::detach-inspector",
4917- midori_view_detach_inspector_cb, browser,
4918 "signal::new-tab",
4919 midori_view_new_tab_cb, browser,
4920 "signal::new-window",
4921@@ -1908,8 +1635,6 @@
4922 midori_view_download_requested_cb, browser,
4923 "signal::search-text",
4924 midori_view_search_text_cb, browser,
4925- "signal::leave-notify-event",
4926- midori_browser_tab_leave_notify_event_cb, browser,
4927 "signal::destroy",
4928 midori_view_destroy_cb, browser,
4929 NULL);
4930@@ -1947,12 +1672,6 @@
4931 midori_view_notify_title_cb, browser,
4932 "any_signal",
4933 midori_view_notify_zoom_level_cb, browser,
4934- "any_signal",
4935- midori_view_notify_statusbar_text_cb, browser,
4936- "any_signal::attach-inspector",
4937- midori_view_attach_inspector_cb, browser,
4938- "any_signal::detach-inspector",
4939- midori_view_detach_inspector_cb, browser,
4940 "any_signal::new-tab",
4941 midori_view_new_tab_cb, browser,
4942 "any_signal::new-window",
4943@@ -1963,8 +1682,6 @@
4944 midori_view_download_requested_cb, browser,
4945 "any_signal::search-text",
4946 midori_view_search_text_cb, browser,
4947- "any_signal::leave-notify-event",
4948- midori_browser_tab_leave_notify_event_cb, browser,
4949 NULL);
4950 }
4951
4952@@ -2405,7 +2122,7 @@
4953 "navigationbar",
4954 "Navigationbar",
4955 "The navigationbar",
4956- GTK_TYPE_TOOLBAR,
4957+ GTK_TYPE_WIDGET,
4958 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
4959
4960 g_object_class_install_property (gobject_class,
4961@@ -2459,6 +2176,7 @@
4962 *
4963 * The widget representing the statusbar contents. This is
4964 * not an actual #GtkStatusbar but rather a #GtkBox.
4965+ * Deprecated: 0.6.0
4966 */
4967 g_object_class_install_property (gobject_class,
4968 PROP_STATUSBAR,
4969@@ -2466,7 +2184,7 @@
4970 "statusbar",
4971 "Statusbar",
4972 "The statusbar",
4973- GTK_TYPE_BOX,
4974+ GTK_TYPE_WIDGET,
4975 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
4976
4977 /**
4978@@ -2629,17 +2347,6 @@
4979 "Whether or not to show tabs",
4980 TRUE,
4981 flags));
4982-
4983- #if !GTK_CHECK_VERSION (3, 0, 0)
4984- /* Add 2px space between tool buttons */
4985- gtk_rc_parse_string (
4986- "style \"tool-button-style\"\n {\n"
4987- "GtkToolButton::icon-spacing = 2\n }\n"
4988- "widget \"MidoriBrowser.*.MidoriBookmarkbar.Gtk*ToolButton\" "
4989- "style \"tool-button-style\"\n"
4990- "widget \"MidoriBrowser.*.MidoriFindbar.Gtk*ToolButton\" "
4991- "style \"tool-button-style\"\n");
4992- #endif
4993 }
4994
4995 static void
4996@@ -2668,10 +2375,6 @@
4997 _action_open_activate (GtkAction* action,
4998 MidoriBrowser* browser)
4999 {
5000- #if !GTK_CHECK_VERSION (3, 1, 10)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: