Merge lp:~midori/midori/webKit2Gtk3only into lp:midori

Proposed by Cris Dywan
Status: Needs review
Proposed branch: lp:~midori/midori/webKit2Gtk3only
Merge into: lp:midori
Diff against target: 8331 lines (+76/-5678)
62 files modified
CMakeLists.txt (+16/-75)
HACKING (+1/-1)
extensions/CMakeLists.txt (+11/-12)
extensions/about.vala (+1/-5)
extensions/adblock/extension.vala (+0/-33)
extensions/adblock/widgets.vala (+0/-8)
extensions/colorful-tabs.c (+0/-5)
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/-17)
extensions/external-download-manager.vala (+0/-17)
extensions/feed-panel/feed-panel.c (+2/-6)
extensions/feed-panel/main.c (+1/-1)
extensions/formhistory/formhistory.c (+1/-1)
extensions/history-list.vala (+0/-14)
extensions/nojs/nojs-preferences.c (+0/-18)
extensions/open-with.vala (+0/-14)
extensions/shortcuts.c (+1/-1)
extensions/tabby.vala (+0/-4)
extensions/transfers.vala (+1/-15)
katze/gtk3-compat.c (+0/-243)
katze/gtk3-compat.h (+0/-93)
katze/katze-cellrenderercomboboxtext.c (+0/-39)
katze/katze-http-auth.c (+1/-2)
katze/katze-item.c (+1/-1)
katze/katze-preferences.c (+10/-25)
katze/katze-utils.c (+0/-80)
katze/katze-utils.h (+0/-1)
katze/katze.h (+1/-5)
katze/midori-paths.vala (+1/-25)
katze/midori-uri.vala (+0/-2)
midori/main.c (+0/-11)
midori/midori-app.c (+1/-35)
midori/midori-browser.c (+3/-196)
midori/midori-browser.h (+0/-4)
midori/midori-download.vala (+0/-38)
midori/midori-frontend.c (+1/-6)
midori/midori-locationaction.c (+1/-87)
midori/midori-notebook.vala (+0/-54)
midori/midori-panel.c (+0/-10)
midori/midori-platform.h (+0/-1)
midori/midori-privatedata.c (+1/-1)
midori/midori-searchaction.c (+2/-8)
midori/midori-session.c (+1/-46)
midori/midori-settings.vala (+0/-18)
midori/midori-tab.vala (+0/-25)
midori/midori-view.c (+15/-425)
midori/midori-websettings.c (+1/-154)
midori/midori-window.vala (+1/-8)
midori/sokoke.c (+0/-53)
midori/sokoke.h (+0/-1)
midori/webkit2gtk-web-extension-4.0.vapi (+0/-2801)
midori/webkitgtk-3.0.deps (+0/-6)
midori/webkitgtk-3.0.vapi (+0/-841)
snap/snapcraft.yaml (+0/-1)
tests/actions.vala (+0/-3)
tests/browser.c (+0/-2)
tests/download.vala (+0/-26)
tests/extensions.c (+0/-4)
tests/magic-uri.c (+0/-2)
tests/properties.c (+0/-5)
tests/tab.vala (+0/-15)
To merge this branch: bzr merge lp:~midori/midori/webKit2Gtk3only
Reviewer Review Type Date Requested Status
Midori Devs Pending
Review via email: mp+333294@code.launchpad.net

Commit message

Drop non-WebKit2/ non-libnotify code paths

Description of the change

Drop non-WebKit2 non-GTK+3 code paths and libnotify support as well as the according options in CMake.

Note that this branch isn't adding any new code for things that weren't implemented before. Any existing WebKit2 bugs WON'T be addressed here since that's what made the previous branch difficult to review.
A few code paths that have no WebKit 2 equivalent yet will remain so it's clear what has to be implemented in future branches to make them work. That also applies to extensions that rely on WebKit 1 to work
If this branch works as well as trunk compiled with -DHALF_BRO_INCOM_WEBKIT2 that means it's working fine.

To post a comment you must log in.
lp:~midori/midori/webKit2Gtk3only updated
7171. By Cris Dywan

Drop non-WebKit2 website saving code path

7172. By Cris Dywan

Unconditionally include WebKit2 headers

7173. By Cris Dywan

Drop pass-through-console flag

Unmerged revisions

7173. By Cris Dywan

Drop pass-through-console flag

7172. By Cris Dywan

Unconditionally include WebKit2 headers

7171. By Cris Dywan

Drop non-WebKit2 website saving code path

7170. By Cris Dywan

Non-conditional skipping of non-WebKit2 extensions

7169. By Cris Dywan

Drop non-WebKit2/ non-libnotify code paths

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-02-04 19:54:52 +0000
+++ CMakeLists.txt 2017-11-26 09:48:19 +0000
@@ -39,7 +39,7 @@
39set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)39set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
4040
41find_package(Vala REQUIRED)41find_package(Vala REQUIRED)
42vala_require("0.16.0")42vala_require("0.17.0")
43set(VALAFLAGS ${VALAFLAGS}43set(VALAFLAGS ${VALAFLAGS}
44 --enable-deprecated44 --enable-deprecated
45 --debug45 --debug
@@ -111,50 +111,20 @@
111 libxml-2.0>=2.6111 libxml-2.0>=2.6
112 sqlite3>=3.6.19112 sqlite3>=3.6.19
113 gmodule-2.0113 gmodule-2.0
114 gio-2.0>=2.32.3114 gio-2.0>=2.40.0
115 libsoup-gnome-2.4>=2.37.1115 libsoup-gnome-2.4>=2.48.0
116 )116 )
117add_definitions("-DHAVE_LIBXML")117add_definitions("-DHAVE_LIBXML")
118add_definitions("-DGIO_VERSION=\"${DEPS_gio-2.0_VERSION}\"")118add_definitions("-DGIO_VERSION=\"${DEPS_gio-2.0_VERSION}\"")
119add_definitions("-DLIBSOUP_VERSION=\"${DEPS_libsoup-gnome-2.4_VERSION}\"")119add_definitions("-DLIBSOUP_VERSION=\"${DEPS_libsoup-gnome-2.4_VERSION}\"")
120set(PKGS posix linux libxml-2.0 sqlite3 gmodule-2.0 gio-2.0 libsoup-2.4)120set(PKGS posix linux libxml-2.0 sqlite3 gmodule-2.0 gio-2.0 libsoup-2.4)
121if (${DEPS_libsoup-gnome-2.4_VERSION} VERSION_GREATER "2.40.0")121
122 # valac 0.16 didn't have the bindings yet
123 # For consistency we need to ensure C code makes the same assumptions
124 if (${VALA_VERSION} VERSION_GREATER "0.17.0")
125 add_definitions("-DHAVE_LIBSOUP_2_40_0")
126 set(VALAFLAGS ${VALAFLAGS} -D HAVE_LIBSOUP_2_40_0)
127 endif ()
128endif ()
129if (${DEPS_libsoup-gnome-2.4_VERSION} VERSION_GREATER "2.48.0")
130 add_definitions("-DHAVE_LIBSOUP_2_48_0")
131 set(VALAFLAGS ${VALAFLAGS} -D HAVE_LIBSOUP_2_48_0)
132endif ()
133
134if (${DEPS_gio-2.0_VERSION} VERSION_GREATER "2.40.0" OR WIN32)
135 add_definitions("-DLIBNOTIFY_VERSION=\"No\"")
136else ()
137 pkg_check_modules(NOTIFY REQUIRED libnotify)
138 add_definitions("-DLIBNOTIFY_VERSION=\"${NOTIFY_VERSION}\"")
139 add_definitions("-DHAVE_LIBNOTIFY")
140 set(OPTS_INCLUDE_DIRS "${OPTS_INCLUDE_DIRS};${NOTIFY_INCLUDE_DIRS}")
141 set(OPTS_LIBRARIES "${OPTS_LIBRARIES};${NOTIFY_LIBRARIES}")
142 set(PKGS ${PKGS} libnotify)
143endif ()
144
145option(USE_GTK3 "Use GTK+3" OFF)
146option(HALF_BRO_INCOM_WEBKIT2 "Serve as a guniea pig" OFF)
147option(USE_ZEITGEIST "Zeitgeist history integration" ON)122option(USE_ZEITGEIST "Zeitgeist history integration" ON)
148option(USE_GRANITE "Fancy notebook and pop-overs" OFF)123option(USE_GRANITE "Fancy notebook and pop-overs" OFF)
149option(USE_APIDOCS "API documentation" OFF)124option(USE_APIDOCS "API documentation" OFF)
150option(USE_GIR "Generate GObject Introspection bindings" OFF)125option(USE_GIR "Generate GObject Introspection bindings" OFF)
151option(EXTRA_WARNINGS "Additional compiler warnings" OFF)126option(EXTRA_WARNINGS "Additional compiler warnings" OFF)
152127
153# GTK+3 is implied here, whether set or not
154if (USE_GRANITE OR HALF_BRO_INCOM_WEBKIT2)
155 set(USE_GTK3 ON)
156endif ()
157
158if (USE_GRANITE)128if (USE_GRANITE)
159 pkg_check_modules(GRANITE granite>=0.2)129 pkg_check_modules(GRANITE granite>=0.2)
160 set(OPTS_INCLUDE_DIRS "${OPTS_INCLUDE_DIRS};${GRANITE_INCLUDE_DIRS}")130 set(OPTS_INCLUDE_DIRS "${OPTS_INCLUDE_DIRS};${GRANITE_INCLUDE_DIRS}")
@@ -178,53 +148,24 @@
178if (WIN32)148if (WIN32)
179 add_definitions("-DGCR_VERSION=\"No\"")149 add_definitions("-DGCR_VERSION=\"No\"")
180else ()150else ()
181 if (USE_GTK3)151 pkg_check_modules(GCR REQUIRED gcr-3>=2.32)
182 pkg_check_modules(GCR REQUIRED gcr-3>=2.32)
183 else ()
184 pkg_check_modules(GCR REQUIRED gcr-base-3>=2.32)
185 endif ()
186 add_definitions("-DGCR_VERSION=\"${GCR_VERSION}\"")152 add_definitions("-DGCR_VERSION=\"${GCR_VERSION}\"")
187 add_definitions("-DHAVE_GCR")153 add_definitions("-DHAVE_GCR")
188 set(OPTS_INCLUDE_DIRS ${OPTS_INCLUDE_DIRS} ${GCR_INCLUDE_DIRS})154 set(OPTS_INCLUDE_DIRS ${OPTS_INCLUDE_DIRS} ${GCR_INCLUDE_DIRS})
189 set(OPTS_LIBRARIES ${OPTS_LIBRARIES} ${GCR_LIBRARIES})155 set(OPTS_LIBRARIES ${OPTS_LIBRARIES} ${GCR_LIBRARIES})
190endif ()156endif ()
191157
192if (HALF_BRO_INCOM_WEBKIT2)158pkg_check_modules(DEPS_GTK REQUIRED
193 pkg_check_modules(DEPS_GTK REQUIRED159 gtk+-3.0>=3.12.0
194 gtk+-3.0>=3.10.0160 webkit2gtk-4.0>=2.3.91
195 webkit2gtk-4.0>=2.3.91161 )
196 )162add_definitions("-DHAVE_WEBKIT2")
197 add_definitions("-DHAVE_WEBKIT2")163add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-3.0_VERSION}\"")
198 add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-3.0_VERSION}\"")164add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkit2gtk-4.0_VERSION}\"")
199 add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkit2gtk-4.0_VERSION}\"")165set(PKGS ${PKGS} gtk+-3.0)
200 set(PKGS ${PKGS} gtk+-3.0)166set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkit2gtk-4.0.vapi")
201 # set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkit2gtk-web-extension-4.0.vapi")167set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2)
202 set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkit2gtk-4.0.vapi")168set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2_3_91)
203 set(VALAFLAGS ${VALAFLAGS} -D HAVE_GTK3)
204 set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2)
205 set(VALAFLAGS ${VALAFLAGS} -D HAVE_WEBKIT2_3_91)
206elseif (USE_GTK3)
207 pkg_check_modules(DEPS_GTK REQUIRED
208 gtk+-3.0>=3.10.0
209 webkitgtk-3.0>=1.8.1
210 javascriptcoregtk-3.0
211 )
212 add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-3.0_VERSION}\"")
213 add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkitgtk-3.0_VERSION}\"")
214 set(PKGS ${PKGS} gtk+-3.0)
215 set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkitgtk-3.0.vapi")
216 set(VALAFLAGS ${VALAFLAGS} -D HAVE_GTK3)
217else ()
218 pkg_check_modules(DEPS_GTK REQUIRED
219 gtk+-2.0>=2.24.0
220 webkit-1.0>=1.8.1
221 javascriptcoregtk-1.0
222 )
223 add_definitions("-DGTK_VERSION=\"${DEPS_GTK_gtk+-2.0_VERSION}\"")
224 add_definitions("-DWEBKIT_VERSION=\"${DEPS_GTK_webkit-1.0_VERSION}\"")
225 set(PKGS ${PKGS} gtk+-2.0)
226 set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkitgtk-3.0.vapi")
227endif ()
228set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/katze/katze.vapi")169set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/katze/katze.vapi")
229170
230# dh_translations detects this if there's no variable used171# dh_translations detects this if there's no variable used
231172
=== modified file 'HACKING'
--- HACKING 2015-08-30 10:19:52 +0000
+++ HACKING 2017-11-26 09:48:19 +0000
@@ -380,4 +380,4 @@
380 * MR: merge request, a branch proposed for review380 * MR: merge request, a branch proposed for review
381 * ninja: an internal tab, usually empty label, used for taking screenshots381 * ninja: an internal tab, usually empty label, used for taking screenshots
382 * fortress: user of an ancient release like 0.4.3 as found on Raspberry Pie, Debian, Ubuntu382 * fortress: user of an ancient release like 0.4.3 as found on Raspberry Pie, Debian, Ubuntu
383 * katze, sokoke, tabby: API names and coincidentally cat breeds
384\ No newline at end of file383\ No newline at end of file
384 * katze, sokoke, tabby: API names and coincidentally cat breeds
385385
=== modified file 'extensions/CMakeLists.txt'
--- extensions/CMakeLists.txt 2015-04-19 14:06:12 +0000
+++ extensions/CMakeLists.txt 2017-11-26 09:48:19 +0000
@@ -13,17 +13,16 @@
13 "${CMAKE_BINARY_DIR}/midori"13 "${CMAKE_BINARY_DIR}/midori"
14 )14 )
15file(GLOB EXTENSIONS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)15file(GLOB EXTENSIONS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
16if (HALF_BRO_INCOM_WEBKIT2)16# FIXME: no support for WebKit2
17 list(REMOVE_ITEM EXTENSIONS17list(REMOVE_ITEM EXTENSIONS
18 "cookie-permissions"18 "cookie-permissions"
19 "addons.c"19 "addons.c"
20 "formhistory"20 "formhistory"
21 "external-download-manager.vala"21 "external-download-manager.vala"
22 "nojs"22 "nojs"
23 "nsplugin-manager.vala"23 "nsplugin-manager.vala"
24 "tabs2one.c"24 "tabs2one.c"
25 )25 )
26endif ()
2726
28# FIXME: re-enable webmedia extension27# FIXME: re-enable webmedia extension
29# once we have working notifications on win28# once we have working notifications on win
@@ -88,7 +87,7 @@
88 )87 )
89 # extensions with vala code get the lenient VALA_CFLAGS88 # extensions with vala code get the lenient VALA_CFLAGS
90 # others get the usual CFLAGS with -Wall and -Werror89 # others get the usual CFLAGS with -Wall and -Werror
91 if (UNIT_FILES_VALA)90 if (UNIT_FILES_VALA)
92 set_target_properties(${UNIT_SRC} PROPERTIES91 set_target_properties(${UNIT_SRC} PROPERTIES
93 COMPILE_FLAGS ${VALA_CFLAGS}92 COMPILE_FLAGS ${VALA_CFLAGS}
94 )93 )
9594
=== modified file 'extensions/about.vala'
--- extensions/about.vala 2015-06-11 22:33:48 +0000
+++ extensions/about.vala 2017-11-26 09:48:19 +0000
@@ -15,11 +15,7 @@
15 public abstract string uri { get; set; }15 public abstract string uri { get; set; }
16 public abstract void get_contents (Midori.View view, string uri);16 public abstract void get_contents (Midori.View view, string uri);
17 protected void load_html (Midori.View view, string content, string uri) {17 protected void load_html (Midori.View view, string content, string uri) {
18 #if HAVE_WEBKIT2 18 view.web_view.load_html (content, uri);
19 view.web_view.load_html (content, uri);
20 #else
21 view.web_view.load_html_string (content, uri);
22 #endif
23 }19 }
24 }20 }
2521
2622
=== modified file 'extensions/adblock/extension.vala'
--- extensions/adblock/extension.vala 2016-02-01 19:48:47 +0000
+++ extensions/adblock/extension.vala 2017-11-26 09:48:19 +0000
@@ -55,7 +55,6 @@
55 internal string? js_hider_function_body;55 internal string? js_hider_function_body;
56#endif56#endif
5757
58#if HAVE_WEBKIT2
59#if !HAVE_WEBKIT2_3_9158#if !HAVE_WEBKIT2_3_91
60 public Extension.WebExtension (WebKit.WebExtension web_extension) {59 public Extension.WebExtension (WebKit.WebExtension web_extension) {
61 init ();60 init ();
@@ -70,7 +69,6 @@
70 return request_handled (request.uri, web_page.uri);69 return request_handled (request.uri, web_page.uri);
71 }70 }
72#endif71#endif
73#endif
7472
75 public Extension () {73 public Extension () {
76 GLib.Object (name: _("Advertisement blocker"),74 GLib.Object (name: _("Advertisement blocker"),
@@ -87,7 +85,6 @@
87 }85 }
8886
89 void extension_activated (Midori.App app) {87 void extension_activated (Midori.App app) {
90#if HAVE_WEBKIT2
91 string cache_dir = Environment.get_user_cache_dir ();88 string cache_dir = Environment.get_user_cache_dir ();
92 string wk2path = Path.build_path (Path.DIR_SEPARATOR_S, cache_dir, "wk2ext");89 string wk2path = Path.build_path (Path.DIR_SEPARATOR_S, cache_dir, "wk2ext");
93 Midori.Paths.mkdir_with_parents (wk2path);90 Midori.Paths.mkdir_with_parents (wk2path);
@@ -101,7 +98,6 @@
101 } catch (Error error) {98 } catch (Error error) {
102 critical ("Failed to create WebKit2 link: %s", error.message);99 critical ("Failed to create WebKit2 link: %s", error.message);
103 }100 }
104#endif
105 init ();101 init ();
106 foreach (var browser in app.get_browsers ())102 foreach (var browser in app.get_browsers ())
107 browser_added (browser);103 browser_added (browser);
@@ -136,17 +132,11 @@
136132
137 void tab_added (Midori.View view) {133 void tab_added (Midori.View view) {
138 view.navigation_requested.connect (navigation_requested);134 view.navigation_requested.connect (navigation_requested);
139#if !HAVE_WEBKIT2
140 view.web_view.resource_request_starting.connect (resource_requested);
141#endif
142 view.notify["load-status"].connect (load_status_changed);135 view.notify["load-status"].connect (load_status_changed);
143 view.context_menu.connect (context_menu);136 view.context_menu.connect (context_menu);
144 }137 }
145138
146 void tab_removed (Midori.View view) {139 void tab_removed (Midori.View view) {
147#if !HAVE_WEBKIT2
148 view.web_view.resource_request_starting.disconnect (resource_requested);
149#endif
150 view.navigation_requested.disconnect (navigation_requested);140 view.navigation_requested.disconnect (navigation_requested);
151 view.notify["load-status"].disconnect (load_status_changed);141 view.notify["load-status"].disconnect (load_status_changed);
152 view.context_menu.disconnect (context_menu);142 view.context_menu.disconnect (context_menu);
@@ -179,23 +169,6 @@
179 menu.add (action);169 menu.add (action);
180 }170 }
181171
182#if !HAVE_WEBKIT2
183 void resource_requested (WebKit.WebView web_view, WebKit.WebFrame frame,
184 WebKit.WebResource resource, WebKit.NetworkRequest request, WebKit.NetworkResponse? response) {
185
186 WebKit.WebFrame main_frame = web_view.get_main_frame ();
187
188 WebKit.WebDataSource? ds = main_frame.get_provisional_data_source ();
189 WebKit.NetworkRequest? main_frame_request = (ds != null) ? ds.get_request () : null;
190 string? main_frame_uri = (main_frame_request != null) ? main_frame_request.uri : null;
191
192 bool is_main_frame_request = (frame == main_frame) && (request.uri == main_frame_uri);
193 if (!is_main_frame_request && request_handled (request.uri, web_view.uri)) {
194 request.set_uri ("about:blank");
195 }
196 }
197#endif
198
199 bool navigation_requested (Midori.Tab tab, string uri) {172 bool navigation_requested (Midori.Tab tab, string uri) {
200 if (uri.has_prefix ("abp:")) {173 if (uri.has_prefix ("abp:")) {
201 string parsed_uri = parse_subscription_uri (uri);174 string parsed_uri = parse_subscription_uri (uri);
@@ -375,12 +348,8 @@
375 }348 }
376349
377 void load_config () {350 void load_config () {
378#if HAVE_WEBKIT2
379 string config_dir = Path.build_filename (GLib.Environment.get_user_config_dir (), PACKAGE_NAME, "extensions", "libadblock." + GLib.Module.SUFFIX);351 string config_dir = Path.build_filename (GLib.Environment.get_user_config_dir (), PACKAGE_NAME, "extensions", "libadblock." + GLib.Module.SUFFIX);
380 Midori.Paths.mkdir_with_parents (config_dir);352 Midori.Paths.mkdir_with_parents (config_dir);
381#else
382 string config_dir = Midori.Paths.get_extension_config_dir ("adblock");
383#endif
384 string presets = Midori.Paths.get_extension_preset_filename ("adblock", "config");353 string presets = Midori.Paths.get_extension_preset_filename ("adblock", "config");
385 string filename = Path.build_filename (config_dir, "config");354 string filename = Path.build_filename (config_dir, "config");
386 config = new Config (filename, presets);355 config = new Config (filename, presets);
@@ -482,14 +451,12 @@
482 }451 }
483}452}
484453
485#if HAVE_WEBKIT2
486#if !HAVE_WEBKIT2_3_91454#if !HAVE_WEBKIT2_3_91
487Adblock.Extension? filter;455Adblock.Extension? filter;
488public static void webkit_web_extension_initialize (WebKit.WebExtension web_extension) {456public static void webkit_web_extension_initialize (WebKit.WebExtension web_extension) {
489 filter = new Adblock.Extension.WebExtension (web_extension);457 filter = new Adblock.Extension.WebExtension (web_extension);
490}458}
491#endif459#endif
492#endif
493460
494public Midori.Extension extension_init () {461public Midori.Extension extension_init () {
495 return new Adblock.Extension ();462 return new Adblock.Extension ();
496463
=== modified file 'extensions/adblock/widgets.vala'
--- extensions/adblock/widgets.vala 2015-08-09 20:44:57 +0000
+++ extensions/adblock/widgets.vala 2017-11-26 09:48:19 +0000
@@ -95,15 +95,10 @@
95 public void add_subscription (string? uri) {95 public void add_subscription (string? uri) {
96 var dialog = new Gtk.Dialog.with_buttons (_("Configure Advertisement filters"),96 var dialog = new Gtk.Dialog.with_buttons (_("Configure Advertisement filters"),
97 null,97 null,
98#if !HAVE_GTK3
99 Gtk.DialogFlags.NO_SEPARATOR |
100#endif
101 Gtk.DialogFlags.DESTROY_WITH_PARENT,98 Gtk.DialogFlags.DESTROY_WITH_PARENT,
102 Gtk.STOCK_HELP, Gtk.ResponseType.HELP,99 Gtk.STOCK_HELP, Gtk.ResponseType.HELP,
103 Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE);100 Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE);
104#if HAVE_GTK3
105 dialog.get_widget_for_response (Gtk.ResponseType.HELP).get_style_context ().add_class ("help_button");101 dialog.get_widget_for_response (Gtk.ResponseType.HELP).get_style_context ().add_class ("help_button");
106#endif
107 dialog.set_icon_name (Gtk.STOCK_PROPERTIES);102 dialog.set_icon_name (Gtk.STOCK_PROPERTIES);
108 dialog.set_response_sensitive (Gtk.ResponseType.HELP, false);103 dialog.set_response_sensitive (Gtk.ResponseType.HELP, false);
109104
@@ -254,9 +249,6 @@
254 public void show () {249 public void show () {
255 this.dialog = new Gtk.Dialog.with_buttons (_("Edit rule"),250 this.dialog = new Gtk.Dialog.with_buttons (_("Edit rule"),
256 null,251 null,
257#if !HAVE_GTK3
258 Gtk.DialogFlags.NO_SEPARATOR |
259#endif
260 Gtk.DialogFlags.DESTROY_WITH_PARENT,252 Gtk.DialogFlags.DESTROY_WITH_PARENT,
261 Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,253 Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
262 Gtk.STOCK_ADD, Gtk.ResponseType.ACCEPT);254 Gtk.STOCK_ADD, Gtk.ResponseType.ACCEPT);
263255
=== modified file 'extensions/colorful-tabs.c'
--- extensions/colorful-tabs.c 2016-02-24 21:45:09 +0000
+++ extensions/colorful-tabs.c 2017-11-26 09:48:19 +0000
@@ -244,11 +244,6 @@
244void244void
245extension_test (void)245extension_test (void)
246{246{
247 #ifndef HAVE_WEBKIT2
248 g_object_set_data (G_OBJECT (webkit_get_default_session ()),
249 "midori-session-initialized", (void*)1);
250 #endif
251
252 /* TODO: Add test which uses favicon codepath */247 /* TODO: Add test which uses favicon codepath */
253248
254 g_test_add_func ("/extensions/colorful_tabs/hostname_colour", test_colour_for_hostname);249 g_test_add_func ("/extensions/colorful_tabs/hostname_colour", test_colour_for_hostname);
255250
=== modified file 'extensions/cookie-manager/cookie-manager.c'
--- extensions/cookie-manager/cookie-manager.c 2013-07-29 21:05:02 +0000
+++ extensions/cookie-manager/cookie-manager.c 2017-11-26 09:48:19 +0000
@@ -280,15 +280,9 @@
280 COOKIE_MANAGER_COL_NAME, GTK_SORT_ASCENDING);280 COOKIE_MANAGER_COL_NAME, GTK_SORT_ASCENDING);
281281
282 /* setup soup */282 /* setup soup */
283#ifdef HAVE_WEBKIT2
284 gchar *filename = midori_paths_get_config_filename_for_writing ("cookies.db");283 gchar *filename = midori_paths_get_config_filename_for_writing ("cookies.db");
285 priv->jar = soup_cookie_jar_sqlite_new (filename, FALSE);284 priv->jar = soup_cookie_jar_sqlite_new (filename, FALSE);
286 g_free(filename);285 g_free(filename);
287#else
288 SoupSession *session = webkit_get_default_session();
289 priv->jar = SOUP_COOKIE_JAR(soup_session_get_feature(session, soup_cookie_jar_get_type()));
290 g_object_ref(priv->jar);
291#endif
292 g_signal_connect(priv->jar, "changed", G_CALLBACK(cookie_manager_jar_changed_cb), self);286 g_signal_connect(priv->jar, "changed", G_CALLBACK(cookie_manager_jar_changed_cb), self);
293287
294 cookie_manager_refresh_store(self);288 cookie_manager_refresh_store(self);
295289
=== modified file 'extensions/cookie-permissions/cookie-permission-manager-preferences-window.c'
--- extensions/cookie-permissions/cookie-permission-manager-preferences-window.c 2014-01-01 22:39:30 +0000
+++ extensions/cookie-permissions/cookie-permission-manager-preferences-window.c 2017-11-26 09:48:19 +0000
@@ -735,12 +735,8 @@
735735
736 /* Get content area to add gui controls to */736 /* Get content area to add gui controls to */
737 priv->contentArea=gtk_dialog_get_content_area(GTK_DIALOG(self));737 priv->contentArea=gtk_dialog_get_content_area(GTK_DIALOG(self));
738#ifdef HAVE_GTK3
739 vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);738 vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
740 gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);739 gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
741#else
742 vbox=gtk_vbox_new(FALSE, 0);
743#endif
744740
745 /* Set up dialog */741 /* Set up dialog */
746 dialogTitle=_("Configure cookie permission");742 dialogTitle=_("Configure cookie permission");
@@ -786,12 +782,8 @@
786 gtk_tree_sortable_set_sort_column_id(sortableList, DOMAIN_COLUMN, GTK_SORT_ASCENDING);782 gtk_tree_sortable_set_sort_column_id(sortableList, DOMAIN_COLUMN, GTK_SORT_ASCENDING);
787783
788 /* Set up domain addition widgets */784 /* Set up domain addition widgets */
789#ifdef HAVE_GTK3
790 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);785 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
791 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);786 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
792#else
793 hbox=gtk_hbox_new(FALSE, 0);
794#endif
795787
796 priv->addDomainEntry=gtk_entry_new();788 priv->addDomainEntry=gtk_entry_new();
797 gtk_entry_set_max_length(GTK_ENTRY(priv->addDomainEntry), 64);789 gtk_entry_set_max_length(GTK_ENTRY(priv->addDomainEntry), 64);
@@ -824,10 +816,6 @@
824 /* Set up cookie domain list */816 /* Set up cookie domain list */
825 priv->list=gtk_tree_view_new_with_model(GTK_TREE_MODEL(priv->listStore));817 priv->list=gtk_tree_view_new_with_model(GTK_TREE_MODEL(priv->listStore));
826818
827#ifndef HAVE_GTK3
828 gtk_widget_set_size_request(priv->list, -1, 300);
829#endif
830
831 priv->listSelection=gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->list));819 priv->listSelection=gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->list));
832 gtk_tree_selection_set_mode(priv->listSelection, GTK_SELECTION_MULTIPLE);820 gtk_tree_selection_set_mode(priv->listSelection, GTK_SELECTION_MULTIPLE);
833 g_signal_connect_swapped(priv->listSelection, "changed", G_CALLBACK(_cookie_permission_manager_preferences_changed_selection), self);821 g_signal_connect_swapped(priv->listSelection, "changed", G_CALLBACK(_cookie_permission_manager_preferences_changed_selection), self);
@@ -853,21 +841,15 @@
853 gtk_tree_view_append_column(GTK_TREE_VIEW(priv->list), column);841 gtk_tree_view_append_column(GTK_TREE_VIEW(priv->list), column);
854842
855 scrolled=gtk_scrolled_window_new(NULL, NULL);843 scrolled=gtk_scrolled_window_new(NULL, NULL);
856#ifdef HAVE_GTK3
857 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), height*10);844 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), height*10);
858#endif
859 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);845 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
860 gtk_container_add(GTK_CONTAINER(scrolled), priv->list);846 gtk_container_add(GTK_CONTAINER(scrolled), priv->list);
861 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);847 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
862 gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 5);848 gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 5);
863849
864 /* Set up cookie domain list management buttons */850 /* Set up cookie domain list management buttons */
865#ifdef HAVE_GTK3
866 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);851 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
867 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);852 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
868#else
869 hbox=gtk_hbox_new(FALSE, 0);
870#endif
871853
872 priv->deleteButton=gtk_button_new_from_stock(GTK_STOCK_DELETE);854 priv->deleteButton=gtk_button_new_from_stock(GTK_STOCK_DELETE);
873 gtk_widget_set_sensitive(priv->deleteButton, FALSE);855 gtk_widget_set_sensitive(priv->deleteButton, FALSE);
@@ -883,12 +865,8 @@
883 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 5);865 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 5);
884866
885 /* Add "unknown-policy" combo */867 /* Add "unknown-policy" combo */
886#ifdef HAVE_GTK3
887 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);868 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
888 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);869 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
889#else
890 hbox=gtk_hbox_new(FALSE, 0);
891#endif
892 widget=gtk_label_new(_("Policy for cookies from domains not in the list: "));870 widget=gtk_label_new(_("Policy for cookies from domains not in the list: "));
893 gtk_container_add(GTK_CONTAINER(hbox), widget);871 gtk_container_add(GTK_CONTAINER(hbox), widget);
894 872
895873
=== modified file 'extensions/cookie-permissions/cookie-permission-manager.c'
--- extensions/cookie-permissions/cookie-permission-manager.c 2014-06-14 03:40:37 +0000
+++ extensions/cookie-permissions/cookie-permission-manager.c 2017-11-26 09:48:19 +0000
@@ -219,7 +219,6 @@
219 gchar *domain=(gchar*)sqlite3_column_text(statement, 0);219 gchar *domain=(gchar*)sqlite3_column_text(statement, 0);
220 GSList *cookies, *cookie;220 GSList *cookies, *cookie;
221221
222#ifdef HAVE_LIBSOUP_2_40_0
223 SoupURI *uri;222 SoupURI *uri;
224223
225 uri=soup_uri_new(NULL);224 uri=soup_uri_new(NULL);
@@ -232,17 +231,6 @@
232 }231 }
233 soup_cookies_free(cookies);232 soup_cookies_free(cookies);
234 soup_uri_free(uri);233 soup_uri_free(uri);
235#else
236 cookies=soup_cookie_jar_all_cookies(priv->cookieJar);
237 for(cookie=cookies; cookie; cookie=cookie->next)
238 {
239 if(soup_cookie_domain_matches((SoupCookie*)cookie->data, domain))
240 {
241 soup_cookie_jar_delete_cookie(priv->cookieJar, (SoupCookie*)cookie->data);
242 }
243 }
244 soup_cookies_free(cookies);
245#endif
246 }234 }
247 }235 }
248 else g_warning(_("SQL fails: %s"), sqlite3_errmsg(priv->database));236 else g_warning(_("SQL fails: %s"), sqlite3_errmsg(priv->database));
@@ -545,9 +533,6 @@
545533
546 /* Create list and set up columns of list */534 /* Create list and set up columns of list */
547 list=gtk_tree_view_new_with_model(GTK_TREE_MODEL(listStore));535 list=gtk_tree_view_new_with_model(GTK_TREE_MODEL(listStore));
548#ifndef HAVE_GTK3
549 gtk_widget_set_size_request(list, -1, 100);
550#endif
551536
552 renderer=gtk_cell_renderer_text_new();537 renderer=gtk_cell_renderer_text_new();
553 column=gtk_tree_view_column_new_with_attributes(_("Domain"),538 column=gtk_tree_view_column_new_with_attributes(_("Domain"),
@@ -589,9 +574,7 @@
589 gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);574 gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
590575
591 scrolled=gtk_scrolled_window_new(NULL, NULL);576 scrolled=gtk_scrolled_window_new(NULL, NULL);
592#ifdef HAVE_GTK3
593 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), 100);577 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), 100);
594#endif
595 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);578 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
596 gtk_container_add(GTK_CONTAINER(scrolled), list);579 gtk_container_add(GTK_CONTAINER(scrolled), list);
597 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);580 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
598581
=== modified file 'extensions/external-download-manager.vala'
--- extensions/external-download-manager.vala 2015-08-20 06:18:50 +0000
+++ extensions/external-download-manager.vala 2017-11-26 09:48:19 +0000
@@ -35,16 +35,8 @@
3535
36 if (download_type == Midori.DownloadType.SAVE) {36 if (download_type == Midori.DownloadType.SAVE) {
37 var dlReq = new DownloadRequest ();37 var dlReq = new DownloadRequest ();
38
39 #if HAVE_WEBKIT2
40 dlReq.uri = download.request.get_uri ();38 dlReq.uri = download.request.get_uri ();
41 weak Soup.MessageHeaders headers = download.request.get_http_headers ();39 weak Soup.MessageHeaders headers = download.request.get_http_headers ();
42 #else
43 dlReq.uri = download.get_uri ();
44 var request = download.get_network_request ();
45 var message = request.get_message ();
46 weak Soup.MessageHeaders headers = message.request_headers;
47 #endif
4840
49 dlReq.auth = headers.get ("Authorization");41 dlReq.auth = headers.get ("Authorization");
50 dlReq.referer = headers.get ("Referer");42 dlReq.referer = headers.get ("Referer");
@@ -101,11 +93,7 @@
101 }93 }
10294
103 construct {95 construct {
104 #if HAVE_WEBKIT2
105 var session= new Session ();96 var session= new Session ();
106 #else
107 var session = WebKit.get_default_session ();
108 #endif
109 this.cookie_jar = session.get_feature (typeof (Soup.CookieJar)) as Soup.CookieJar;97 this.cookie_jar = session.get_feature (typeof (Soup.CookieJar)) as Soup.CookieJar;
110 }98 }
111 }99 }
@@ -271,14 +259,9 @@
271 this.input.set_text (this.commandline.get_string ("commandline"));259 this.input.set_text (this.commandline.get_string ("commandline"));
272260
273261
274#if HAVE_GTK3
275 Gtk.Box vbox = get_content_area () as Gtk.Box;262 Gtk.Box vbox = get_content_area () as Gtk.Box;
276 vbox.pack_start (text, false, false, 0);263 vbox.pack_start (text, false, false, 0);
277 vbox.pack_start (this.input, false, true, 0);264 vbox.pack_start (this.input, false, true, 0);
278#else
279 this.vbox.pack_start (text, false, false, 0);
280 this.vbox.pack_start (this.input, false, true, 0);
281#endif
282265
283 this.add_button (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);266 this.add_button (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);
284 this.add_button (Gtk.STOCK_APPLY, Gtk.ResponseType.APPLY);267 this.add_button (Gtk.STOCK_APPLY, Gtk.ResponseType.APPLY);
285268
=== modified file 'extensions/feed-panel/feed-panel.c'
--- extensions/feed-panel/feed-panel.c 2013-10-25 21:49:56 +0000
+++ extensions/feed-panel/feed-panel.c 2017-11-26 09:48:19 +0000
@@ -84,10 +84,10 @@
84 if ((uri = katze_item_get_uri (pitem)))84 if ((uri = katze_item_get_uri (pitem)))
85 {85 {
86 if (!(pixbuf = midori_paths_get_icon (uri, NULL)))86 if (!(pixbuf = midori_paths_get_icon (uri, NULL)))
87 pixbuf = gtk_widget_render_icon (panel->treeview, STOCK_NEWS_FEED, GTK_ICON_SIZE_MENU, NULL);87 pixbuf = gtk_widget_render_icon_pixbuf (panel->treeview, STOCK_NEWS_FEED, GTK_ICON_SIZE_MENU);
88 }88 }
89 else89 else
90 pixbuf = gtk_widget_render_icon (panel->treeview, GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_MENU, NULL);90 pixbuf = gtk_widget_render_icon_pixbuf (panel->treeview, GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_MENU);
9191
92 g_object_set (renderer, "pixbuf", pixbuf, NULL);92 g_object_set (renderer, "pixbuf", pixbuf, NULL);
9393
@@ -800,12 +800,8 @@
800 NULL);800 NULL);
801 gtk_widget_show (treeview);801 gtk_widget_show (treeview);
802802
803#if GTK_CHECK_VERSION(3,0,0)
804 font_desc = (PangoFontDescription*)gtk_style_context_get_font (803 font_desc = (PangoFontDescription*)gtk_style_context_get_font (
805 gtk_widget_get_style_context (treeview), GTK_STATE_FLAG_NORMAL);804 gtk_widget_get_style_context (treeview), GTK_STATE_FLAG_NORMAL);
806#else
807 font_desc = treeview->style->font_desc;
808#endif
809 family = pango_font_description_get_family (font_desc);805 family = pango_font_description_get_family (font_desc);
810 size = pango_font_description_get_size (font_desc) / PANGO_SCALE;806 size = pango_font_description_get_size (font_desc) / PANGO_SCALE;
811 settings = midori_web_settings_new ();807 settings = midori_web_settings_new ();
812808
=== modified file 'extensions/feed-panel/main.c'
--- extensions/feed-panel/main.c 2013-08-12 19:21:06 +0000
+++ extensions/feed-panel/main.c 2017-11-26 09:48:19 +0000
@@ -348,7 +348,7 @@
348348
349 dialog = gtk_dialog_new_with_buttons (349 dialog = gtk_dialog_new_with_buttons (
350 _("New feed"), GTK_WINDOW (priv->browser),350 _("New feed"), GTK_WINDOW (priv->browser),
351 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,351 GTK_DIALOG_DESTROY_WITH_PARENT,
352 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,352 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
353 GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,353 GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
354 NULL);354 NULL);
355355
=== modified file 'extensions/formhistory/formhistory.c'
--- extensions/formhistory/formhistory.c 2013-11-26 19:08:06 +0000
+++ extensions/formhistory/formhistory.c 2017-11-26 09:48:19 +0000
@@ -99,7 +99,7 @@
99 alive = 1;99 alive = 1;
100 title = _("Form history");100 title = _("Form history");
101 dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parent),101 dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parent),
102 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,102 GTK_DIALOG_DESTROY_WITH_PARENT,
103 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,103 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
104 GTK_STOCK_OK, GTK_RESPONSE_OK,104 GTK_STOCK_OK, GTK_RESPONSE_OK,
105 NULL);105 NULL);
106106
=== modified file 'extensions/history-list.vala'
--- extensions/history-list.vala 2015-03-20 16:24:07 +0000
+++ extensions/history-list.vala 2017-11-26 09:48:19 +0000
@@ -102,12 +102,8 @@
102 Gtk.Requisition requisition;102 Gtk.Requisition requisition;
103 int height;103 int height;
104 int max_lines = 10;104 int max_lines = 10;
105#if HAVE_GTK3
106 requisition = Gtk.Requisition();105 requisition = Gtk.Requisition();
107 this.treeview.get_preferred_size(out requisition, null);106 this.treeview.get_preferred_size(out requisition, null);
108#else
109 this.treeview.size_request (out requisition);
110#endif
111 Gtk.ListStore model = this.treeview.get_model () as Gtk.ListStore;107 Gtk.ListStore model = this.treeview.get_model () as Gtk.ListStore;
112 int length = model.iter_n_children(null);108 int length = model.iter_n_children(null);
113 if (length > max_lines) {109 if (length > max_lines) {
@@ -212,12 +208,6 @@
212208
213 model.get_iter (out iter, path);209 model.get_iter (out iter, path);
214 model.get (iter, TabTreeCells.TREE_CELL_POINTER, out view);210 model.get (iter, TabTreeCells.TREE_CELL_POINTER, out view);
215#if !HAVE_GTK3
216 /* removing the selected cursor causes a segfault when using GTK2 */
217 if (path.prev () == false)
218 path.next ();
219 this.treeview.set_cursor (path, column, false);
220#endif
221211
222 /*212 /*
223 FixMe: the retrun value of `Gtk.ListStore.remove` should be checked213 FixMe: the retrun value of `Gtk.ListStore.remove` should be checked
@@ -359,11 +349,7 @@
359 table.attach_defaults (proxy, 0, 2, 1, 2);349 table.attach_defaults (proxy, 0, 2, 1, 2);
360#endif350#endif
361351
362#if HAVE_GTK3
363 (get_content_area() as Gtk.Box).pack_start (table, false, true, 0);352 (get_content_area() as Gtk.Box).pack_start (table, false, true, 0);
364#else
365 this.vbox.pack_start (table, false, true, 0);
366#endif
367353
368 this.add_button (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);354 this.add_button (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);
369 this.add_button (Gtk.STOCK_APPLY, Gtk.ResponseType.APPLY);355 this.add_button (Gtk.STOCK_APPLY, Gtk.ResponseType.APPLY);
370356
=== modified file 'extensions/nojs/nojs-preferences.c'
--- extensions/nojs/nojs-preferences.c 2014-05-09 14:47:53 +0000
+++ extensions/nojs/nojs-preferences.c 2017-11-26 09:48:19 +0000
@@ -839,12 +839,8 @@
839839
840 /* Get content area to add gui controls to */840 /* Get content area to add gui controls to */
841 priv->contentArea=gtk_dialog_get_content_area(GTK_DIALOG(self));841 priv->contentArea=gtk_dialog_get_content_area(GTK_DIALOG(self));
842#if GTK_CHECK_VERSION (3, 0, 0)
843 vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);842 vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
844 gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);843 gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
845#else
846 vbox=gtk_vbox_new(FALSE, 0);
847#endif
848844
849 /* Set up dialog */845 /* Set up dialog */
850 dialogTitle=_("Configure NoJS");846 dialogTitle=_("Configure NoJS");
@@ -887,12 +883,8 @@
887 gtk_tree_sortable_set_sort_column_id(sortableList, DOMAIN_COLUMN, GTK_SORT_ASCENDING);883 gtk_tree_sortable_set_sort_column_id(sortableList, DOMAIN_COLUMN, GTK_SORT_ASCENDING);
888884
889 /* Set up domain addition widgets */885 /* Set up domain addition widgets */
890#ifdef HAVE_GTK3
891 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);886 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
892 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);887 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
893#else
894 hbox=gtk_hbox_new(FALSE, 0);
895#endif
896888
897 priv->addDomainEntry=gtk_entry_new();889 priv->addDomainEntry=gtk_entry_new();
898 gtk_entry_set_max_length(GTK_ENTRY(priv->addDomainEntry), 64);890 gtk_entry_set_max_length(GTK_ENTRY(priv->addDomainEntry), 64);
@@ -925,10 +917,6 @@
925 /* Set up domain list view */917 /* Set up domain list view */
926 priv->list=gtk_tree_view_new_with_model(GTK_TREE_MODEL(priv->listStore));918 priv->list=gtk_tree_view_new_with_model(GTK_TREE_MODEL(priv->listStore));
927919
928#if !GTK_CHECK_VERSION (3, 0, 0)
929 gtk_widget_set_size_request(priv->list, -1, 300);
930#endif
931
932 priv->listSelection=gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->list));920 priv->listSelection=gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->list));
933 gtk_tree_selection_set_mode(priv->listSelection, GTK_SELECTION_MULTIPLE);921 gtk_tree_selection_set_mode(priv->listSelection, GTK_SELECTION_MULTIPLE);
934 g_signal_connect_swapped(priv->listSelection, "changed", G_CALLBACK(_nojs_preferences_changed_selection), self);922 g_signal_connect_swapped(priv->listSelection, "changed", G_CALLBACK(_nojs_preferences_changed_selection), self);
@@ -954,21 +942,15 @@
954 gtk_tree_view_append_column(GTK_TREE_VIEW(priv->list), column);942 gtk_tree_view_append_column(GTK_TREE_VIEW(priv->list), column);
955943
956 scrolled=gtk_scrolled_window_new(NULL, NULL);944 scrolled=gtk_scrolled_window_new(NULL, NULL);
957#if GTK_CHECK_VERSION (3, 0, 0)
958 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), height*10);945 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), height*10);
959#endif
960 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);946 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
961 gtk_container_add(GTK_CONTAINER(scrolled), priv->list);947 gtk_container_add(GTK_CONTAINER(scrolled), priv->list);
962 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);948 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
963 gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 5);949 gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 5);
964950
965 /* Set up JavaScript domain list management buttons */951 /* Set up JavaScript domain list management buttons */
966#if GTK_CHECK_VERSION (3, 0, 0)
967 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);952 hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
968 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);953 gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
969#else
970 hbox=gtk_hbox_new(FALSE, 0);
971#endif
972954
973 priv->deleteButton=gtk_button_new_from_stock(GTK_STOCK_DELETE);955 priv->deleteButton=gtk_button_new_from_stock(GTK_STOCK_DELETE);
974 gtk_widget_set_sensitive(priv->deleteButton, FALSE);956 gtk_widget_set_sensitive(priv->deleteButton, FALSE);
975957
=== modified file 'extensions/open-with.vala'
--- extensions/open-with.vala 2016-02-17 20:26:51 +0000
+++ extensions/open-with.vala 2017-11-26 09:48:19 +0000
@@ -157,9 +157,6 @@
157 transient_for = browser;157 transient_for = browser;
158158
159 title = _("Custom…");159 title = _("Custom…");
160#if !HAVE_GTK3
161 has_separator = false;
162#endif
163 destroy_with_parent = true;160 destroy_with_parent = true;
164 set_icon_name (Gtk.STOCK_OPEN);161 set_icon_name (Gtk.STOCK_OPEN);
165 resizable = false;162 resizable = false;
@@ -370,9 +367,6 @@
370 transient_for = browser;367 transient_for = browser;
371368
372 title = _("Choose application");369 title = _("Choose application");
373#if !HAVE_GTK3
374 has_separator = false;
375#endif
376 destroy_with_parent = true;370 destroy_with_parent = true;
377 set_icon_name (Gtk.STOCK_OPEN);371 set_icon_name (Gtk.STOCK_OPEN);
378 resizable = true;372 resizable = true;
@@ -393,11 +387,7 @@
393 get_content_area ().show_all ();387 get_content_area ().show_all ();
394388
395 Gtk.Requisition req;389 Gtk.Requisition req;
396#if HAVE_GTK3
397 get_content_area ().get_preferred_size (null, out req);390 get_content_area ().get_preferred_size (null, out req);
398#else
399 get_content_area ().size_request (out req);
400#endif
401 (this as Gtk.Window).set_default_size (req.width*2, req.height*3/2);391 (this as Gtk.Window).set_default_size (req.width*2, req.height*3/2);
402392
403 set_default_response (Gtk.ResponseType.ACCEPT);393 set_default_response (Gtk.ResponseType.ACCEPT);
@@ -558,9 +548,7 @@
558 renderer.set ("markup",548 renderer.set ("markup",
559 Markup.printf_escaped ("<b>%s</b>\n%s",549 Markup.printf_escaped ("<b>%s</b>\n%s",
560 desc, mime_type),550 desc, mime_type),
561#if HAVE_GTK3
562 "max-width-chars", 30,551 "max-width-chars", 30,
563#endif
564 "width-chars", 30,552 "width-chars", 30,
565 "ellipsize", Pango.EllipsizeMode.END);553 "ellipsize", Pango.EllipsizeMode.END);
566 }554 }
@@ -582,9 +570,7 @@
582 AppInfo app_info;570 AppInfo app_info;
583 model.get (iter, 1, out app_info);571 model.get (iter, 1, out app_info);
584 renderer.set ("markup", describe_app_info (app_info),572 renderer.set ("markup", describe_app_info (app_info),
585#if HAVE_GTK3
586 "max-width-chars", 30,573 "max-width-chars", 30,
587#endif
588 "width-chars", 30,574 "width-chars", 30,
589 "ellipsize", Pango.EllipsizeMode.END);575 "ellipsize", Pango.EllipsizeMode.END);
590 }576 }
591577
=== modified file 'extensions/shortcuts.c'
--- extensions/shortcuts.c 2013-03-23 01:37:12 +0000
+++ extensions/shortcuts.c 2017-11-26 09:48:19 +0000
@@ -167,7 +167,7 @@
167167
168 dialog_title = _("Customize Keyboard shortcuts");168 dialog_title = _("Customize Keyboard shortcuts");
169 dialog = gtk_dialog_new_with_buttons (dialog_title, GTK_WINDOW (browser),169 dialog = gtk_dialog_new_with_buttons (dialog_title, GTK_WINDOW (browser),
170 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,170 GTK_DIALOG_DESTROY_WITH_PARENT,
171 #if !HAVE_OSX171 #if !HAVE_OSX
172 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,172 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
173 #endif173 #endif
174174
=== modified file 'extensions/tabby.vala'
--- extensions/tabby.vala 2015-06-23 19:25:13 +0000
+++ extensions/tabby.vala 2017-11-26 09:48:19 +0000
@@ -236,11 +236,7 @@
236 }236 }
237 }237 }
238238
239#if HAVE_GTK3
240 protected bool delete_event (Gtk.Widget widget, Gdk.EventAny event) {239 protected bool delete_event (Gtk.Widget widget, Gdk.EventAny event) {
241#else
242 protected bool delete_event (Gtk.Widget widget, Gdk.Event event) {
243#endif
244240
245 this.close ();241 this.close ();
246 return false;242 return false;
247243
=== modified file 'extensions/transfers.vala'
--- extensions/transfers.vala 2017-02-15 18:50:47 +0000
+++ extensions/transfers.vala 2017-11-26 09:48:19 +0000
@@ -9,10 +9,6 @@
9 See the file COPYING for the full license text.9 See the file COPYING for the full license text.
10*/10*/
1111
12namespace Gtk {
13 extern static void widget_size_request (Gtk.Widget widget, out Gtk.Requisition requisition);
14}
15
16namespace Sokoke {12namespace Sokoke {
17 extern static void widget_get_text_size (Gtk.Widget widget, string sample, out int width, out int height);13 extern static void widget_get_text_size (Gtk.Widget widget, string sample, out int width, out int height);
18}14}
@@ -328,9 +324,7 @@
328324
329 var box = new Gtk.HBox (false, 0);325 var box = new Gtk.HBox (false, 0);
330 progress = new Gtk.ProgressBar ();326 progress = new Gtk.ProgressBar ();
331#if HAVE_GTK3
332 progress.show_text = true;327 progress.show_text = true;
333#endif
334 progress.ellipsize = Pango.EllipsizeMode.MIDDLE;328 progress.ellipsize = Pango.EllipsizeMode.MIDDLE;
335 string filename = Midori.Download.get_basename_for_display (transfer.destination);329 string filename = Midori.Download.get_basename_for_display (transfer.destination);
336 progress.text = filename;330 progress.text = filename;
@@ -418,7 +412,7 @@
418 show ();412 show ();
419413
420 Gtk.Requisition req;414 Gtk.Requisition req;
421 Gtk.widget_size_request (parent, out req);415 parent.get_preferred_size (out req, null);
422 int reqwidth = req.width;416 int reqwidth = req.width;
423 int winwidth;417 int winwidth;
424 (get_toplevel () as Gtk.Window).get_size (out winwidth, null);418 (get_toplevel () as Gtk.Window).get_size (out winwidth, null);
@@ -501,11 +495,7 @@
501 transfer.removed ();495 transfer.removed ();
502 }496 }
503497
504#if HAVE_GTK3
505 bool browser_closed (Gtk.Widget widget, Gdk.EventAny event) {498 bool browser_closed (Gtk.Widget widget, Gdk.EventAny event) {
506#else
507 bool browser_closed (Gtk.Widget widget, Gdk.Event event) {
508#endif
509 var browser = widget as Midori.Browser;499 var browser = widget as Midori.Browser;
510 if (pending_transfers (array)) {500 if (pending_transfers (array)) {
511 var dialog = new Gtk.MessageDialog (browser,501 var dialog = new Gtk.MessageDialog (browser,
@@ -531,11 +521,7 @@
531 browser.panel.append_page (viewable);521 browser.panel.append_page (viewable);
532 widgets.append (viewable);522 widgets.append (viewable);
533 var toolbar = new Toolbar (array);523 var toolbar = new Toolbar (array);
534#if HAVE_GTK3
535 browser.statusbar.pack_end (toolbar, false, false);524 browser.statusbar.pack_end (toolbar, false, false);
536#else
537 browser.statusbar.pack_start (toolbar, false, false);
538#endif
539 widgets.append (toolbar);525 widgets.append (toolbar);
540 // TODO: popover526 // TODO: popover
541 // TODO: progress in dock item527 // TODO: progress in dock item
542528
=== removed file 'katze/gtk3-compat.c'
--- katze/gtk3-compat.c 2015-08-10 23:42:56 +0000
+++ katze/gtk3-compat.c 1970-01-01 00:00:00 +0000
@@ -1,243 +0,0 @@
1/*
2 Copyright (C) 2011-2012 Christian Dywan <christian@twotoasts.de>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 See the file COPYING for the full license text.
10*/
11
12#include "katze/gtk3-compat.h"
13
14#if !GTK_CHECK_VERSION (3, 2, 0)
15static void
16sokoke_widget_set_pango_font_style (GtkWidget* widget,
17 PangoStyle style)
18{
19 /* Conveniently change the pango font style
20 For some reason we need to reset if we actually want the normal style */
21 if (style == PANGO_STYLE_NORMAL)
22 gtk_widget_modify_font (widget, NULL);
23 else
24 {
25 PangoFontDescription* font_description = pango_font_description_new ();
26 pango_font_description_set_style (font_description, PANGO_STYLE_ITALIC);
27 gtk_widget_modify_font (widget, font_description);
28 pango_font_description_free (font_description);
29 }
30}
31
32/* returns TRUE if the entry is currently showing its placeholder text */
33static gboolean
34sokoke_entry_is_showing_default (GtkEntry* entry)
35{
36 gint showing_default = GPOINTER_TO_INT (
37 g_object_get_data (G_OBJECT (entry), "sokoke_showing_default"));
38
39 const gchar* text = gtk_entry_get_text (entry);
40 const gchar* default_text = (const gchar*)g_object_get_data (
41 G_OBJECT (entry), "sokoke_default_text");
42
43 return showing_default && !g_strcmp0(text, default_text);
44}
45
46/* returns TRUE if the entry is not being used by the user to perform entry or
47hold data at a given moment */
48static gboolean
49sokoke_entry_is_idle (GtkEntry* entry)
50{
51 const gchar* text = gtk_entry_get_text (entry);
52
53 /* if the default is visible or the user has left the entry blank */
54 return sokoke_entry_is_showing_default(entry) ||
55 (text && !*text && !gtk_widget_has_focus (GTK_WIDGET (entry)));
56}
57
58static gboolean
59sokoke_on_entry_text_changed (GtkEntry* entry,
60 GParamSpec* pspec,
61 gpointer userdata);
62
63static void
64sokoke_hide_placeholder_text (GtkEntry* entry)
65{
66 if(sokoke_entry_is_showing_default (entry))
67 {
68 g_signal_handlers_block_by_func (entry, sokoke_on_entry_text_changed, NULL);
69 gtk_entry_set_text (entry, "");
70 g_signal_handlers_unblock_by_func (entry, sokoke_on_entry_text_changed, NULL);
71 }
72 g_object_set_data (G_OBJECT (entry), "sokoke_showing_default",
73 GINT_TO_POINTER (0));
74 sokoke_widget_set_pango_font_style (GTK_WIDGET (entry),
75 PANGO_STYLE_NORMAL);
76}
77
78static gboolean
79sokoke_on_entry_focus_in_event (GtkEntry* entry,
80 GdkEventFocus* event,
81 gpointer userdata)
82{
83 sokoke_hide_placeholder_text (entry);
84 return FALSE;
85}
86
87static void
88sokoke_show_placeholder_text (GtkEntry* entry)
89{
90 /* no need to do work if the widget is unfocused with placeholder */
91 if(sokoke_entry_is_showing_default (entry))
92 return;
93
94 /* no need to do work if the placeholder is already visible */
95 const gchar* text = gtk_entry_get_text (entry);
96 if (text && !*text)
97 {
98 const gchar* default_text = (const gchar*)g_object_get_data (
99 G_OBJECT (entry), "sokoke_default_text");
100 g_object_set_data (G_OBJECT (entry),
101 "sokoke_showing_default", GINT_TO_POINTER (1));
102 g_signal_handlers_block_by_func (entry, sokoke_on_entry_text_changed, NULL);
103 gtk_entry_set_text (entry, default_text);
104 g_signal_handlers_unblock_by_func (entry, sokoke_on_entry_text_changed, NULL);
105 sokoke_widget_set_pango_font_style (GTK_WIDGET (entry),
106 PANGO_STYLE_ITALIC);
107 }
108}
109
110static void
111sokoke_on_entry_drag_leave (GtkEntry* entry,
112 GdkDragContext* drag_context,
113 guint timestamp,
114 gpointer user_data)
115{
116 sokoke_show_placeholder_text (entry);
117}
118
119static gboolean
120sokoke_on_entry_text_changed (GtkEntry* entry,
121 GParamSpec* pspec,
122 gpointer userdata)
123{
124 if(sokoke_entry_is_idle (entry))
125 {
126 sokoke_show_placeholder_text (entry);
127 }
128 else
129 {
130 sokoke_hide_placeholder_text (entry);
131 }
132
133 return TRUE;
134}
135
136static gboolean
137sokoke_on_entry_focus_out_event (GtkEntry* entry,
138 GdkEventFocus* event,
139 gpointer userdata)
140{
141 sokoke_show_placeholder_text (entry);
142 return FALSE;
143}
144
145static gboolean
146sokoke_on_entry_drag_motion (GtkEntry* entry,
147 GdkDragContext* drag_context,
148 gint x,
149 gint y,
150 guint timestamp,
151 gpointer user_data)
152{
153 sokoke_hide_placeholder_text (entry);
154 return FALSE;
155}
156
157static gboolean
158sokoke_on_entry_drag_drop (GtkEntry* entry,
159 GdkDragContext* drag_context,
160 gint x,
161 gint y,
162 guint timestamp,
163 gpointer user_data)
164{
165 sokoke_hide_placeholder_text (entry);
166 return FALSE;
167}
168
169static void
170sokoke_on_entry_popup (GtkEntry *entry,
171 GtkWidget *popup,
172 gpointer user_data)
173{
174 /* If the user selects paste in the popup, we should hide the default
175 when the menu closes so it pastes into a clean entry */
176 g_signal_connect_swapped (popup, "destroy", G_CALLBACK (
177 sokoke_hide_placeholder_text), entry);
178}
179
180void
181gtk_entry_set_placeholder_text (GtkEntry* entry,
182 const gchar* default_text)
183{
184 /* Note: The default text initially overwrites any previous text */
185 gchar* old_default_text = g_object_get_data (G_OBJECT (entry), "sokoke_default_text");
186 g_object_set_data (G_OBJECT (entry), "sokoke_default_text", (gpointer)default_text);
187
188 if (default_text == NULL)
189 {
190 g_object_set_data (G_OBJECT (entry), "sokoke_showing_default", GINT_TO_POINTER (0));
191 g_signal_handlers_disconnect_by_func (entry,
192 G_CALLBACK (sokoke_on_entry_drag_motion), NULL);
193 g_signal_handlers_disconnect_by_func (entry,
194 G_CALLBACK (sokoke_on_entry_focus_in_event), NULL);
195 g_signal_handlers_disconnect_by_func (entry,
196 G_CALLBACK (sokoke_on_entry_drag_leave), NULL);
197 g_signal_handlers_disconnect_by_func (entry,
198 G_CALLBACK (sokoke_on_entry_drag_drop), NULL);
199 g_signal_handlers_disconnect_by_func (entry,
200 G_CALLBACK (sokoke_on_entry_focus_out_event), NULL);
201 g_signal_handlers_disconnect_by_func (entry,
202 G_CALLBACK (sokoke_on_entry_text_changed), NULL);
203 g_signal_handlers_disconnect_by_func (entry,
204 G_CALLBACK (sokoke_on_entry_popup), NULL);
205 }
206 else if (old_default_text == NULL)
207 {
208 g_object_set_data (G_OBJECT (entry), "sokoke_showing_default", GINT_TO_POINTER (1));
209 sokoke_widget_set_pango_font_style (GTK_WIDGET (entry), PANGO_STYLE_ITALIC);
210 gtk_entry_set_text (entry, default_text);
211 g_signal_connect (entry, "drag-motion",
212 G_CALLBACK (sokoke_on_entry_drag_motion), NULL);
213 g_signal_connect (entry, "focus-in-event",
214 G_CALLBACK (sokoke_on_entry_focus_in_event), NULL);
215 g_signal_connect (entry, "drag-leave",
216 G_CALLBACK (sokoke_on_entry_drag_leave), NULL);
217 g_signal_connect (entry, "drag-drop",
218 G_CALLBACK (sokoke_on_entry_drag_drop), NULL);
219 g_signal_connect (entry, "focus-out-event",
220 G_CALLBACK (sokoke_on_entry_focus_out_event), NULL);
221 g_signal_connect (entry, "notify::text",
222 G_CALLBACK (sokoke_on_entry_text_changed), NULL);
223 g_signal_connect (entry, "populate-popup",
224 G_CALLBACK (sokoke_on_entry_popup), NULL);
225 }
226 else if (!gtk_widget_has_focus (GTK_WIDGET (entry)))
227 {
228 gint showing_default = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (entry), "sokoke_showing_default"));
229 if (showing_default)
230 {
231 gtk_entry_set_text (entry, default_text);
232 sokoke_widget_set_pango_font_style (GTK_WIDGET (entry), PANGO_STYLE_ITALIC);
233 }
234 }
235}
236
237const gchar*
238gtk_entry_get_placeholder_text (GtkEntry* entry)
239{
240 return g_object_get_data (G_OBJECT (entry), "sokoke_default_text");
241}
242#endif
243
2440
=== removed file 'katze/gtk3-compat.h'
--- katze/gtk3-compat.h 2013-06-26 21:54:50 +0000
+++ katze/gtk3-compat.h 1970-01-01 00:00:00 +0000
@@ -1,93 +0,0 @@
1/*
2 Copyright (C) 2011-2012 Christian Dywan <christian@twotoasts.de>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 See the file COPYING for the full license text.
10*/
11
12#include <gtk/gtk.h>
13#include <gdk/gdkkeysyms.h>
14
15#ifndef H_GTK3_COMPAT_20110110
16#define H_GTK3_COMPAT_20110110
17
18G_BEGIN_DECLS
19
20#if GTK_CHECK_VERSION (3, 2, 0) && defined (GTK_DISABLE_DEPRECATED)
21 #define GTK_TYPE_VBOX GTK_TYPE_BOX
22 #define GtkVBox GtkBox
23 #define GtkVBoxClass GtkBoxClass
24 #define gtk_vbox_new(hmg,spc) g_object_new (GTK_TYPE_BOX, \
25 "homogeneous", hmg, "spacing", spc, \
26 "orientation", GTK_ORIENTATION_VERTICAL, NULL)
27 #define GTK_TYPE_HBOX GTK_TYPE_BOX
28 #define GtkHBox GtkBox
29 #define GtkHBoxClass GtkBoxClass
30 #define gtk_hbox_new(hmg,spc) g_object_new (GTK_TYPE_BOX, \
31 "homogeneous", hmg, "spacing", spc, \
32 "orientation", GTK_ORIENTATION_HORIZONTAL, NULL)
33 #define gtk_hseparator_new() g_object_new (GTK_TYPE_SEPARATOR, NULL)
34 #define gtk_hpaned_new() g_object_new (GTK_TYPE_PANED, NULL)
35 #define gtk_vpaned_new() g_object_new (GTK_TYPE_PANED, \
36 "orientation", GTK_ORIENTATION_VERTICAL, NULL)
37 /* FIXME */
38 #define gtk_widget_render_icon(wdgt, stk, sz, dtl) \
39 gtk_widget_render_icon_pixbuf(wdgt, stk, sz)
40 #define gtk_widget_size_request(wdgt, req) \
41 gtk_widget_get_preferred_size(wdgt, req, NULL)
42#endif
43
44#if GTK_CHECK_VERSION (3, 0, 0)
45 #define GTK_DIALOG_NO_SEPARATOR 0
46#endif
47
48#if !GTK_CHECK_VERSION (3, 2, 0)
49 void gtk_entry_set_placeholder_text (GtkEntry* entry, const gchar* text);
50 const gchar* gtk_entry_get_placeholder_text (GtkEntry* entry);
51#endif
52
53#ifndef GDK_KEY_Return
54 #define GDK_KEY_0 GDK_0
55 #define GDK_KEY_BackSpace GDK_BackSpace
56 #define GDK_KEY_space GDK_space
57 #define GDK_KEY_F5 GDK_F5
58 #define GDK_KEY_KP_Equal GDK_KP_Equal
59 #define GDK_KEY_KP_Enter GDK_KP_Enter
60 #define GDK_KEY_KP_Left GDK_KP_Left
61 #define GDK_KEY_KP_Right GDK_KP_Right
62 #define GDK_KEY_KP_Delete GDK_KP_Delete
63 #define GDK_KEY_KP_Down GDK_KP_Down
64 #define GDK_KEY_KP_Up GDK_KP_Up
65 #define GDK_KEY_KP_Divide GDK_KP_Divide
66 #define GDK_KEY_Tab GDK_Tab
67 #define GDK_KEY_ISO_Left_Tab GDK_ISO_Left_Tab
68 #define GDK_KEY_equal GDK_equal
69 #define GDK_KEY_ISO_Enter GDK_ISO_Enter
70 #define GDK_KEY_Left GDK_Left
71 #define GDK_KEY_Right GDK_Right
72 #define GDK_KEY_Escape GDK_Escape
73 #define GDK_KEY_Page_Up GDK_Page_Up
74 #define GDK_KEY_Page_Down GDK_Page_Down
75 #define GDK_KEY_Delete GDK_Delete
76 #define GDK_KEY_Down GDK_Down
77 #define GDK_KEY_Up GDK_Up
78 #define GDK_KEY_B GDK_B
79 #define GDK_KEY_H GDK_H
80 #define GDK_KEY_J GDK_J
81 #define GDK_KEY_Return GDK_Return
82#endif
83
84#ifdef GDK_WINDOWING_X11
85 #include <gdk/gdkx.h>
86 #ifndef GDK_IS_X11_DISPLAY
87 #define GDK_IS_X11_DISPLAY(display) TRUE
88 #endif
89#endif
90
91G_END_DECLS
92
93#endif
940
=== modified file 'katze/katze-cellrenderercomboboxtext.c'
--- katze/katze-cellrenderercomboboxtext.c 2014-05-20 02:15:05 +0000
+++ katze/katze-cellrenderercomboboxtext.c 2017-11-26 09:48:19 +0000
@@ -39,16 +39,11 @@
39static void39static void
40katze_cell_renderer_combobox_text_get_size (GtkCellRenderer* cell,40katze_cell_renderer_combobox_text_get_size (GtkCellRenderer* cell,
41 GtkWidget* widget,41 GtkWidget* widget,
42#if GTK_CHECK_VERSION(3,0,0)
43 const GdkRectangle* cell_area,42 const GdkRectangle* cell_area,
44#else
45 GdkRectangle* cell_area,
46#endif
47 gint* x_offset,43 gint* x_offset,
48 gint* y_offset,44 gint* y_offset,
49 gint* width,45 gint* width,
50 gint* height);46 gint* height);
51#if GTK_CHECK_VERSION(3,0,0)
52static void47static void
53katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,48katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,
54 cairo_t* cr,49 cairo_t* cr,
@@ -56,16 +51,6 @@
56 const GdkRectangle *background_area,51 const GdkRectangle *background_area,
57 const GdkRectangle *cell_area,52 const GdkRectangle *cell_area,
58 GtkCellRendererState flags);53 GtkCellRendererState flags);
59#else
60static void
61katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,
62 GdkDrawable *window,
63 GtkWidget *widget,
64 GdkRectangle *background_area,
65 GdkRectangle *cell_area,
66 GdkRectangle *expose_area,
67 GtkCellRendererState flags);
68#endif
6954
70enum {55enum {
71 PROP_0,56 PROP_0,
@@ -425,11 +410,7 @@
425static void410static void
426katze_cell_renderer_combobox_text_get_size (GtkCellRenderer *cell,411katze_cell_renderer_combobox_text_get_size (GtkCellRenderer *cell,
427 GtkWidget *widget,412 GtkWidget *widget,
428#if GTK_CHECK_VERSION(3,0,0)
429 const GdkRectangle* cell_area,413 const GdkRectangle* cell_area,
430#else
431 GdkRectangle* cell_area,
432#endif
433 gint *x_offset,414 gint *x_offset,
434 gint *y_offset,415 gint *y_offset,
435 gint *width,416 gint *width,
@@ -450,22 +431,12 @@
450}431}
451432
452static void433static void
453#if GTK_CHECK_VERSION(3,0,0)
454katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,434katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,
455 cairo_t* cr,435 cairo_t* cr,
456 GtkWidget *widget,436 GtkWidget *widget,
457 const GdkRectangle *background_area,437 const GdkRectangle *background_area,
458 const GdkRectangle *cell_area,438 const GdkRectangle *cell_area,
459 GtkCellRendererState flags)439 GtkCellRendererState flags)
460#else
461katze_cell_renderer_combobox_text_render (GtkCellRenderer *cell,
462 GdkDrawable *window,
463 GtkWidget *widget,
464 GdkRectangle *background_area,
465 GdkRectangle *cell_area,
466 GdkRectangle *expose_area,
467 GtkCellRendererState flags)
468#endif
469{440{
470 const gchar *text = NULL;441 const gchar *text = NULL;
471442
@@ -473,22 +444,12 @@
473444
474 set_text (KATZE_CELL_RENDERER_COMBOBOX_TEXT (cell), widget, text);445 set_text (KATZE_CELL_RENDERER_COMBOBOX_TEXT (cell), widget, text);
475446
476#if GTK_CHECK_VERSION(3,0,0)
477 GTK_CELL_RENDERER_CLASS (katze_cell_renderer_combobox_text_parent_class)->render (cell,447 GTK_CELL_RENDERER_CLASS (katze_cell_renderer_combobox_text_parent_class)->render (cell,
478 cr,448 cr,
479 widget,449 widget,
480 background_area,450 background_area,
481 cell_area,451 cell_area,
482 flags);452 flags);
483#else
484 GTK_CELL_RENDERER_CLASS (katze_cell_renderer_combobox_text_parent_class)->render (cell,
485 window,
486 widget,
487 background_area,
488 cell_area,
489 expose_area,
490 flags);
491#endif
492453
493 g_object_set (G_OBJECT (cell), "text", text, NULL);454 g_object_set (G_OBJECT (cell), "text", text, NULL);
494 g_free ((gpointer)text);455 g_free ((gpointer)text);
495456
=== modified file 'katze/katze-http-auth.c'
--- katze/katze-http-auth.c 2013-08-12 19:21:06 +0000
+++ katze/katze-http-auth.c 2017-11-26 09:48:19 +0000
@@ -14,7 +14,6 @@
14#endif14#endif
1515
16#include "katze-http-auth.h"16#include "katze-http-auth.h"
17#include "gtk3-compat.h"
1817
19#include <libsoup/soup.h>18#include <libsoup/soup.h>
20#include <gtk/gtk.h>19#include <gtk/gtk.h>
@@ -209,7 +208,7 @@
209208
210 dialog = gtk_dialog_new_with_buttons (_("Authentication Required"),209 dialog = gtk_dialog_new_with_buttons (_("Authentication Required"),
211 NULL,210 NULL,
212 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,211 GTK_DIALOG_DESTROY_WITH_PARENT,
213 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,212 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
214 GTK_STOCK_OK, GTK_RESPONSE_OK,213 GTK_STOCK_OK, GTK_RESPONSE_OK,
215 NULL);214 NULL);
216215
=== modified file 'katze/katze-item.c'
--- katze/katze-item.c 2015-08-10 02:44:13 +0000
+++ katze/katze-item.c 2017-11-26 09:48:19 +0000
@@ -450,7 +450,7 @@
450 g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);450 g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);
451451
452 if (widget && KATZE_ITEM_IS_FOLDER (item))452 if (widget && KATZE_ITEM_IS_FOLDER (item))
453 return gtk_widget_render_icon (widget, GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL);453 return gtk_widget_render_icon_pixbuf (widget, GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU);
454 if ((pixbuf = midori_paths_get_icon (item->uri, widget)))454 if ((pixbuf = midori_paths_get_icon (item->uri, widget)))
455 return pixbuf;455 return pixbuf;
456 return NULL;456 return NULL;
457457
=== modified file 'katze/katze-preferences.c'
--- katze/katze-preferences.c 2015-04-19 14:40:59 +0000
+++ katze/katze-preferences.c 2017-11-26 09:48:19 +0000
@@ -67,9 +67,6 @@
67 g_object_set (preferences,67 g_object_set (preferences,
68 "icon-name", GTK_STOCK_PREFERENCES,68 "icon-name", GTK_STOCK_PREFERENCES,
69 "title", dialog_title,69 "title", dialog_title,
70#if !GTK_CHECK_VERSION (2, 22, 0)
71 "has-separator", FALSE,
72#endif
73 NULL);70 NULL);
74 g_free (dialog_title);71 g_free (dialog_title);
7572
@@ -143,15 +140,8 @@
143katze_preferences_prepare (KatzePreferences* preferences)140katze_preferences_prepare (KatzePreferences* preferences)
144{141{
145 KatzePreferencesPrivate* priv = preferences->priv;142 KatzePreferencesPrivate* priv = preferences->priv;
146 143 #if HAVE_OSX
147 #if GTK_CHECK_VERSION (3, 10, 0) && !HAVE_OSX
148 priv->notebook = gtk_stack_new ();
149 #else
150 priv->notebook = gtk_notebook_new ();144 priv->notebook = gtk_notebook_new ();
151 #endif
152 gtk_container_set_border_width (GTK_CONTAINER (priv->notebook), 6);
153
154 #if HAVE_OSX
155 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);145 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
156 gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);146 gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
157 priv->toolbar = gtk_toolbar_new ();147 priv->toolbar = gtk_toolbar_new ();
@@ -160,17 +150,15 @@
160 gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),150 gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),
161 priv->toolbar, FALSE, FALSE, 0);151 priv->toolbar, FALSE, FALSE, 0);
162 #else152 #else
163 #if GTK_CHECK_VERSION (3, 10, 0) && !HAVE_OSX153 priv->notebook = gtk_stack_new ();
164 priv->toolbar = gtk_stack_switcher_new ();154 priv->toolbar = gtk_stack_switcher_new ();
165 gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (priv->toolbar), GTK_STACK (priv->notebook));155 gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (priv->toolbar), GTK_STACK (priv->notebook));
166 gtk_widget_set_halign (priv->toolbar, GTK_ALIGN_CENTER);156 gtk_widget_set_halign (priv->toolbar, GTK_ALIGN_CENTER);
167 gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),157 gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),
168 priv->toolbar, FALSE, FALSE, 0);158 priv->toolbar, FALSE, FALSE, 0);
169 #else
170 priv->toolbar = NULL;
171 #endif159 #endif
172160
173 #endif161 gtk_container_set_border_width (GTK_CONTAINER (priv->notebook), 6);
174 priv->toolbutton = NULL;162 priv->toolbutton = NULL;
175 gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),163 gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),
176 priv->notebook, TRUE, TRUE, 4);164 priv->notebook, TRUE, TRUE, 4);
@@ -200,7 +188,7 @@
200 gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (preferences)));188 gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (preferences)));
201}189}
202190
203#if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX191#if !HAVE_OSX
204/* these functions are used to clear the 100-px width set in GTK3's192/* these functions are used to clear the 100-px width set in GTK3's
205update_button function in gtk/gtkstackswitcher.c */193update_button function in gtk/gtkstackswitcher.c */
206194
@@ -252,17 +240,10 @@
252 priv->sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);240 priv->sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
253 gtk_widget_show (priv->page);241 gtk_widget_show (priv->page);
254 gtk_container_set_border_width (GTK_CONTAINER (priv->page), 4);242 gtk_container_set_border_width (GTK_CONTAINER (priv->page), 4);
255 #if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX243
256 gtk_stack_add_titled (GTK_STACK (priv->notebook), 244 #if HAVE_OSX
257 priv->page, label, label);
258 workaround_stack_switcher_sizing (GTK_STACK_SWITCHER (priv->toolbar));
259 #else
260 gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),245 gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
261 priv->page, gtk_label_new (label));246 priv->page, gtk_label_new (label));
262
263 #endif
264
265 #if HAVE_OSX
266 priv->toolbutton = GTK_WIDGET (priv->toolbutton ?247 priv->toolbutton = GTK_WIDGET (priv->toolbutton ?
267 gtk_radio_tool_button_new_from_widget (248 gtk_radio_tool_button_new_from_widget (
268 GTK_RADIO_TOOL_BUTTON (priv->toolbutton))249 GTK_RADIO_TOOL_BUTTON (priv->toolbutton))
@@ -276,6 +257,10 @@
276 G_CALLBACK (katze_preferences_toolbutton_clicked_cb), priv->page);257 G_CALLBACK (katze_preferences_toolbutton_clicked_cb), priv->page);
277 if (priv->toolbutton)258 if (priv->toolbutton)
278 g_object_set_data (G_OBJECT (priv->toolbutton), "notebook", priv->notebook);259 g_object_set_data (G_OBJECT (priv->toolbutton), "notebook", priv->notebook);
260 #else
261 gtk_stack_add_titled (GTK_STACK (priv->notebook),
262 priv->page, label, label);
263 workaround_stack_switcher_sizing (GTK_STACK_SWITCHER (priv->toolbar));
279 #endif264 #endif
280265
281 return priv->page;266 return priv->page;
282267
=== modified file 'katze/katze-utils.c'
--- katze/katze-utils.c 2014-05-20 02:15:05 +0000
+++ katze/katze-utils.c 2017-11-26 09:48:19 +0000
@@ -9,8 +9,6 @@
9 See the file COPYING for the full license text.9 See the file COPYING for the full license text.
10*/10*/
1111
12#include "gtk3-compat.h"
13
14#include "katze-utils.h"12#include "katze-utils.h"
15#include "katze-array.h"13#include "katze-array.h"
16#include "midori-core.h"14#include "midori-core.h"
@@ -70,7 +68,6 @@
70 g_object_set (object, property, file, NULL);68 g_object_set (object, property, file, NULL);
71}69}
7270
73#if GTK_CHECK_VERSION (3, 2, 0)
74static void71static void
75proxy_font_chooser_font_activated_cb (GtkFontChooser* chooser,72proxy_font_chooser_font_activated_cb (GtkFontChooser* chooser,
76 GObject* object)73 GObject* object)
@@ -89,17 +86,6 @@
89 gboolean monospace = GPOINTER_TO_INT (data);86 gboolean monospace = GPOINTER_TO_INT (data);
90 return monospace == pango_font_family_is_monospace (family);87 return monospace == pango_font_family_is_monospace (family);
91}88}
92#else
93static void
94proxy_combo_box_text_changed_cb (GtkComboBoxText* button,
95 GObject* object)
96{
97 gchar* text = gtk_combo_box_text_get_active_text (button);
98 const gchar* property = g_object_get_data (G_OBJECT (button), "property");
99 g_object_set (object, property, text, NULL);
100 g_free (text);
101}
102#endif
10389
104static gboolean90static gboolean
105proxy_entry_focus_out_event_cb (GtkEntry* entry,91proxy_entry_focus_out_event_cb (GtkEntry* entry,
@@ -423,7 +409,6 @@
423 katze_assign (string, g_strdup ("sans"));409 katze_assign (string, g_strdup ("sans"));
424 gboolean monospace = _hint == I_("font-monospace");410 gboolean monospace = _hint == I_("font-monospace");
425411
426 #if GTK_CHECK_VERSION (3, 2, 0)
427 widget = gtk_font_button_new ();412 widget = gtk_font_button_new ();
428 gtk_font_button_set_show_size (GTK_FONT_BUTTON (widget), FALSE);413 gtk_font_button_set_show_size (GTK_FONT_BUTTON (widget), FALSE);
429 gtk_font_chooser_set_font (GTK_FONT_CHOOSER (widget), string);414 gtk_font_chooser_set_font (GTK_FONT_CHOOSER (widget), string);
@@ -432,36 +417,6 @@
432 G_CALLBACK (proxy_font_chooser_font_activated_cb), object);417 G_CALLBACK (proxy_font_chooser_font_activated_cb), object);
433 gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (widget),418 gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (widget),
434 (GtkFontFilterFunc)proxy_font_chooser_filter_monospace_cb, GINT_TO_POINTER (monospace), NULL);419 (GtkFontFilterFunc)proxy_font_chooser_filter_monospace_cb, GINT_TO_POINTER (monospace), NULL);
435 #else
436 GtkComboBox* combo;
437 gint n_families, i;
438 PangoContext* context;
439 PangoFontFamily** families;
440
441 widget = gtk_combo_box_text_new ();
442 combo = GTK_COMBO_BOX (widget);
443 context = gtk_widget_get_pango_context (widget);
444 pango_context_list_families (context, &families, &n_families);
445 if (string)
446 {
447 gint j = 0;
448 for (i = 0; i < n_families; i++)
449 {
450 if (monospace != pango_font_family_is_monospace (families[i]))
451 continue;
452 const gchar* font = pango_font_family_get_name (families[i]);
453 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), font);
454 if (!g_ascii_strcasecmp (font, string))
455 gtk_combo_box_set_active (combo, j);
456 j++;
457 }
458 }
459 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (
460 gtk_combo_box_get_model (combo)), 0, GTK_SORT_ASCENDING);
461 g_signal_connect (widget, "changed",
462 G_CALLBACK (proxy_combo_box_text_changed_cb), object);
463 g_free (families);
464 #endif
465 }420 }
466 else if (type == G_TYPE_PARAM_STRING)421 else if (type == G_TYPE_PARAM_STRING)
467 {422 {
@@ -656,23 +611,13 @@
656 if (!window)611 if (!window)
657 return;612 return;
658613
659 #if !GTK_CHECK_VERSION (3, 0, 0)
660 if (GTK_IS_ENTRY (widget))
661 window = gdk_window_get_parent (window);
662 #endif
663
664 /* Retrieve size and position of both widget and menu */614 /* Retrieve size and position of both widget and menu */
665 gtk_widget_get_allocation (widget, &allocation);615 gtk_widget_get_allocation (widget, &allocation);
666 gdk_window_get_origin (window, &wx, &wy);616 gdk_window_get_origin (window, &wx, &wy);
667 wx += allocation.x;617 wx += allocation.x;
668 wy += allocation.y;618 wy += allocation.y;
669 #if GTK_CHECK_VERSION (3, 0, 0)
670 gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL);619 gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL);
671 gtk_widget_get_preferred_size (widget, &widget_req, NULL);620 gtk_widget_get_preferred_size (widget, &widget_req, NULL);
672 #else
673 gtk_widget_size_request (GTK_WIDGET (menu), &menu_req);
674 gtk_widget_size_request (widget, &widget_req);
675 #endif
676 menu_width = menu_req.width;621 menu_width = menu_req.width;
677 widget_height = widget_req.height; /* Better than allocation.height */622 widget_height = widget_req.height; /* Better than allocation.height */
678623
@@ -1037,31 +982,13 @@
1037 if (!valid)982 if (!valid)
1038 valid = midori_uri_is_ip_address (uri);983 valid = midori_uri_is_ip_address (uri);
1039984
1040 #if GTK_CHECK_VERSION (3, 2, 0)
1041 g_object_set_data (G_OBJECT (entry), "invalid", GINT_TO_POINTER (uri && *uri && !valid));985 g_object_set_data (G_OBJECT (entry), "invalid", GINT_TO_POINTER (uri && *uri && !valid));
1042 gtk_widget_queue_draw (entry);986 gtk_widget_queue_draw (entry);
1043 #else
1044 if (uri && *uri && !valid)
1045 {
1046 GdkColor bg_color = { 0 };
1047 GdkColor fg_color = { 0 };
1048 gdk_color_parse ("#ef7070", &bg_color);
1049 gdk_color_parse ("#000", &fg_color);
1050 gtk_widget_modify_base (entry, GTK_STATE_NORMAL, &bg_color);
1051 gtk_widget_modify_text (entry, GTK_STATE_NORMAL, &fg_color);
1052 }
1053 else
1054 {
1055 gtk_widget_modify_base (entry, GTK_STATE_NORMAL, NULL);
1056 gtk_widget_modify_text (entry, GTK_STATE_NORMAL, NULL);
1057 }
1058 #endif
1059987
1060 if (other_widget != NULL)988 if (other_widget != NULL)
1061 gtk_widget_set_sensitive (other_widget, valid);989 gtk_widget_set_sensitive (other_widget, valid);
1062}990}
1063991
1064#if GTK_CHECK_VERSION (3, 2, 0)
1065static gboolean992static gboolean
1066katze_uri_entry_draw_cb (GtkWidget* entry,993katze_uri_entry_draw_cb (GtkWidget* entry,
1067 cairo_t* cr,994 cairo_t* cr,
@@ -1081,7 +1008,6 @@
1081 width * 0.75, height / 1.9 / 2);1008 width * 0.75, height / 1.9 / 2);
1082 return TRUE;1009 return TRUE;
1083}1010}
1084#endif
10851011
1086/**1012/**
1087 * katze_uri_entry_new:1013 * katze_uri_entry_new:
@@ -1100,18 +1026,14 @@
1100katze_uri_entry_new (GtkWidget* other_widget)1026katze_uri_entry_new (GtkWidget* other_widget)
1101{1027{
1102 GtkWidget* entry = gtk_entry_new ();1028 GtkWidget* entry = gtk_entry_new ();
1103 #if GTK_CHECK_VERSION (3, 6, 0)
1104 gtk_entry_set_input_purpose (GTK_ENTRY (entry), GTK_INPUT_PURPOSE_URL);1029 gtk_entry_set_input_purpose (GTK_ENTRY (entry), GTK_INPUT_PURPOSE_URL);
1105 #endif
11061030
1107 gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY,1031 gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY,
1108 g_themed_icon_new_with_default_fallbacks ("text-html-symbolic"));1032 g_themed_icon_new_with_default_fallbacks ("text-html-symbolic"));
1109 g_signal_connect (entry, "changed",1033 g_signal_connect (entry, "changed",
1110 G_CALLBACK (katze_uri_entry_changed_cb), other_widget);1034 G_CALLBACK (katze_uri_entry_changed_cb), other_widget);
1111 #if GTK_CHECK_VERSION (3, 2, 0)
1112 g_signal_connect_after (entry, "draw",1035 g_signal_connect_after (entry, "draw",
1113 G_CALLBACK (katze_uri_entry_draw_cb), other_widget);1036 G_CALLBACK (katze_uri_entry_draw_cb), other_widget);
1114 #endif
1115 return entry;1037 return entry;
1116}1038}
11171039
@@ -1119,10 +1041,8 @@
1119katze_widget_add_class (GtkWidget* widget,1041katze_widget_add_class (GtkWidget* widget,
1120 const gchar* class_name)1042 const gchar* class_name)
1121{1043{
1122 #if GTK_CHECK_VERSION (3,0,0)
1123 GtkStyleContext* context = gtk_widget_get_style_context (widget);1044 GtkStyleContext* context = gtk_widget_get_style_context (widget);
1124 gtk_style_context_add_class (context, class_name);1045 gtk_style_context_add_class (context, class_name);
1125 #endif
1126}1046}
11271047
1128/**1048/**
11291049
=== modified file 'katze/katze-utils.h'
--- katze/katze-utils.h 2013-04-16 22:10:56 +0000
+++ katze/katze-utils.h 2017-11-26 09:48:19 +0000
@@ -15,7 +15,6 @@
1515
16#include <gtk/gtk.h>16#include <gtk/gtk.h>
17#include "katze-array.h"17#include "katze-array.h"
18#include "gtk3-compat.h"
1918
20G_BEGIN_DECLS19G_BEGIN_DECLS
2120
2221
=== modified file 'katze/katze.h'
--- katze/katze.h 2013-10-22 22:38:26 +0000
+++ katze/katze.h 2017-11-26 09:48:19 +0000
@@ -19,10 +19,6 @@
19#include "katze-arrayaction.h"19#include "katze-arrayaction.h"
20#include "katze-preferences.h"20#include "katze-preferences.h"
2121
22#ifndef HAVE_WEBKIT222#include <webkit2/webkit2.h>
23 #include <webkit/webkit.h>
24#else
25 #include <webkit2/webkit2.h>
26#endif
2723
28#endif /* __KATZE_H__ */24#endif /* __KATZE_H__ */
2925
=== modified file 'katze/midori-paths.vala'
--- katze/midori-paths.vala 2016-01-15 19:18:17 +0000
+++ katze/midori-paths.vala 2017-11-26 09:48:19 +0000
@@ -134,11 +134,9 @@
134 tmp_dir = get_runtime_dir ();134 tmp_dir = get_runtime_dir ();
135 }135 }
136 else {136 else {
137#if HAVE_WEBKIT2_3_91
138 /* Allow WebKit to spawn more than one rendering process */137 /* Allow WebKit to spawn more than one rendering process */
139 if (!("wk2:no-multi-render-process" in (Environment.get_variable ("MIDORI_DEBUG") ?? "")))138 if (!("wk2:no-multi-render-process" in (Environment.get_variable ("MIDORI_DEBUG") ?? "")))
140 WebKit.WebContext.get_default ().set_process_model (WebKit.ProcessModel.MULTIPLE_SECONDARY_PROCESSES);139 WebKit.WebContext.get_default ().set_process_model (WebKit.ProcessModel.MULTIPLE_SECONDARY_PROCESSES);
141#endif
142 string? real_config = config != null && !Path.is_absolute (config)140 string? real_config = config != null && !Path.is_absolute (config)
143 ? Path.build_filename (Environment.get_current_dir (), config) : config;141 ? Path.build_filename (Environment.get_current_dir (), config) : config;
144 config_dir = real_config ?? Path.build_path (Path.DIR_SEPARATOR_S,142 config_dir = real_config ?? Path.build_path (Path.DIR_SEPARATOR_S,
@@ -148,7 +146,6 @@
148 user_data_dir = Environment.get_user_data_dir ();146 user_data_dir = Environment.get_user_data_dir ();
149 tmp_dir = get_runtime_dir ();147 tmp_dir = get_runtime_dir ();
150 }148 }
151#if HAVE_WEBKIT2
152 if (cache_dir != null) {149 if (cache_dir != null) {
153 /* Cache and extension dir MUST be set no later than here to work */150 /* Cache and extension dir MUST be set no later than here to work */
154 WebKit.WebContext.get_default ().set_web_extensions_directory (151 WebKit.WebContext.get_default ().set_web_extensions_directory (
@@ -162,26 +159,9 @@
162 cookie_manager.set_persistent_storage (Path.build_filename (config_dir, "cookies.db"),159 cookie_manager.set_persistent_storage (Path.build_filename (config_dir, "cookies.db"),
163 WebKit.CookiePersistentStorage.SQLITE);160 WebKit.CookiePersistentStorage.SQLITE);
164 }161 }
165#endif
166 if (user_data_dir != null) {162 if (user_data_dir != null) {
167 string folder = Path.build_filename (user_data_dir, "webkit", "icondatabase");163 string folder = Path.build_filename (user_data_dir, "webkit", "icondatabase");
168#if HAVE_WEBKIT2
169 WebKit.WebContext.get_default ().set_favicon_database_directory (folder);164 WebKit.WebContext.get_default ().set_favicon_database_directory (folder);
170#else
171 WebKit.get_favicon_database ().set_path (folder);
172#endif
173 }
174 else
175 {
176#if HAVE_WEBKIT2
177 /* with wk2 set_favicon_database_directory can only be called once and actually
178 initializes and enables the favicon database, so we do not call it in this case */
179#else
180 /* wk1 documentation claims that the favicon database is not enabled unless
181 a call to favicon_database.set_path is made, but in fact it must be explicitly
182 disabled by setting to null (verified as of webkitgtk 2.3.1) */
183 WebKit.get_favicon_database ().set_path (null);
184#endif
185 }165 }
186166
187 #if !HAVE_WIN32167 #if !HAVE_WIN32
@@ -451,11 +431,7 @@
451 public static void clear_icons () {431 public static void clear_icons () {
452 assert (cache_dir != null);432 assert (cache_dir != null);
453 assert (user_data_dir != null);433 assert (user_data_dir != null);
454#if HAVE_WEBKIT2
455 WebKit.WebContext.get_default ().get_favicon_database ().clear ();434 WebKit.WebContext.get_default ().get_favicon_database ().clear ();
456#else
457 WebKit.get_favicon_database ().clear ();
458#endif
459 /* FIXME: Exclude search engine icons */435 /* FIXME: Exclude search engine icons */
460 remove_path (Path.build_filename (user_data_dir, "webkit", "icondatabase"));436 remove_path (Path.build_filename (user_data_dir, "webkit", "icondatabase"));
461 }437 }
@@ -484,7 +460,7 @@
484 return pixbuf;460 return pixbuf;
485#endif461#endif
486 if (widget != null)462 if (widget != null)
487 return widget.render_icon (Gtk.STOCK_FILE, Gtk.IconSize.MENU, null);463 return widget.render_icon_pixbuf (Gtk.STOCK_FILE, Gtk.IconSize.MENU);
488 return null;464 return null;
489 }465 }
490 }466 }
491467
=== modified file 'katze/midori-uri.vala'
--- katze/midori-uri.vala 2015-04-12 13:30:03 +0000
+++ katze/midori-uri.vala 2017-11-26 09:48:19 +0000
@@ -51,14 +51,12 @@
51 return uri;51 return uri;
52 }52 }
53 public static string get_base_domain (string uri) {53 public static string get_base_domain (string uri) {
54#if HAVE_LIBSOUP_2_40_0
55 try {54 try {
56 string ascii = to_ascii (uri);55 string ascii = to_ascii (uri);
57 return Soup.tld_get_base_domain (ascii);56 return Soup.tld_get_base_domain (ascii);
58 } catch (Error error) {57 } catch (Error error) {
59 /* This is fine, we fallback to hostname */58 /* This is fine, we fallback to hostname */
60 }59 }
61#endif
62 return parse_hostname (uri, null);60 return parse_hostname (uri, null);
63 }61 }
6462
6563
=== modified file 'midori/main.c'
--- midori/main.c 2016-03-21 19:19:52 +0000
+++ midori/main.c 2017-11-26 09:48:19 +0000
@@ -343,19 +343,11 @@
343 GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);343 GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
344 GtkWidget* vbox = gtk_vbox_new (FALSE, 0);344 GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
345 GtkWidget* entry = gtk_entry_new ();345 GtkWidget* entry = gtk_entry_new ();
346#ifndef HAVE_WEBKIT2
347 GtkWidget* scrolled = gtk_scrolled_window_new (NULL, NULL);
348#endif
349 GtkWidget* web_view = webkit_web_view_new ();346 GtkWidget* web_view = webkit_web_view_new ();
350 katze_window_set_sensible_default_size (GTK_WINDOW (window));347 katze_window_set_sensible_default_size (GTK_WINDOW (window));
351348
352 gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);349 gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
353#ifndef HAVE_WEBKIT2
354 gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE, 0);
355 gtk_container_add (GTK_CONTAINER (scrolled), web_view);
356#else
357 gtk_box_pack_start (GTK_BOX (vbox), web_view, TRUE, TRUE, 0);350 gtk_box_pack_start (GTK_BOX (vbox), web_view, TRUE, TRUE, 0);
358#endif
359 gtk_container_add (GTK_CONTAINER (window), vbox);351 gtk_container_add (GTK_CONTAINER (window), vbox);
360 gtk_entry_set_text (GTK_ENTRY (entry), uris && *uris ? *uris : "http://www.example.com");352 gtk_entry_set_text (GTK_ENTRY (entry), uris && *uris ? *uris : "http://www.example.com");
361 plain_entry_activate_cb (entry, web_view);353 plain_entry_activate_cb (entry, web_view);
@@ -381,9 +373,6 @@
381373
382 MidoriBrowser* browser = midori_browser_new ();374 MidoriBrowser* browser = midori_browser_new ();
383 MidoriWebSettings* settings = midori_browser_get_settings (browser);375 MidoriWebSettings* settings = midori_browser_get_settings (browser);
384#ifndef HAVE_WEBKIT2
385 g_object_set_data (G_OBJECT (webkit_get_default_session ()), "pass-through-console", (void*)1);
386#endif
387 midori_load_soup_session (settings);376 midori_load_soup_session (settings);
388377
389 gchar* msg = NULL;378 gchar* msg = NULL;
390379
=== modified file 'midori/midori-app.c'
--- midori/midori-app.c 2017-09-03 22:40:01 +0000
+++ midori/midori-app.c 2017-11-26 09:48:19 +0000
@@ -34,13 +34,6 @@
34 #include <locale.h>34 #include <locale.h>
35#endif35#endif
3636
37#ifdef HAVE_LIBNOTIFY
38 #include <libnotify/notify.h>
39 #ifndef NOTIFY_CHECK_VERSION
40 #define NOTIFY_CHECK_VERSION(x,y,z) 0
41 #endif
42#endif
43
44#ifdef HAVE_SIGNAL_H37#ifdef HAVE_SIGNAL_H
45 #include <signal.h>38 #include <signal.h>
46#endif39#endif
@@ -202,7 +195,6 @@
202 G_CALLBACK (midori_app_send_notification), app);195 G_CALLBACK (midori_app_send_notification), app);
203 katze_array_add_item (app->browsers, browser);196 katze_array_add_item (app->browsers, browser);
204197
205 #if GTK_CHECK_VERSION (3, 0, 0)
206 if (app->browser == NULL)198 if (app->browser == NULL)
207 {199 {
208 gchar* filename;200 gchar* filename;
@@ -226,7 +218,6 @@
226 g_free (filename);218 g_free (filename);
227 }219 }
228 }220 }
229 #endif
230221
231 app->browser = browser;222 app->browser = browser;
232}223}
@@ -678,10 +669,6 @@
678 app->speeddial = NULL;669 app->speeddial = NULL;
679 app->extensions = katze_array_new (KATZE_TYPE_ARRAY);670 app->extensions = katze_array_new (KATZE_TYPE_ARRAY);
680 app->browsers = katze_array_new (MIDORI_TYPE_BROWSER);671 app->browsers = katze_array_new (MIDORI_TYPE_BROWSER);
681
682 #ifdef HAVE_LIBNOTIFY
683 notify_init (PACKAGE_NAME);
684 #endif
685}672}
686673
687static void674static void
@@ -699,11 +686,6 @@
699 katze_object_assign (app->extensions, NULL);686 katze_object_assign (app->extensions, NULL);
700 katze_object_assign (app->browsers, NULL);687 katze_object_assign (app->browsers, NULL);
701688
702 #ifdef HAVE_LIBNOTIFY
703 if (notify_is_initted ())
704 notify_uninit ();
705 #endif
706
707 G_OBJECT_CLASS (midori_app_parent_class)->finalize (object);689 G_OBJECT_CLASS (midori_app_parent_class)->finalize (object);
708}690}
709691
@@ -1117,18 +1099,7 @@
1117 g_return_if_fail (MIDORI_IS_APP (app));1099 g_return_if_fail (MIDORI_IS_APP (app));
1118 g_return_if_fail (title);1100 g_return_if_fail (title);
11191101
1120 #ifdef HAVE_LIBNOTIFY1102 #if !defined(G_OS_WIN32)
1121 if (notify_is_initted ())
1122 {
1123 #if NOTIFY_CHECK_VERSION (0, 7, 0)
1124 NotifyNotification* note = notify_notification_new (title, message, "midori");
1125 #else
1126 NotifyNotification* note = notify_notification_new (title, message, "midori", NULL);
1127 #endif
1128 notify_notification_show (note, NULL);
1129 g_object_unref (note);
1130 }
1131 #elif !defined(G_OS_WIN32)
1132 GNotification* notification = g_notification_new (title);1103 GNotification* notification = g_notification_new (title);
1133 g_notification_set_body (notification, message);1104 g_notification_set_body (notification, message);
1134 GIcon* icon = g_themed_icon_new ("midori");1105 GIcon* icon = g_themed_icon_new ("midori");
@@ -1241,13 +1212,8 @@
1241 textdomain (GETTEXT_PACKAGE);1212 textdomain (GETTEXT_PACKAGE);
1242 #endif1213 #endif
12431214
1244 #if GTK_CHECK_VERSION (3, 0, 0)
1245 success = gtk_init_with_args (argc, argument_vector, _("[Addresses]"),1215 success = gtk_init_with_args (argc, argument_vector, _("[Addresses]"),
1246 entries, GETTEXT_PACKAGE, &error);1216 entries, GETTEXT_PACKAGE, &error);
1247 #else
1248 success = gtk_init_with_args (argc, argument_vector, _("[Addresses]"),
1249 (GOptionEntry*)entries, GETTEXT_PACKAGE, &error);
1250 #endif
12511217
1252 factory = gtk_icon_factory_new ();1218 factory = gtk_icon_factory_new ();
1253 for (i = 0; i < G_N_ELEMENTS (items); i++)1219 for (i = 0; i < G_N_ELEMENTS (items); i++)
12541220
=== modified file 'midori/midori-browser.c'
--- midori/midori-browser.c 2016-01-23 19:21:31 +0000
+++ midori/midori-browser.c 2017-11-26 09:48:19 +0000
@@ -153,11 +153,9 @@
153static void153static void
154midori_browser_finalize (GObject* object);154midori_browser_finalize (GObject* object);
155155
156#ifdef HAVE_WEBKIT2
157void download_created_destination_cb (WebKitDownload *download,156void download_created_destination_cb (WebKitDownload *download,
158 gchar *destination,157 gchar *destination,
159 gpointer user_data);158 gpointer user_data);
160#endif
161159
162static void160static void
163midori_browser_set_property (GObject* object,161midori_browser_set_property (GObject* object,
@@ -350,13 +348,7 @@
350 MidoriView* view,348 MidoriView* view,
351 const gchar* text)349 const gchar* text)
352{350{
353 #if GTK_CHECK_VERSION (3, 2, 0)
354 gboolean is_location = FALSE;351 gboolean is_location = FALSE;
355 #else
356 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
357 gboolean is_location = widget && GTK_IS_ENTRY (widget)
358 && GTK_IS_ALIGNMENT (gtk_widget_get_parent (widget));
359 #endif
360352
361 katze_assign (browser->statusbar_text, midori_uri_format_for_display (text));353 katze_assign (browser->statusbar_text, midori_uri_format_for_display (text));
362 if (view == NULL)354 if (view == NULL)
@@ -365,26 +357,11 @@
365 if (!gtk_widget_get_visible (browser->statusbar) && !is_location357 if (!gtk_widget_get_visible (browser->statusbar) && !is_location
366 && text && *text)358 && text && *text)
367 {359 {
368 #if GTK_CHECK_VERSION (3, 2, 0)
369 midori_view_set_overlay_text (view, browser->statusbar_text);360 midori_view_set_overlay_text (view, browser->statusbar_text);
370 #else
371 GtkAction* action = _action_by_name (browser, "Location");
372 MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
373 midori_location_action_set_text (location_action, browser->statusbar_text);
374 midori_location_action_set_secondary_icon (location_action, NULL);
375 #endif
376 }361 }
377 else if (!gtk_widget_get_visible (browser->statusbar) && !is_location)362 else if (!gtk_widget_get_visible (browser->statusbar) && !is_location)
378 {363 {
379 #if GTK_CHECK_VERSION (3, 2, 0)
380 midori_view_set_overlay_text (view, NULL);364 midori_view_set_overlay_text (view, NULL);
381 #else
382 GtkAction* action = _action_by_name (browser, "Location");
383 MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
384 midori_browser_update_secondary_icon (browser, view, action);
385 midori_location_action_set_text (location_action,
386 midori_view_get_display_uri (view));
387 #endif
388 }365 }
389 else366 else
390 {367 {
@@ -1127,11 +1104,7 @@
1127{1104{
1128 MidoriBrowser* browser = midori_browser_get_for_widget (button);1105 MidoriBrowser* browser = midori_browser_get_for_widget (button);
1129 midori_browser_add_speed_dial (browser);1106 midori_browser_add_speed_dial (browser);
1130 #if GTK_CHECK_VERSION (3, 12, 0)
1131 GtkWidget* dialog = gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER);1107 GtkWidget* dialog = gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER);
1132 #else
1133 GtkWidget* dialog = gtk_widget_get_toplevel (button);
1134 #endif
1135 midori_browser_edit_bookmark_response_cb (dialog, GTK_RESPONSE_DELETE_EVENT, browser);1108 midori_browser_edit_bookmark_response_cb (dialog, GTK_RESPONSE_DELETE_EVENT, browser);
1136}1109}
11371110
@@ -1142,15 +1115,10 @@
1142 MidoriBrowser* browser = midori_browser_get_for_widget (button);1115 MidoriBrowser* browser = midori_browser_get_for_widget (button);
1143 GtkAction* action = g_object_get_data (G_OBJECT (button), "midori-action");1116 GtkAction* action = g_object_get_data (G_OBJECT (button), "midori-action");
1144 gtk_action_activate (action);1117 gtk_action_activate (action);
1145 #if GTK_CHECK_VERSION (3, 12, 0)
1146 GtkWidget* dialog = gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER);1118 GtkWidget* dialog = gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER);
1147 #else
1148 GtkWidget* dialog = gtk_widget_get_toplevel (button);
1149 #endif
1150 midori_browser_edit_bookmark_response_cb (dialog, GTK_RESPONSE_DELETE_EVENT, browser);1119 midori_browser_edit_bookmark_response_cb (dialog, GTK_RESPONSE_DELETE_EVENT, browser);
1151}1120}
11521121
1153#if GTK_CHECK_VERSION (3, 12, 0)
1154static void1122static void
1155midori_browser_edit_bookmark_button_cb (GtkWidget* button,1123midori_browser_edit_bookmark_button_cb (GtkWidget* button,
1156 MidoriBrowser* browser)1124 MidoriBrowser* browser)
@@ -1158,7 +1126,6 @@
1158 GtkWidget* dialog = gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER);1126 GtkWidget* dialog = gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER);
1159 midori_browser_edit_bookmark_response_cb (dialog, GTK_RESPONSE_ACCEPT, browser);1127 midori_browser_edit_bookmark_response_cb (dialog, GTK_RESPONSE_ACCEPT, browser);
1160}1128}
1161#endif
11621129
1163/* Private function, used by MidoriBookmarks and MidoriHistory */1130/* Private function, used by MidoriBookmarks and MidoriHistory */
1164/* static */ gboolean1131/* static */ gboolean
@@ -1189,7 +1156,6 @@
1189 title = new_bookmark ? _("New Folder") : _("Edit Folder");1156 title = new_bookmark ? _("New Folder") : _("Edit Folder");
1190 else1157 else
1191 title = new_bookmark ? _("New Bookmark") : _("Edit Bookmark");1158 title = new_bookmark ? _("New Bookmark") : _("Edit Bookmark");
1192 #if GTK_CHECK_VERSION (3, 12, 0)
1193 if (proxy != NULL)1159 if (proxy != NULL)
1194 {1160 {
1195 dialog = gtk_popover_new (proxy);1161 dialog = gtk_popover_new (proxy);
@@ -1202,10 +1168,9 @@
1202 g_signal_connect (accept, "clicked", G_CALLBACK (midori_browser_edit_bookmark_button_cb), browser);1168 g_signal_connect (accept, "clicked", G_CALLBACK (midori_browser_edit_bookmark_button_cb), browser);
1203 }1169 }
1204 else1170 else
1205 #endif
1206 {1171 {
1207 dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (browser),1172 dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (browser),
1208 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, NULL, NULL);1173 GTK_DIALOG_DESTROY_WITH_PARENT, NULL, NULL);
1209 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));1174 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
1210 actions = gtk_hbox_new (FALSE, 0);1175 actions = gtk_hbox_new (FALSE, 0);
1211 gtk_box_pack_end (GTK_BOX (content_area), actions, TRUE, TRUE, 0);1176 gtk_box_pack_end (GTK_BOX (content_area), actions, TRUE, TRUE, 0);
@@ -1319,11 +1284,7 @@
1319 if (!midori_download_has_enough_space (download, uri, FALSE))1284 if (!midori_download_has_enough_space (download, uri, FALSE))
1320 return FALSE;1285 return FALSE;
13211286
1322#ifdef HAVE_WEBKIT2
1323 webkit_download_set_destination (download, uri);1287 webkit_download_set_destination (download, uri);
1324#else
1325 webkit_download_set_destination_uri (download, uri);
1326#endif
1327 g_signal_emit (browser, signals[ADD_DOWNLOAD], 0, download);1288 g_signal_emit (browser, signals[ADD_DOWNLOAD], 0, download);
1328 return TRUE;1289 return TRUE;
1329}1290}
@@ -1395,50 +1356,6 @@
1395 g_free (dirname);1356 g_free (dirname);
1396 }1357 }
13971358
1398#ifndef HAVE_WEBKIT2
1399 GList* resources = midori_view_get_resources (view);
1400 gboolean file_only = TRUE;
1401 GtkWidget* checkbox = NULL;
1402
1403 if (resources != NULL && g_list_nth_data (resources, 1) != NULL)
1404 {
1405 file_only = FALSE;
1406 checkbox = gtk_check_button_new_with_mnemonic (_("Save associated _resources"));
1407 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE);
1408 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), checkbox);
1409 }
1410
1411 if (!file_only && !g_str_equal (title, uri))
1412 filename = midori_download_clean_filename (title);
1413 else
1414 {
1415 gchar* mime_type = katze_object_get_object (view, "mime-type");
1416 filename = midori_download_get_filename_suggestion_for_uri (mime_type, uri);
1417 g_free (mime_type);
1418 }
1419 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename);
1420 g_free (filename);
1421
1422 if (midori_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
1423 {
1424 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
1425 if (checkbox != NULL)
1426 file_only = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
1427 if (!file_only)
1428 {
1429 gchar* fullname = g_strconcat (filename, ".html", NULL);
1430 midori_view_save_source (view, uri, fullname, FALSE);
1431 g_free (fullname);
1432 midori_browser_save_resources (resources, filename);
1433 }
1434 else
1435 midori_view_save_source (view, uri, filename, FALSE);
1436 katze_assign (last_dir,
1437 gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
1438 }
1439 g_list_foreach (resources, (GFunc)g_object_unref, NULL);
1440 g_list_free (resources);
1441#else
1442 filename = midori_download_clean_filename (title);1359 filename = midori_download_clean_filename (title);
1443 gchar* suggested_filename = g_strconcat (filename, ".mht", NULL);1360 gchar* suggested_filename = g_strconcat (filename, ".mht", NULL);
1444 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested_filename);1361 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested_filename);
@@ -1456,7 +1373,6 @@
1456 katze_assign (last_dir,1373 katze_assign (last_dir,
1457 gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));1374 gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
1458 }1375 }
1459#endif
1460 gtk_widget_destroy (dialog);1376 gtk_widget_destroy (dialog);
1461}1377}
14621378
@@ -1785,7 +1701,6 @@
1785 }1701 }
1786}1702}
17871703
1788#ifdef HAVE_WEBKIT2
1789static void1704static void
1790midori_browser_close_tab_idle (GObject* resource,1705midori_browser_close_tab_idle (GObject* resource,
1791 GAsyncResult* result,1706 GAsyncResult* result,
@@ -1795,16 +1710,8 @@
1795 result, NULL, NULL);1710 result, NULL, NULL);
1796 if (data != NULL)1711 if (data != NULL)
1797 return;1712 return;
1798#else
1799static gboolean
1800midori_browser_close_tab_idle (gpointer view)
1801{
1802#endif
1803 MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));1713 MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
1804 midori_browser_close_tab (browser, GTK_WIDGET (view));1714 midori_browser_close_tab (browser, GTK_WIDGET (view));
1805#ifndef HAVE_WEBKIT2
1806 return G_SOURCE_REMOVE;
1807#endif
1808}1715}
18091716
1810static gboolean1717static gboolean
@@ -1820,11 +1727,7 @@
1820 {1727 {
1821 handled = FALSE;1728 handled = FALSE;
1822 }1729 }
1823 #ifdef HAVE_WEBKIT2
1824 else if (!webkit_download_get_destination (download))1730 else if (!webkit_download_get_destination (download))
1825 #else
1826 else if (!webkit_download_get_destination_uri (download))
1827 #endif
1828 {1731 {
1829 if (type == MIDORI_DOWNLOAD_SAVE_AS)1732 if (type == MIDORI_DOWNLOAD_SAVE_AS)
1830 {1733 {
@@ -1833,12 +1736,8 @@
18331736
1834 if (!dialog)1737 if (!dialog)
1835 {1738 {
1836 #ifdef HAVE_WEBKIT2
1837 const gchar* download_uri = webkit_uri_response_get_uri (1739 const gchar* download_uri = webkit_uri_response_get_uri (
1838 webkit_download_get_response (download));1740 webkit_download_get_response (download));
1839 #else
1840 const gchar* download_uri = webkit_download_get_uri (download);
1841 #endif
1842 gchar* folder;1741 gchar* folder;
1843 dialog = (GtkWidget*)midori_file_chooser_dialog_new (_("Save file"),1742 dialog = (GtkWidget*)midori_file_chooser_dialog_new (_("Save file"),
1844 GTK_WINDOW (browser), GTK_FILE_CHOOSER_ACTION_SAVE);1743 GTK_WINDOW (browser), GTK_FILE_CHOOSER_ACTION_SAVE);
@@ -1883,24 +1782,14 @@
1883 midori_browser_prepare_download (browser, download, destination_uri);1782 midori_browser_prepare_download (browser, download, destination_uri);
1884 g_free (destination_uri);1783 g_free (destination_uri);
1885 }1784 }
1886 #ifndef HAVE_WEBKIT2
1887 webkit_download_start (download);
1888 #endif
1889 }1785 }
18901786
1891 /* Close empty tabs due to download links with a target */1787 /* Close empty tabs due to download links with a target */
1892 if (midori_view_is_blank (MIDORI_VIEW (view)))1788 if (midori_view_is_blank (MIDORI_VIEW (view)))
1893 {1789 {
1894 GtkWidget* web_view = midori_view_get_web_view (MIDORI_VIEW (view));1790 GtkWidget* web_view = midori_view_get_web_view (MIDORI_VIEW (view));
1895 #ifdef HAVE_WEBKIT2
1896 WebKitWebResource* resource = webkit_web_view_get_main_resource (WEBKIT_WEB_VIEW (web_view));1791 WebKitWebResource* resource = webkit_web_view_get_main_resource (WEBKIT_WEB_VIEW (web_view));
1897 webkit_web_resource_get_data (resource, NULL, midori_browser_close_tab_idle, view);1792 webkit_web_resource_get_data (resource, NULL, midori_browser_close_tab_idle, view);
1898 #else
1899 WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
1900 WebKitWebDataSource* datasource = webkit_web_frame_get_data_source (web_frame);
1901 if (webkit_web_data_source_get_data (datasource) == NULL)
1902 g_idle_add (midori_browser_close_tab_idle, view);
1903 #endif
1904 }1793 }
1905 return handled;1794 return handled;
1906}1795}
@@ -2690,17 +2579,6 @@
2690 "Whether or not to show tabs",2579 "Whether or not to show tabs",
2691 TRUE,2580 TRUE,
2692 flags));2581 flags));
2693
2694 #if !GTK_CHECK_VERSION (3, 0, 0)
2695 /* Add 2px space between tool buttons */
2696 gtk_rc_parse_string (
2697 "style \"tool-button-style\"\n {\n"
2698 "GtkToolButton::icon-spacing = 2\n }\n"
2699 "widget \"MidoriBrowser.*.MidoriBookmarkbar.Gtk*ToolButton\" "
2700 "style \"tool-button-style\"\n"
2701 "widget \"MidoriBrowser.*.MidoriFindbar.Gtk*ToolButton\" "
2702 "style \"tool-button-style\"\n");
2703 #endif
2704}2582}
27052583
2706static void2584static void
@@ -2729,10 +2607,6 @@
2729_action_open_activate (GtkAction* action,2607_action_open_activate (GtkAction* action,
2730 MidoriBrowser* browser)2608 MidoriBrowser* browser)
2731{2609{
2732 #if !GTK_CHECK_VERSION (3, 1, 10)
2733 static gchar* last_dir = NULL;
2734 gboolean folder_set = FALSE;
2735 #endif
2736 gchar* uri = NULL;2610 gchar* uri = NULL;
2737 GtkWidget* dialog;2611 GtkWidget* dialog;
2738 GtkWidget* view;2612 GtkWidget* view;
@@ -2751,9 +2625,6 @@
2751 if (dirname && g_file_test (dirname, G_FILE_TEST_IS_DIR))2625 if (dirname && g_file_test (dirname, G_FILE_TEST_IS_DIR))
2752 {2626 {
2753 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), dirname);2627 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), dirname);
2754 #if !GTK_CHECK_VERSION (3, 1, 10)
2755 folder_set = TRUE;
2756 #endif
2757 }2628 }
27582629
2759 g_free (dirname);2630 g_free (dirname);
@@ -2761,18 +2632,8 @@
2761 }2632 }
2762 }2633 }
27632634
2764 #if !GTK_CHECK_VERSION (3, 1, 10)
2765 if (!folder_set && last_dir && *last_dir)
2766 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), last_dir);
2767 #endif
2768
2769 if (midori_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)2635 if (midori_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
2770 {2636 {
2771 #if !GTK_CHECK_VERSION (3, 1, 10)
2772 gchar* folder;
2773 folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog));
2774 katze_assign (last_dir, folder);
2775 #endif
2776 uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));2637 uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
2777 midori_browser_set_current_uri (browser, uri);2638 midori_browser_set_current_uri (browser, uri);
2778 g_free (uri);2639 g_free (uri);
@@ -2991,11 +2852,7 @@
2991{2852{
2992 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));2853 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
2993 if (WEBKIT_IS_WEB_VIEW (widget))2854 if (WEBKIT_IS_WEB_VIEW (widget))
2994#ifdef HAVE_WEBKIT2
2995 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_UNDO);2855 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_UNDO);
2996#else
2997 webkit_web_view_undo (WEBKIT_WEB_VIEW (widget));
2998#endif
2999}2856}
30002857
3001static void2858static void
@@ -3004,11 +2861,7 @@
3004{2861{
3005 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));2862 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
3006 if (WEBKIT_IS_WEB_VIEW (widget))2863 if (WEBKIT_IS_WEB_VIEW (widget))
3007#ifdef HAVE_WEBKIT2
3008 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_REDO);2864 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_REDO);
3009#else
3010 webkit_web_view_redo (WEBKIT_WEB_VIEW (widget));
3011#endif
3012}2865}
30132866
3014static void2867static void
@@ -3018,10 +2871,8 @@
3018 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));2871 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
3019 if (G_LIKELY (widget) && g_signal_lookup ("cut-clipboard", G_OBJECT_TYPE (widget)))2872 if (G_LIKELY (widget) && g_signal_lookup ("cut-clipboard", G_OBJECT_TYPE (widget)))
3020 g_signal_emit_by_name (widget, "cut-clipboard");2873 g_signal_emit_by_name (widget, "cut-clipboard");
3021#ifdef HAVE_WEBKIT2
3022 else if (WEBKIT_IS_WEB_VIEW (widget))2874 else if (WEBKIT_IS_WEB_VIEW (widget))
3023 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_CUT);2875 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_CUT);
3024#endif
3025}2876}
30262877
3027static void2878static void
@@ -3031,10 +2882,8 @@
3031 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));2882 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
3032 if (G_LIKELY (widget) && g_signal_lookup ("copy-clipboard", G_OBJECT_TYPE (widget)))2883 if (G_LIKELY (widget) && g_signal_lookup ("copy-clipboard", G_OBJECT_TYPE (widget)))
3033 g_signal_emit_by_name (widget, "copy-clipboard");2884 g_signal_emit_by_name (widget, "copy-clipboard");
3034#ifdef HAVE_WEBKIT2
3035 else if (WEBKIT_IS_WEB_VIEW (widget))2885 else if (WEBKIT_IS_WEB_VIEW (widget))
3036 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_COPY);2886 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_COPY);
3037#endif
3038}2887}
30392888
3040static void2889static void
@@ -3044,10 +2893,8 @@
3044 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));2893 GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
3045 if (G_LIKELY (widget) && g_signal_lookup ("paste-clipboard", G_OBJECT_TYPE (widget)))2894 if (G_LIKELY (widget) && g_signal_lookup ("paste-clipboard", G_OBJECT_TYPE (widget)))
3046 g_signal_emit_by_name (widget, "paste-clipboard");2895 g_signal_emit_by_name (widget, "paste-clipboard");
3047#ifdef HAVE_WEBKIT2
3048 else if (WEBKIT_IS_WEB_VIEW (widget))2896 else if (WEBKIT_IS_WEB_VIEW (widget))
3049 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_PASTE);2897 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_PASTE);
3050#endif
3051}2898}
30522899
3053static void2900static void
@@ -3059,10 +2906,6 @@
3059 {2906 {
3060 if (GTK_IS_EDITABLE (widget))2907 if (GTK_IS_EDITABLE (widget))
3061 gtk_editable_delete_selection (GTK_EDITABLE (widget));2908 gtk_editable_delete_selection (GTK_EDITABLE (widget));
3062#ifndef HAVE_WEBKIT2
3063 else if (WEBKIT_IS_WEB_VIEW (widget))
3064 webkit_web_view_delete_selection (WEBKIT_WEB_VIEW (widget));
3065#endif
3066 else if (GTK_IS_TEXT_VIEW (widget))2909 else if (GTK_IS_TEXT_VIEW (widget))
3067 gtk_text_buffer_delete_selection (2910 gtk_text_buffer_delete_selection (
3068 gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)), TRUE, FALSE);2911 gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)), TRUE, FALSE);
@@ -3078,10 +2921,8 @@
3078 {2921 {
3079 if (GTK_IS_EDITABLE (widget))2922 if (GTK_IS_EDITABLE (widget))
3080 gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);2923 gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
3081#ifdef HAVE_WEBKIT2
3082 else if (WEBKIT_IS_WEB_VIEW (widget))2924 else if (WEBKIT_IS_WEB_VIEW (widget))
3083 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_SELECT_ALL);2925 webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (widget), WEBKIT_EDITING_COMMAND_SELECT_ALL);
3084#endif
3085 else if (g_signal_lookup ("select-all", G_OBJECT_TYPE (widget)))2926 else if (g_signal_lookup ("select-all", G_OBJECT_TYPE (widget)))
3086 {2927 {
3087 if (GTK_IS_TEXT_VIEW (widget))2928 if (GTK_IS_TEXT_VIEW (widget))
@@ -3595,11 +3436,7 @@
3595 encoding = "ISO-8859-1";3436 encoding = "ISO-8859-1";
3596 else3437 else
3597 g_assert_not_reached ();3438 g_assert_not_reached ();
3598 #ifdef HAVE_WEBKIT2
3599 webkit_web_view_set_custom_charset (web_view, encoding);3439 webkit_web_view_set_custom_charset (web_view, encoding);
3600 #else
3601 webkit_web_view_set_custom_encoding (web_view, encoding);
3602 #endif
3603}3440}
36043441
3605static void3442static void
@@ -3623,12 +3460,7 @@
3623 GList* files = g_list_append (NULL, file);3460 GList* files = g_list_append (NULL, file);
3624 GError* error = NULL;3461 GError* error = NULL;
3625 GdkDisplay* display = gtk_widget_get_display (view);3462 GdkDisplay* display = gtk_widget_get_display (view);
3626 #if GTK_CHECK_VERSION (3, 0, 0)
3627 GdkAppLaunchContext* ctx = gdk_display_get_app_launch_context (display);3463 GdkAppLaunchContext* ctx = gdk_display_get_app_launch_context (display);
3628 #else
3629 GdkAppLaunchContext* ctx = gdk_app_launch_context_new ();
3630 gdk_app_launch_context_set_display (ctx, display);
3631 #endif
3632 if (!g_app_info_launch (info, files, G_APP_LAUNCH_CONTEXT (ctx), &error))3464 if (!g_app_info_launch (info, files, G_APP_LAUNCH_CONTEXT (ctx), &error))
3633 {3465 {
3634 g_printerr ("Failed to open editor: %s", error->message);3466 g_printerr ("Failed to open editor: %s", error->message);
@@ -3667,7 +3499,7 @@
3667 if (!katze_object_get_boolean (browser->settings, "enable-caret-browsing"))3499 if (!katze_object_get_boolean (browser->settings, "enable-caret-browsing"))
3668 {3500 {
3669 dialog = gtk_message_dialog_new (GTK_WINDOW (browser),3501 dialog = gtk_message_dialog_new (GTK_WINDOW (browser),
3670 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,3502 GTK_DIALOG_DESTROY_WITH_PARENT,
3671 GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,3503 GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
3672 _("Toggle text cursor navigation"));3504 _("Toggle text cursor navigation"));
3673 gtk_window_set_title (GTK_WINDOW (dialog), _("Toggle text cursor navigation"));3505 gtk_window_set_title (GTK_WINDOW (dialog), _("Toggle text cursor navigation"));
@@ -3833,15 +3665,9 @@
3833 if (middle_click)3665 if (middle_click)
3834 {3666 {
3835 WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));3667 WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
3836 #ifdef HAVE_WEBKIT2
3837 WebKitBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);3668 WebKitBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);
3838 WebKitBackForwardListItem* item = webkit_back_forward_list_get_back_item (list);3669 WebKitBackForwardListItem* item = webkit_back_forward_list_get_back_item (list);
3839 const gchar* back_uri = webkit_back_forward_list_item_get_uri (item);3670 const gchar* back_uri = webkit_back_forward_list_item_get_uri (item);
3840 #else
3841 WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);
3842 WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_forward_item (list);
3843 const gchar* back_uri = webkit_web_history_item_get_uri (item);
3844 #endif
38453671
3846 GtkWidget* new_view = midori_browser_add_uri (browser, back_uri);3672 GtkWidget* new_view = midori_browser_add_uri (browser, back_uri);
3847 midori_browser_set_current_tab_smartly (browser, new_view);3673 midori_browser_set_current_tab_smartly (browser, new_view);
@@ -3856,16 +3682,9 @@
3856 if (middle_click)3682 if (middle_click)
3857 {3683 {
3858 WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));3684 WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
3859 #ifdef HAVE_WEBKIT2
3860 WebKitBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);3685 WebKitBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);
3861 WebKitBackForwardListItem* item = webkit_back_forward_list_get_forward_item (list);3686 WebKitBackForwardListItem* item = webkit_back_forward_list_get_forward_item (list);
3862 const gchar* forward_uri = webkit_back_forward_list_item_get_uri (item);3687 const gchar* forward_uri = webkit_back_forward_list_item_get_uri (item);
3863 #else
3864 WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list (web_view);
3865 WebKitWebHistoryItem* item = webkit_web_back_forward_list_get_forward_item (list);
3866 const gchar* forward_uri = webkit_web_history_item_get_uri (item);
3867 #endif
3868
3869 GtkWidget* new_view = midori_browser_add_uri (browser, forward_uri);3688 GtkWidget* new_view = midori_browser_add_uri (browser, forward_uri);
3870 midori_browser_set_current_tab_smartly (browser, new_view);3689 midori_browser_set_current_tab_smartly (browser, new_view);
3871 }3690 }
@@ -4538,7 +4357,7 @@
45384357
4539 dialog = gtk_dialog_new_with_buttons (4358 dialog = gtk_dialog_new_with_buttons (
4540 _("Import bookmarks…"), GTK_WINDOW (browser),4359 _("Import bookmarks…"), GTK_WINDOW (browser),
4541 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,4360 GTK_DIALOG_DESTROY_WITH_PARENT,
4542 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,4361 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
4543 _("_Import bookmarks"), GTK_RESPONSE_ACCEPT,4362 _("_Import bookmarks"), GTK_RESPONSE_ACCEPT,
4544 NULL);4363 NULL);
@@ -6175,13 +5994,6 @@
6175 gtk_container_add (GTK_CONTAINER (throbber_box), browser->throbber);5994 gtk_container_add (GTK_CONTAINER (throbber_box), browser->throbber);
6176 gtk_widget_show (throbber_box);5995 gtk_widget_show (throbber_box);
6177 gtk_container_add (GTK_CONTAINER (menuitem), throbber_box);5996 gtk_container_add (GTK_CONTAINER (menuitem), throbber_box);
6178 #if GTK_CHECK_VERSION (3, 2, 0)
6179 /* FIXME: Doesn't work */
6180 gtk_widget_set_hexpand (menuitem, TRUE);
6181 gtk_widget_set_halign (menuitem, GTK_ALIGN_END);
6182 #else
6183 gtk_menu_item_set_right_justified (GTK_MENU_ITEM (menuitem), TRUE);
6184 #endif
6185 gtk_menu_shell_append (GTK_MENU_SHELL (browser->menubar), menuitem);5997 gtk_menu_shell_append (GTK_MENU_SHELL (browser->menubar), menuitem);
61865998
6187 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (5999 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (
@@ -7031,11 +6843,6 @@
7031 g_return_if_fail (MIDORI_IS_BROWSER (browser));6843 g_return_if_fail (MIDORI_IS_BROWSER (browser));
7032 g_return_if_fail (GTK_IS_WIDGET (view));6844 g_return_if_fail (GTK_IS_WIDGET (view));
70336845
7034#ifndef HAVE_WEBKIT2
7035 if (!g_object_get_data (G_OBJECT (webkit_get_default_session ()),
7036 "midori-session-initialized"))
7037 g_critical ("midori_load_soup_session was not called!");
7038#endif
7039 g_signal_emit (browser, signals[ADD_TAB], 0, view);6846 g_signal_emit (browser, signals[ADD_TAB], 0, view);
7040}6847}
70416848
70426849
=== modified file 'midori/midori-browser.h'
--- midori/midori-browser.h 2015-05-24 00:19:21 +0000
+++ midori/midori-browser.h 2017-11-26 09:48:19 +0000
@@ -40,11 +40,7 @@
40 /* Signals */40 /* Signals */
41 void41 void
42 (*window_object_cleared) (MidoriBrowser* browser,42 (*window_object_cleared) (MidoriBrowser* browser,
43#ifndef HAVE_WEBKIT2
44 WebKitWebFrame* web_frame,
45#else
46 void* web_frame,43 void* web_frame,
47#endif
48 JSContextRef* context,44 JSContextRef* context,
49 JSObjectRef* window_object);45 JSObjectRef* window_object);
50 void46 void
5147
=== modified file 'midori/midori-download.vala'
--- midori/midori-download.vala 2016-01-15 19:18:17 +0000
+++ midori/midori-download.vala 2017-11-26 09:48:19 +0000
@@ -16,20 +16,9 @@
16namespace Midori {16namespace Midori {
17 namespace Download {17 namespace Download {
18 public static bool is_finished (WebKit.Download download) {18 public static bool is_finished (WebKit.Download download) {
19#if !HAVE_WEBKIT2
20 switch (download.status) {
21 case WebKit.DownloadStatus.FINISHED:
22 case WebKit.DownloadStatus.CANCELLED:
23 case WebKit.DownloadStatus.ERROR:
24 return true;
25 default:
26 return false;
27 }
28#else
29 if (download.estimated_progress == 1)19 if (download.estimated_progress == 1)
30 return true;20 return true;
31 return false;21 return false;
32#endif
33 }22 }
3423
35 public static int get_type (WebKit.Download download) {24 public static int get_type (WebKit.Download download) {
@@ -40,23 +29,14 @@
40 download.set_data<int> ("midori-download-type", type);29 download.set_data<int> ("midori-download-type", type);
41 }30 }
4231
43#if HAVE_WEBKIT2
44 public static string get_filename (WebKit.Download download) {32 public static string get_filename (WebKit.Download download) {
45 return download.get_data<string> ("midori-download-filename");33 return download.get_data<string> ("midori-download-filename");
46 }34 }
47 public static void set_filename (WebKit.Download download, string name) {35 public static void set_filename (WebKit.Download download, string name) {
48 download.set_data<string> ("midori-download-filename", name);36 download.set_data<string> ("midori-download-filename", name);
49 }37 }
50#endif
51 public static double get_progress (WebKit.Download download) {38 public static double get_progress (WebKit.Download download) {
52#if !HAVE_WEBKIT2
53 /* Avoid a bug in WebKit */
54 if (download.status == WebKit.DownloadStatus.CREATED)
55 return 0.0;
56 return download.progress;
57#else
58 return download.estimated_progress;39 return download.estimated_progress;
59#endif
60 }40 }
6141
62 public static string calculate_tooltip (WebKit.Download download) {42 public static string calculate_tooltip (WebKit.Download download) {
@@ -138,13 +118,9 @@
138 }118 }
139119
140 public static string get_content_type (WebKit.Download download, string? mime_type) {120 public static string get_content_type (WebKit.Download download, string? mime_type) {
141#if HAVE_WEBKIT2
142 string? content_type = ContentType.guess (download.response.suggested_filename == null ?121 string? content_type = ContentType.guess (download.response.suggested_filename == null ?
143 download.destination : download.response.suggested_filename,122 download.destination : download.response.suggested_filename,
144 null, null);123 null, null);
145#else
146 string? content_type = ContentType.guess (download.suggested_filename, null, null);
147#endif
148 if (content_type == null) {124 if (content_type == null) {
149 content_type = ContentType.from_mime_type (mime_type);125 content_type = ContentType.from_mime_type (mime_type);
150 if (content_type == null)126 if (content_type == null)
@@ -157,24 +133,14 @@
157 int status = download.get_data<int> ("checksum-status");133 int status = download.get_data<int> ("checksum-status");
158 if (status == 0) {134 if (status == 0) {
159 /* Link Fingerprint */135 /* Link Fingerprint */
160 #if HAVE_WEBKIT2
161 string? original_uri = download.get_request ().uri;136 string? original_uri = download.get_request ().uri;
162 #else
163 string? original_uri = download.network_request.get_data<string> ("midori-original-uri");
164 if (original_uri == null)
165 original_uri = download.get_uri ();
166 #endif
167 string? fingerprint;137 string? fingerprint;
168 ChecksumType checksum_type = URI.get_fingerprint (original_uri, out fingerprint, null);138 ChecksumType checksum_type = URI.get_fingerprint (original_uri, out fingerprint, null);
169 /* By default, no wrong checksum */139 /* By default, no wrong checksum */
170 status = 2;140 status = 2;
171 if (fingerprint != null) {141 if (fingerprint != null) {
172 try {142 try {
173 #if HAVE_WEBKIT2
174 string filename = Filename.from_uri (download.destination);143 string filename = Filename.from_uri (download.destination);
175 #else
176 string filename = Filename.from_uri (download.destination_uri);
177 #endif
178 string contents;144 string contents;
179 size_t length;145 size_t length;
180 bool y = FileUtils.get_contents (filename, out contents, out length);146 bool y = FileUtils.get_contents (filename, out contents, out length);
@@ -265,11 +231,7 @@
265 Tab? tab = null;231 Tab? tab = null;
266 browser.get ("tab", &tab);232 browser.get ("tab", &tab);
267 if (tab != null)233 if (tab != null)
268 #if HAVE_WEBKIT2
269 return tab.open_uri (download.destination);234 return tab.open_uri (download.destination);
270 #else
271 return tab.open_uri (download.destination_uri);
272 #endif
273 }235 }
274 return false;236 return false;
275 }237 }
276238
=== modified file 'midori/midori-frontend.c'
--- midori/midori-frontend.c 2016-01-23 19:21:31 +0000
+++ midori/midori-frontend.c 2017-11-26 09:48:19 +0000
@@ -175,9 +175,6 @@
175 guint i;175 guint i;
176176
177 midori_paths_init (MIDORI_RUNTIME_MODE_PRIVATE, config);177 midori_paths_init (MIDORI_RUNTIME_MODE_PRIVATE, config);
178#ifndef HAVE_WEBKIT2
179 g_object_set_data (G_OBJECT (webkit_get_default_session ()), "pass-through-console", (void*)1);
180#endif
181178
182 /* Mask the timezone, which can be read by Javascript */179 /* Mask the timezone, which can be read by Javascript */
183 g_setenv ("TZ", "UTC", TRUE);180 g_setenv ("TZ", "UTC", TRUE);
@@ -223,11 +220,9 @@
223 midori_browser_set_action_visible (browser, "Tools", FALSE);220 midori_browser_set_action_visible (browser, "Tools", FALSE);
224 midori_browser_set_action_visible (browser, "ClearPrivateData", FALSE);221 midori_browser_set_action_visible (browser, "ClearPrivateData", FALSE);
225 midori_browser_set_action_visible (browser, "AddSpeedDial", FALSE);222 midori_browser_set_action_visible (browser, "AddSpeedDial", FALSE);
226 #if GTK_CHECK_VERSION (3, 0, 0)
227 g_object_set (gtk_widget_get_settings (GTK_WIDGET (browser)),223 g_object_set (gtk_widget_get_settings (GTK_WIDGET (browser)),
228 "gtk-application-prefer-dark-theme", TRUE,224 "gtk-application-prefer-dark-theme", TRUE,
229 NULL);225 NULL);
230 #endif
231226
232 if (webapp != NULL)227 if (webapp != NULL)
233 {228 {
@@ -420,7 +415,7 @@
420 GtkWidget* label = (GtkWidget*)g_list_nth_data (ch, 0);415 GtkWidget* label = (GtkWidget*)g_list_nth_data (ch, 0);
421 g_list_free (ch);416 g_list_free (ch);
422 GtkRequisition req;417 GtkRequisition req;
423 gtk_widget_size_request (content_area, &req);418 gtk_widget_get_preferred_size (content_area, &req, NULL);
424 gtk_widget_set_size_request (label, req.width * 0.9, -1);419 gtk_widget_set_size_request (label, req.width * 0.9, -1);
425420
426 response = midori_dialog_run (GTK_DIALOG (dialog));421 response = midori_dialog_run (GTK_DIALOG (dialog));
427422
=== modified file 'midori/midori-locationaction.c'
--- midori/midori-locationaction.c 2015-08-10 23:42:56 +0000
+++ midori/midori-locationaction.c 2017-11-26 09:48:19 +0000
@@ -480,17 +480,11 @@
480 return;480 return;
481481
482 gtk_widget_get_allocation (widget, &alloc);482 gtk_widget_get_allocation (widget, &alloc);
483 #if GTK_CHECK_VERSION (3, 0, 0)
484 gtk_widget_get_preferred_size (widget, &widget_req, NULL);483 gtk_widget_get_preferred_size (widget, &widget_req, NULL);
485 #else
486 gtk_widget_size_request (widget, &widget_req);
487 #endif
488 gdk_window_get_origin (window, &wx, &wy);484 gdk_window_get_origin (window, &wx, &wy);
489485
490 #if GTK_CHECK_VERSION (3, 0, 0)
491 wx += alloc.x;486 wx += alloc.x;
492 wy += alloc.y + (alloc.height - widget_req.height) / 2;487 wy += alloc.y + (alloc.height - widget_req.height) / 2;
493 #endif
494488
495 gtk_tree_view_column_cell_get_size (489 gtk_tree_view_column_cell_get_size (
496 gtk_tree_view_get_column (GTK_TREE_VIEW (action->treeview), 0),490 gtk_tree_view_get_column (GTK_TREE_VIEW (action->treeview), 0),
@@ -514,15 +508,10 @@
514 width = MIN (alloc.width, monitor.width);508 width = MIN (alloc.width, monitor.width);
515509
516 gtk_tree_view_columns_autosize (GTK_TREE_VIEW (action->treeview));510 gtk_tree_view_columns_autosize (GTK_TREE_VIEW (action->treeview));
517 #if GTK_CHECK_VERSION (3, 0, 0)
518 gtk_widget_set_size_request (scrolled, width, -1);511 gtk_widget_set_size_request (scrolled, width, -1);
519 gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (scrolled), width);512 gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (scrolled), width);
520 gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scrolled), items * height);513 gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scrolled), items * height);
521 gtk_widget_get_preferred_size (popup, &menu_req, NULL);514 gtk_widget_get_preferred_size (popup, &menu_req, NULL);
522 #else
523 gtk_widget_set_size_request (scrolled, width, items * height);
524 gtk_widget_size_request (popup, &menu_req);
525 #endif
526515
527 if (wx < monitor.x)516 if (wx < monitor.x)
528 wx = monitor.x;517 wx = monitor.x;
@@ -704,9 +693,6 @@
704 gtk_widget_set_size_request (gtk_scrolled_window_get_vscrollbar (693 gtk_widget_set_size_request (gtk_scrolled_window_get_vscrollbar (
705 GTK_SCROLLED_WINDOW (scrolled)), -1, 0);694 GTK_SCROLLED_WINDOW (scrolled)), -1, 0);
706 action->treeview = treeview;695 action->treeview = treeview;
707 #if !GTK_CHECK_VERSION (3, 4, 0)
708 gtk_widget_realize (action->treeview);
709 #endif
710696
711 column = gtk_tree_view_column_new ();697 column = gtk_tree_view_column_new ();
712 renderer = gtk_cell_renderer_pixbuf_new ();698 renderer = gtk_cell_renderer_pixbuf_new ();
@@ -746,9 +732,7 @@
746 gtk_window_set_screen (GTK_WINDOW (action->popup),732 gtk_window_set_screen (GTK_WINDOW (action->popup),
747 gtk_widget_get_screen (action->entry));733 gtk_widget_get_screen (action->entry));
748 gtk_window_set_transient_for (GTK_WINDOW (action->popup), GTK_WINDOW (toplevel));734 gtk_window_set_transient_for (GTK_WINDOW (action->popup), GTK_WINDOW (toplevel));
749 #if GTK_CHECK_VERSION (3, 4, 0)
750 gtk_window_set_attached_to (GTK_WINDOW (action->popup), action->entry);735 gtk_window_set_attached_to (GTK_WINDOW (action->popup), action->entry);
751 #endif
752 gtk_widget_show (action->popup);736 gtk_widget_show (action->popup);
753 }737 }
754738
@@ -950,9 +934,7 @@
950 gtk_container_add (GTK_CONTAINER (toolitem), alignment);934 gtk_container_add (GTK_CONTAINER (toolitem), alignment);
951935
952 entry = gtk_entry_new ();936 entry = gtk_entry_new ();
953 #if GTK_CHECK_VERSION (3, 6, 0)
954 gtk_entry_set_input_purpose (GTK_ENTRY (entry), GTK_INPUT_PURPOSE_URL);937 gtk_entry_set_input_purpose (GTK_ENTRY (entry), GTK_INPUT_PURPOSE_URL);
955 #endif
956 gtk_entry_set_icon_activatable (GTK_ENTRY (entry),938 gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
957 GTK_ENTRY_ICON_PRIMARY, TRUE);939 GTK_ENTRY_ICON_PRIMARY, TRUE);
958 gtk_entry_set_icon_activatable (GTK_ENTRY (entry),940 gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
@@ -1292,36 +1274,7 @@
1292#ifdef HAVE_GCR1274#ifdef HAVE_GCR
1293 #define GCR_API_SUBJECT_TO_CHANGE1275 #define GCR_API_SUBJECT_TO_CHANGE
1294 #include <gcr/gcr.h>1276 #include <gcr/gcr.h>
1295#endif1277
1296
1297#ifndef HAVE_WEBKIT2
1298static GHashTable* message_map = NULL;
1299void
1300midori_map_add_message (SoupMessage* message)
1301{
1302 SoupURI* uri = soup_message_get_uri (message);
1303 if (message_map == NULL)
1304 message_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1305 g_return_if_fail (uri && uri->host);
1306 g_hash_table_insert (message_map, g_strdup (uri->host), g_object_ref (message));
1307}
1308
1309SoupMessage*
1310midori_map_get_message (SoupMessage* message)
1311{
1312 SoupURI* uri = soup_message_get_uri (message);
1313 SoupMessage* full;
1314 g_return_val_if_fail (uri && uri->host, message);
1315 if (message_map == NULL)
1316 message_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1317 full = g_hash_table_lookup (message_map, uri->host);
1318 if (full != NULL)
1319 return full;
1320 return message;
1321}
1322#endif
1323
1324#ifdef HAVE_GCR
1325typedef enum {1278typedef enum {
1326 MIDORI_CERT_TRUST,1279 MIDORI_CERT_TRUST,
1327 MIDORI_CERT_REVOKE,1280 MIDORI_CERT_REVOKE,
@@ -1369,7 +1322,6 @@
1369 gtk_widget_hide (dialog);1322 gtk_widget_hide (dialog);
1370}1323}
13711324
1372#if GTK_CHECK_VERSION (3, 12, 0)
1373static void1325static void
1374midori_location_action_button_cb (GtkWidget* button,1326midori_location_action_button_cb (GtkWidget* button,
1375 GtkWidget* dialog)1327 GtkWidget* dialog)
@@ -1388,9 +1340,7 @@
1388 midori_location_action_cert_response_cb (dialog, response, gcr_cert);1340 midori_location_action_cert_response_cb (dialog, response, gcr_cert);
1389}1341}
1390#endif1342#endif
1391#endif
13921343
1393#if GTK_CHECK_VERSION (3, 12, 0)
1394static gboolean1344static gboolean
1395midori_location_action_popover_button_press_event_cb (GtkWidget* widget,1345midori_location_action_popover_button_press_event_cb (GtkWidget* widget,
1396 GdkEventButton* event,1346 GdkEventButton* event,
@@ -1423,7 +1373,6 @@
1423 gtk_widget_hide (widget);1373 gtk_widget_hide (widget);
1424 return GDK_EVENT_STOP;1374 return GDK_EVENT_STOP;
1425}1375}
1426#endif
14271376
1428const gchar*1377const gchar*
1429midori_location_action_tls_flags_to_string (GTlsCertificateFlags tls_flags)1378midori_location_action_tls_flags_to_string (GTlsCertificateFlags tls_flags)
@@ -1458,14 +1407,7 @@
14581407
1459 MidoriBrowser* browser = midori_browser_get_for_widget (widget);1408 MidoriBrowser* browser = midori_browser_get_for_widget (widget);
1460 MidoriView* view = MIDORI_VIEW (midori_browser_get_current_tab (browser));1409 MidoriView* view = MIDORI_VIEW (midori_browser_get_current_tab (browser));
1461 #ifdef HAVE_WEBKIT2
1462 void* request = NULL;1410 void* request = NULL;
1463 #else
1464 WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
1465 WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (web_view);
1466 WebKitWebDataSource* source = webkit_web_frame_get_data_source (web_frame);
1467 WebKitNetworkRequest* request = webkit_web_data_source_get_request (source);
1468 #endif
1469 midori_view_get_tls_info (view, request, &tls_cert, &tls_flags, &hostname);1411 midori_view_get_tls_info (view, request, &tls_cert, &tls_flags, &hostname);
1470 if (tls_cert == NULL)1412 if (tls_cert == NULL)
1471 {1413 {
@@ -1482,14 +1424,11 @@
1482 der_cert->data, der_cert->len);1424 der_cert->data, der_cert->len);
1483 g_byte_array_unref (der_cert);1425 g_byte_array_unref (der_cert);
14841426
1485 #if GTK_CHECK_VERSION (3, 0, 0)
1486 GtkWidget* details;1427 GtkWidget* details;
1487 details = (GtkWidget*)gcr_certificate_details_widget_new (gcr_cert);1428 details = (GtkWidget*)gcr_certificate_details_widget_new (gcr_cert);
1488 gtk_widget_show (details);1429 gtk_widget_show (details);
1489 gtk_container_add (GTK_CONTAINER (box), details);1430 gtk_container_add (GTK_CONTAINER (box), details);
1490 #endif
14911431
1492 #if GTK_CHECK_VERSION (3, 12, 0)
1493 GtkWidget* button;1432 GtkWidget* button;
1494 GtkWidget* actions = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);1433 GtkWidget* actions = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
1495 gtk_box_pack_start (GTK_BOX (box), actions, FALSE, FALSE, 0);1434 gtk_box_pack_start (GTK_BOX (box), actions, FALSE, FALSE, 0);
@@ -1509,28 +1448,11 @@
1509 g_signal_connect (button, "clicked", G_CALLBACK (midori_location_action_button_cb), dialog);1448 g_signal_connect (button, "clicked", G_CALLBACK (midori_location_action_button_cb), dialog);
1510 gtk_box_pack_end (GTK_BOX (actions), button, FALSE, FALSE, 0);1449 gtk_box_pack_end (GTK_BOX (actions), button, FALSE, FALSE, 0);
1511 gtk_widget_show_all (actions);1450 gtk_widget_show_all (actions);
1512 #else
1513 if (gcr_trust_is_certificate_pinned (gcr_cert, GCR_PURPOSE_SERVER_AUTH, hostname, NULL, NULL))
1514 gtk_dialog_add_buttons (GTK_DIALOG (dialog),
1515 ("_Don't trust this website"), MIDORI_CERT_REVOKE, NULL);
1516 else if (tls_flags > 0)
1517 gtk_dialog_add_buttons (GTK_DIALOG (dialog),
1518 ("_Trust this website"), MIDORI_CERT_TRUST, NULL);
1519 gtk_container_child_set (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog))),
1520 gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Export certificate"), MIDORI_CERT_EXPORT),
1521 "secondary", TRUE, NULL);
1522 g_signal_connect (dialog, "response",
1523 G_CALLBACK (midori_location_action_cert_response_cb), gcr_cert);
1524 #endif
15251451
1526 g_object_set_data_full (G_OBJECT (gcr_cert), "peer", hostname, (GDestroyNotify)g_free);1452 g_object_set_data_full (G_OBJECT (gcr_cert), "peer", hostname, (GDestroyNotify)g_free);
1527 g_object_set_data_full (G_OBJECT (dialog), "gcr-cert", gcr_cert, (GDestroyNotify)g_object_unref);1453 g_object_set_data_full (G_OBJECT (dialog), "gcr-cert", gcr_cert, (GDestroyNotify)g_object_unref);
1528 #endif1454 #endif
15291455
1530 /* With GTK+2 the scrolled contents can't communicate a natural size to the window */
1531 #if !GTK_CHECK_VERSION (3, 0, 0)
1532 gtk_window_set_default_size (GTK_WINDOW (dialog), 250, 200);
1533 #endif
1534 if (!g_tls_certificate_get_issuer (tls_cert))1456 if (!g_tls_certificate_get_issuer (tls_cert))
1535 gtk_box_pack_start (box, gtk_label_new (_("Self-signed")), FALSE, FALSE, 0);1457 gtk_box_pack_start (box, gtk_label_new (_("Self-signed")), FALSE, FALSE, 0);
15361458
@@ -1588,7 +1510,6 @@
1588 GtkWidget* content_area;1510 GtkWidget* content_area;
1589 GtkWidget* hbox;1511 GtkWidget* hbox;
15901512
1591 #if GTK_CHECK_VERSION (3, 12, 0)
1592 dialog = gtk_popover_new (widget);1513 dialog = gtk_popover_new (widget);
1593 content_area = gtk_vbox_new (FALSE, 6);1514 content_area = gtk_vbox_new (FALSE, 6);
1594 gtk_container_add (GTK_CONTAINER (dialog), content_area);1515 gtk_container_add (GTK_CONTAINER (dialog), content_area);
@@ -1602,13 +1523,6 @@
1602 gtk_popover_set_relative_to (GTK_POPOVER (dialog), widget);1523 gtk_popover_set_relative_to (GTK_POPOVER (dialog), widget);
1603 gtk_popover_set_pointing_to (GTK_POPOVER (dialog), &icon_rect);1524 gtk_popover_set_pointing_to (GTK_POPOVER (dialog), &icon_rect);
1604 g_signal_connect (dialog, "closed", G_CALLBACK (gtk_widget_destroyed), &dialog);1525 g_signal_connect (dialog, "closed", G_CALLBACK (gtk_widget_destroyed), &dialog);
1605 #else
1606 const gchar* title = _("Security details");
1607 dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (gtk_widget_get_toplevel (widget)),
1608 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, NULL, NULL);
1609 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
1610 g_signal_connect (dialog, "destroy", G_CALLBACK (gtk_widget_destroyed), &dialog);
1611 #endif
1612 gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);1526 gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
1613 hbox = gtk_hbox_new (FALSE, 6);1527 hbox = gtk_hbox_new (FALSE, 6);
1614 gtk_box_pack_start (GTK_BOX (hbox), gtk_image_new_from_gicon (1528 gtk_box_pack_start (GTK_BOX (hbox), gtk_image_new_from_gicon (
16151529
=== modified file 'midori/midori-notebook.vala'
--- midori/midori-notebook.vala 2017-02-15 18:50:47 +0000
+++ midori/midori-notebook.vala 2017-11-26 09:48:19 +0000
@@ -42,10 +42,6 @@
42 close = new Gtk.Button ();42 close = new Gtk.Button ();
43 close.relief = Gtk.ReliefStyle.NONE;43 close.relief = Gtk.ReliefStyle.NONE;
44 close.set_focus_on_click (false);44 close.set_focus_on_click (false);
45#if !HAVE_GTK3
46 close.name = "midori-close-button";
47 close.style_set.connect (close_style_set);
48#endif
49 icon = new Gtk.Image.from_gicon (new ThemedIcon.with_default_fallbacks ("window-close-symbolic"), Gtk.IconSize.MENU);45 icon = new Gtk.Image.from_gicon (new ThemedIcon.with_default_fallbacks ("window-close-symbolic"), Gtk.IconSize.MENU);
50 close.add (icon);46 close.add (icon);
51 align = new Gtk.Alignment (1.0f, 0.5f, 0.0f, 0.0f);47 align = new Gtk.Alignment (1.0f, 0.5f, 0.0f, 0.0f);
@@ -74,14 +70,6 @@
74 notify_property ("close-button-visible");70 notify_property ("close-button-visible");
75 }71 }
7672
77#if !HAVE_GTK3
78 void close_style_set (Gtk.Style? previous_style) {
79 Gtk.Requisition size;
80 close.child.size_request (out size);
81 close.set_size_request (size.width, size.height);
82 }
83#endif
84
85 void close_clicked () {73 void close_clicked () {
86 tab.destroy ();74 tab.destroy ();
87 }75 }
@@ -103,7 +91,6 @@
103 tooltip_text = label.label;91 tooltip_text = label.label;
104 }92 }
10593
106#if HAVE_GTK3
107 GLib.Icon? scale_if_needed (GLib.Icon? icon, int scale) {94 GLib.Icon? scale_if_needed (GLib.Icon? icon, int scale) {
108 if (icon is Gdk.Pixbuf) {95 if (icon is Gdk.Pixbuf) {
109 var pixbuf = icon as Gdk.Pixbuf;96 var pixbuf = icon as Gdk.Pixbuf;
@@ -117,16 +104,11 @@
117 }104 }
118 return icon;105 return icon;
119 }106 }
120#endif
121107
122 void icon_changed (GLib.ParamSpec pspec) {108 void icon_changed (GLib.ParamSpec pspec) {
123 GLib.Icon? icon;109 GLib.Icon? icon;
124 tab.get ("icon", out icon);110 tab.get ("icon", out icon);
125#if HAVE_GTK3
126 this.icon.set_from_gicon (scale_if_needed (icon, scale_factor), Gtk.IconSize.MENU);111 this.icon.set_from_gicon (scale_if_needed (icon, scale_factor), Gtk.IconSize.MENU);
127#else
128 this.icon.set_from_gicon (icon, Gtk.IconSize.MENU);
129#endif
130 }112 }
131113
132 void colors_changed () {114 void colors_changed () {
@@ -174,19 +156,6 @@
174 public Gtk.Notebook notebook;156 public Gtk.Notebook notebook;
175 int last_tab_size = 0;157 int last_tab_size = 0;
176158
177#if !HAVE_GTK3
178 const string style_fixup = """
179 style "midori-close-button-style"
180 {
181 GtkWidget::focus-padding = 0
182 GtkWidget::focus-line-width = 0
183 xthickness = 0
184 ythickness = 0
185 }
186 widget "*.midori-close-button" style "midori-close-button-style"
187 """;
188#endif
189
190 /* Since: 0.5.7 */159 /* Since: 0.5.7 */
191 public uint count { get; private set; default = 0; }160 public uint count { get; private set; default = 0; }
192 /* Since: 0.5.7 */161 /* Since: 0.5.7 */
@@ -228,15 +197,7 @@
228 notebook.set ("group-name", PACKAGE_NAME);197 notebook.set ("group-name", PACKAGE_NAME);
229 add (notebook);198 add (notebook);
230199
231#if HAVE_GTK3
232 get_style_context ().add_class ("dynamic-notebook");200 get_style_context ().add_class ("dynamic-notebook");
233#else
234 /* Remove the inner border between scrollbars and window border */
235 Gtk.RcStyle rcstyle = new Gtk.RcStyle ();
236 rcstyle.xthickness = 0;
237 notebook.modify_style (rcstyle);
238 Gtk.rc_parse_string (style_fixup);
239#endif
240 notify["index"].connect (index_changed);201 notify["index"].connect (index_changed);
241 notify["tab"].connect (tab_changed);202 notify["tab"].connect (tab_changed);
242 notify["labels-visible"].connect (labels_visible_changed);203 notify["labels-visible"].connect (labels_visible_changed);
@@ -443,17 +404,10 @@
443 }404 }
444405
445 /* Chain up drawing manually to circumvent parent checks */406 /* Chain up drawing manually to circumvent parent checks */
446#if HAVE_GTK3
447 public override bool draw (Cairo.Context cr) {407 public override bool draw (Cairo.Context cr) {
448 notebook.draw (cr);408 notebook.draw (cr);
449 return true;409 return true;
450 }410 }
451#else
452 public override bool expose_event (Gdk.EventExpose event) {
453 notebook.expose_event (event);
454 return true;
455 }
456#endif
457411
458 public override void forall_internal (bool include_internal, Gtk.Callback callback) {412 public override void forall_internal (bool include_internal, Gtk.Callback callback) {
459 if (include_internal)413 if (include_internal)
@@ -512,20 +466,12 @@
512 }466 }
513 }467 }
514468
515#if HAVE_GTK3
516 void size_allocated (Gtk.Allocation allocation) {469 void size_allocated (Gtk.Allocation allocation) {
517#else
518 void size_allocated (Gdk.Rectangle allocation) {
519#endif
520 if (labels_visible && count > 0)470 if (labels_visible && count > 0)
521 resize (allocation.width);471 resize (allocation.width);
522 }472 }
523473
524#if HAVE_GTK3
525 void page_switched (Gtk.Widget new_tab, uint new_index) {474 void page_switched (Gtk.Widget new_tab, uint new_index) {
526#else
527 void page_switched (Gtk.NotebookPage new_tab, uint new_index) {
528#endif
529 tab_switched (previous, new_tab as Tab);475 tab_switched (previous, new_tab as Tab);
530 previous = (Midori.Tab)new_tab;476 previous = (Midori.Tab)new_tab;
531477
532478
=== modified file 'midori/midori-panel.c'
--- midori/midori-panel.c 2015-07-06 21:26:46 +0000
+++ midori/midori-panel.c 2017-11-26 09:48:19 +0000
@@ -572,9 +572,6 @@
572 MidoriViewable* viewable)572 MidoriViewable* viewable)
573{573{
574 GtkWidget* scrolled;574 GtkWidget* scrolled;
575 #if !GTK_CHECK_VERSION (3, 0, 0)
576 GObjectClass* gobject_class;
577 #endif
578 GtkWidget* widget;575 GtkWidget* widget;
579 GtkWidget* toolbar;576 GtkWidget* toolbar;
580 GtkToolItem* toolitem;577 GtkToolItem* toolitem;
@@ -585,11 +582,9 @@
585 g_return_val_if_fail (MIDORI_IS_PANEL (panel), -1);582 g_return_val_if_fail (MIDORI_IS_PANEL (panel), -1);
586 g_return_val_if_fail (MIDORI_IS_VIEWABLE (viewable), -1);583 g_return_val_if_fail (MIDORI_IS_VIEWABLE (viewable), -1);
587584
588 #if GTK_CHECK_VERSION (3, 2, 0)
589 if (GTK_IS_ORIENTABLE (viewable))585 if (GTK_IS_ORIENTABLE (viewable))
590 gtk_orientable_set_orientation (GTK_ORIENTABLE (viewable),586 gtk_orientable_set_orientation (GTK_ORIENTABLE (viewable),
591 GTK_ORIENTATION_VERTICAL);587 GTK_ORIENTATION_VERTICAL);
592 #endif
593588
594 if (GTK_IS_SCROLLED_WINDOW (viewable))589 if (GTK_IS_SCROLLED_WINDOW (viewable))
595 scrolled = (GtkWidget*)viewable;590 scrolled = (GtkWidget*)viewable;
@@ -601,12 +596,7 @@
601 GTK_POLICY_AUTOMATIC);596 GTK_POLICY_AUTOMATIC);
602 gtk_widget_set_can_focus (scrolled, TRUE);597 gtk_widget_set_can_focus (scrolled, TRUE);
603 gtk_widget_show (scrolled);598 gtk_widget_show (scrolled);
604 #if GTK_CHECK_VERSION (3, 0, 0)
605 if (GTK_IS_SCROLLABLE (viewable))599 if (GTK_IS_SCROLLABLE (viewable))
606 #else
607 gobject_class = G_OBJECT_GET_CLASS (viewable);
608 if (GTK_WIDGET_CLASS (gobject_class)->set_scroll_adjustments_signal)
609 #endif
610 widget = (GtkWidget*)viewable;600 widget = (GtkWidget*)viewable;
611 else601 else
612 {602 {
613603
=== modified file 'midori/midori-platform.h'
--- midori/midori-platform.h 2013-06-21 20:49:53 +0000
+++ midori/midori-platform.h 2017-11-26 09:48:19 +0000
@@ -13,7 +13,6 @@
13#define __MIDORI_PLATFORM_H__ 113#define __MIDORI_PLATFORM_H__ 1
1414
15#include "midori/midori-stock.h"15#include "midori/midori-stock.h"
16#include "katze/gtk3-compat.h"
17#include "midori/sokoke.h"16#include "midori/sokoke.h"
1817
19/* Common behavior modifiers */18/* Common behavior modifiers */
2019
=== modified file 'midori/midori-privatedata.c'
--- midori/midori-privatedata.c 2015-07-06 21:26:46 +0000
+++ midori/midori-privatedata.c 2017-11-26 09:48:19 +0000
@@ -191,7 +191,7 @@
191 /* i18n: Dialog: Clear Private Data, in the Tools menu */191 /* i18n: Dialog: Clear Private Data, in the Tools menu */
192 dialog = gtk_dialog_new_with_buttons (_("Clear Private Data"),192 dialog = gtk_dialog_new_with_buttons (_("Clear Private Data"),
193 GTK_WINDOW (browser),193 GTK_WINDOW (browser),
194 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,194 GTK_DIALOG_DESTROY_WITH_PARENT,
195 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,195 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
196 _("_Clear private data"), GTK_RESPONSE_ACCEPT, NULL);196 _("_Clear private data"), GTK_RESPONSE_ACCEPT, NULL);
197 button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);197 button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
198198
=== modified file 'midori/midori-searchaction.c'
--- midori/midori-searchaction.c 2015-07-06 21:26:46 +0000
+++ midori/midori-searchaction.c 2017-11-26 09:48:19 +0000
@@ -932,13 +932,7 @@
932 focused_frame = webkit_web_view_get_focused_frame (web_view);932 focused_frame = webkit_web_view_get_focused_frame (web_view);
933 if (focused_frame == NULL)933 if (focused_frame == NULL)
934 return NULL;934 return NULL;
935 #if WEBKIT_CHECK_VERSION (1, 9, 5)
936 doc = webkit_web_frame_get_dom_document (focused_frame);935 doc = webkit_web_frame_get_dom_document (focused_frame);
937 #else
938 if (focused_frame != webkit_web_view_get_main_frame (web_view))
939 return NULL;
940 doc = webkit_web_view_get_dom_document (web_view);
941 #endif
942936
943 active_element = webkit_dom_html_document_get_active_element ((WebKitDOMHTMLDocument*)doc);937 active_element = webkit_dom_html_document_get_active_element ((WebKitDOMHTMLDocument*)doc);
944 if (!WEBKIT_DOM_IS_HTML_INPUT_ELEMENT (active_element))938 if (!WEBKIT_DOM_IS_HTML_INPUT_ELEMENT (active_element))
@@ -1058,7 +1052,7 @@
1058 dialog = gtk_dialog_new_with_buttons (1052 dialog = gtk_dialog_new_with_buttons (
1059 new_engine ? _("Add search engine") : _("Edit search engine"),1053 new_engine ? _("Add search engine") : _("Edit search engine"),
1060 toplevel ? GTK_WINDOW (toplevel) : NULL,1054 toplevel ? GTK_WINDOW (toplevel) : NULL,
1061 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,1055 GTK_DIALOG_DESTROY_WITH_PARENT,
1062 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,1056 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1063 new_engine ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,1057 new_engine ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
1064 NULL);1058 NULL);
@@ -1422,7 +1416,7 @@
1422 gtk_widget_get_toplevel (search_action->last_proxy) : NULL;1416 gtk_widget_get_toplevel (search_action->last_proxy) : NULL;
1423 dialog = gtk_dialog_new_with_buttons (dialog_title,1417 dialog = gtk_dialog_new_with_buttons (dialog_title,
1424 toplevel ? GTK_WINDOW (toplevel) : NULL,1418 toplevel ? GTK_WINDOW (toplevel) : NULL,
1425 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,1419 GTK_DIALOG_DESTROY_WITH_PARENT,
1426 #if !HAVE_OSX1420 #if !HAVE_OSX
1427 GTK_STOCK_HELP, GTK_RESPONSE_HELP,1421 GTK_STOCK_HELP, GTK_RESPONSE_HELP,
1428 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,1422 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
14291423
=== modified file 'midori/midori-session.c'
--- midori/midori-session.c 2015-03-23 11:33:24 +0000
+++ midori/midori-session.c 2017-11-26 09:48:19 +0000
@@ -94,43 +94,18 @@
94}94}
95#endif95#endif
9696
97#if WEBKIT_CHECK_VERSION (1, 1, 21)
98static void97static void
99soup_session_settings_notify_first_party_cb (MidoriWebSettings* settings,98soup_session_settings_notify_first_party_cb (MidoriWebSettings* settings,
100 GParamSpec* pspec,99 GParamSpec* pspec,
101 gpointer user_data)100 gpointer user_data)
102{101{
103 gboolean yes = katze_object_get_boolean (settings, "first-party-cookies-only");102 gboolean yes = katze_object_get_boolean (settings, "first-party-cookies-only");
104#ifdef HAVE_WEBKIT2
105 WebKitWebContext* context = webkit_web_context_get_default ();103 WebKitWebContext* context = webkit_web_context_get_default ();
106 WebKitCookieManager* cookie_manager = webkit_web_context_get_cookie_manager (context);104 WebKitCookieManager* cookie_manager = webkit_web_context_get_cookie_manager (context);
107 webkit_cookie_manager_set_accept_policy (cookie_manager,105 webkit_cookie_manager_set_accept_policy (cookie_manager,
108 yes ? WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY106 yes ? WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY
109 : WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS);107 : WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS);
110#else108}
111 SoupSession* session = webkit_get_default_session ();
112 gpointer jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
113 g_object_set (jar, "accept-policy",
114 yes ? SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY
115 : SOUP_COOKIE_JAR_ACCEPT_ALWAYS, NULL);
116#endif
117}
118#endif
119
120#if !defined (HAVE_WEBKIT2)
121/* Implemented in MidoriLocationAction */
122void
123midori_map_add_message (SoupMessage* message);
124
125static void
126midori_soup_session_request_started_cb (SoupSession* session,
127 SoupMessage* message,
128 SoupSocket* socket,
129 gpointer user_data)
130{
131 midori_map_add_message (message);
132}
133#endif
134109
135#ifndef HAVE_WEBKIT2110#ifndef HAVE_WEBKIT2
136const gchar*111const gchar*
@@ -178,31 +153,12 @@
178gboolean153gboolean
179midori_load_soup_session (gpointer settings)154midori_load_soup_session (gpointer settings)
180{155{
181 #if WEBKIT_CHECK_VERSION (1, 1, 21)
182 g_signal_connect (settings, "notify::first-party-cookies-only",156 g_signal_connect (settings, "notify::first-party-cookies-only",
183 G_CALLBACK (soup_session_settings_notify_first_party_cb), NULL);157 G_CALLBACK (soup_session_settings_notify_first_party_cb), NULL);
184 #endif
185158
186#ifndef HAVE_WEBKIT2159#ifndef HAVE_WEBKIT2
187 SoupSession* session = webkit_get_default_session ();160 SoupSession* session = webkit_get_default_session ();
188161
189 #ifndef G_OS_WIN32
190 g_object_set (session,
191 "ssl-use-system-ca-file", TRUE,
192 "ssl-strict", FALSE,
193 NULL);
194 #else /* G_OS_WIN32 */
195 /* We cannot use "ssl-use-system-ca-file" on Windows
196 * some GTLS backend pieces are missing currently.
197 * Instead we specify the bundle we ship ourselves */
198 gchar* certificate_file = midori_paths_get_res_filename ("ca-bundle.crt");
199 g_object_set (session,
200 "ssl-ca-file", certificate_file,
201 "ssl-strict", FALSE,
202 NULL);
203 g_free (certificate_file);
204 #endif
205
206 g_object_set_data (G_OBJECT (session), "midori-settings", settings);162 g_object_set_data (G_OBJECT (session), "midori-settings", settings);
207 soup_session_settings_notify_http_proxy_cb (settings, NULL, session);163 soup_session_settings_notify_http_proxy_cb (settings, NULL, session);
208 g_signal_connect (settings, "notify::http-proxy",164 g_signal_connect (settings, "notify::http-proxy",
@@ -230,7 +186,6 @@
230 g_object_unref (logger);186 g_object_unref (logger);
231 }187 }
232188
233 g_object_set_data (G_OBJECT (session), "midori-session-initialized", (void*)1);
234#endif189#endif
235 return FALSE;190 return FALSE;
236}191}
237192
=== modified file 'midori/midori-settings.vala'
--- midori/midori-settings.vala 2013-11-24 21:50:38 +0000
+++ midori/midori-settings.vala 2017-11-26 09:48:19 +0000
@@ -19,23 +19,6 @@
19 FULLSCREEN19 FULLSCREEN
20 }20 }
21 /* Since: 0.1.3 */21 /* Since: 0.1.3 */
22#if !HAVE_WEBKIT2
23 public class Settings : WebKit.WebSettings {
24 /* Since: 0.5.0 */
25 public bool enable_javascript { get {
26 return enable_scripts;
27 } set {
28 enable_scripts = value;
29 } }
30 /* Since: 0.5.1 */
31 public string default_charset { owned get {
32 return default_encoding;
33 } set {
34 default_encoding = value;
35 } }
36 /* Since: 0.1.3 */
37 public bool zoom_text_and_images { get; set; default = true; }
38#else
39 public class Settings : WebKit.Settings {22 public class Settings : WebKit.Settings {
40 public bool zoom_text_and_images { get {23 public bool zoom_text_and_images { get {
41 return !zoom_text_only;24 return !zoom_text_only;
@@ -47,7 +30,6 @@
47 } set {30 } set {
48 WebKit.WebContext.get_default ().set_spell_checking_enabled (value);31 WebKit.WebContext.get_default ().set_spell_checking_enabled (value);
49 } }32 } }
50#endif
51 public bool remember_last_window_size { get; set; default = true; }33 public bool remember_last_window_size { get; set; default = true; }
52 public int last_window_width { get; set; default = 0; }34 public int last_window_width { get; set; default = 0; }
53 public int last_window_height { get; set; default = 0; }35 public int last_window_height { get; set; default = 0; }
5436
=== modified file 'midori/midori-tab.vala'
--- midori/midori-tab.vala 2015-04-19 14:06:12 +0000
+++ midori/midori-tab.vala 2017-11-26 09:48:19 +0000
@@ -129,16 +129,9 @@
129 }129 }
130130
131 construct {131 construct {
132 #if HAVE_GTK3
133 orientation = Gtk.Orientation.VERTICAL;132 orientation = Gtk.Orientation.VERTICAL;
134 #endif
135
136#if HAVE_WEBKIT2_3_91
137 web_view = related != null ?133 web_view = related != null ?
138 new WebKit.WebView.with_related_view (related.web_view) : new WebKit.WebView ();134 new WebKit.WebView.with_related_view (related.web_view) : new WebKit.WebView ();
139#else
140 web_view = new WebKit.WebView ();
141#endif
142 /* Load something to avoid a bug where WebKit might not set a main frame */135 /* Load something to avoid a bug where WebKit might not set a main frame */
143 web_view.load_uri ("");136 web_view.load_uri ("");
144 }137 }
@@ -245,7 +238,6 @@
245 }238 }
246239
247 public bool find (string text, bool case_sensitive, bool forward) {240 public bool find (string text, bool case_sensitive, bool forward) {
248#if HAVE_WEBKIT2
249 var controller = web_view.get_find_controller ();241 var controller = web_view.get_find_controller ();
250 uint options = WebKit.FindOptions.WRAP_AROUND;242 uint options = WebKit.FindOptions.WRAP_AROUND;
251 if (!case_sensitive)243 if (!case_sensitive)
@@ -255,13 +247,6 @@
255 controller.search (text, options, 0);247 controller.search (text, options, 0);
256 // FIXME: mark matches, count matches, not found248 // FIXME: mark matches, count matches, not found
257 return true;249 return true;
258#else
259 bool found = false;
260 found = web_view.search_text (text, case_sensitive, forward, true);
261 web_view.mark_text_matches (text, case_sensitive, 0);
262 web_view.set_highlight_text_matches (true);
263 return found;
264#endif
265 }250 }
266251
267 /*252 /*
@@ -270,7 +255,6 @@
270 Since: 0.5.8255 Since: 0.5.8
271 */256 */
272 public async void update_actions (Gtk.ActionGroup actions) {257 public async void update_actions (Gtk.ActionGroup actions) {
273#if HAVE_WEBKIT2
274 try {258 try {
275 actions.get_action ("Undo").sensitive = yield web_view.can_execute_editing_command ("Undo", null);259 actions.get_action ("Undo").sensitive = yield web_view.can_execute_editing_command ("Undo", null);
276 actions.get_action ("Redo").sensitive = yield web_view.can_execute_editing_command ("Redo", null);260 actions.get_action ("Redo").sensitive = yield web_view.can_execute_editing_command ("Redo", null);
@@ -282,15 +266,6 @@
282 } catch (Error error) {266 } catch (Error error) {
283 critical ("Failed to update actions: %s", error.message);267 critical ("Failed to update actions: %s", error.message);
284 }268 }
285#else
286 actions.get_action ("Undo").sensitive = web_view.can_undo ();
287 actions.get_action ("Redo").sensitive = web_view.can_redo ();
288 actions.get_action ("Cut").sensitive = web_view.can_cut_clipboard ();
289 actions.get_action ("Copy").sensitive = web_view.can_copy_clipboard ();
290 actions.get_action ("Paste").sensitive = web_view.can_paste_clipboard ();
291 actions.get_action ("Delete").sensitive = web_view.can_cut_clipboard ();
292 actions.get_action ("SelectAll").sensitive = true;
293#endif
294 }269 }
295 }270 }
296}271}
297272
=== modified file 'midori/midori-view.c'
--- midori/midori-view.c 2017-10-05 23:13:58 +0000
+++ midori/midori-view.c 2017-11-26 09:48:19 +0000
@@ -27,11 +27,6 @@
27 #include <gcr/gcr.h>27 #include <gcr/gcr.h>
28#endif28#endif
2929
30#if !defined (HAVE_WEBKIT2)
31SoupMessage*
32midori_map_get_message (SoupMessage* message);
33#endif
34
35#include <string.h>30#include <string.h>
36#include <stdlib.h>31#include <stdlib.h>
37#include <glib/gi18n.h>32#include <glib/gi18n.h>
@@ -61,7 +56,6 @@
61_midori_view_set_settings (MidoriView* view,56_midori_view_set_settings (MidoriView* view,
62 MidoriWebSettings* settings);57 MidoriWebSettings* settings);
6358
64#ifdef HAVE_WEBKIT2
65static void59static void
66midori_view_uri_scheme_res (WebKitURISchemeRequest* request,60midori_view_uri_scheme_res (WebKitURISchemeRequest* request,
67 gpointer user_data);61 gpointer user_data);
@@ -74,7 +68,6 @@
74midori_view_download_query_action (MidoriView* view,68midori_view_download_query_action (MidoriView* view,
75 WebKitDownload* download,69 WebKitDownload* download,
76 const gchar * suggested_filename );70 const gchar * suggested_filename );
77#endif
7871
79static gboolean72static gboolean
80midori_view_display_error (MidoriView* view,73midori_view_display_error (MidoriView* view,
@@ -84,12 +77,7 @@
84 const gchar* message,77 const gchar* message,
85 const gchar* description,78 const gchar* description,
86 const gchar* suggestions,79 const gchar* suggestions,
87 const gchar* try_again,80 const gchar* try_again);
88#ifndef HAVE_WEBKIT2
89 WebKitWebFrame* web_frame);
90#else
91 void* web_frame);
92#endif
9381
94struct _MidoriView82struct _MidoriView
95{83{
@@ -120,11 +108,9 @@
120 gint scrollh, scrollv;108 gint scrollh, scrollv;
121 GtkWidget* scrolled_window;109 GtkWidget* scrolled_window;
122110
123 #if GTK_CHECK_VERSION (3, 2, 0)
124 GtkWidget* overlay;111 GtkWidget* overlay;
125 GtkWidget* overlay_label;112 GtkWidget* overlay_label;
126 GtkWidget* overlay_find;113 GtkWidget* overlay_find;
127 #endif
128};114};
129115
130struct _MidoriViewClass116struct _MidoriViewClass
@@ -429,17 +415,11 @@
429 g_object_get (icon, "names", &icon_names, NULL);415 g_object_get (icon, "names", &icon_names, NULL);
430416
431 icon_info = 417 icon_info =
432#if GTK_CHECK_VERSION (3, 0, 0)
433 gtk_icon_theme_choose_icon_for_scale (418 gtk_icon_theme_choose_icon_for_scale (
434#else
435 gtk_icon_theme_choose_icon (
436#endif
437 icon_theme,419 icon_theme,
438 (const char **)icon_names,420 (const char **)icon_names,
439 16, /* Favicon-sized */421 16, /* Favicon-sized */
440#if GTK_CHECK_VERSION (3, 0, 0)
441 gtk_widget_get_scale_factor (GTK_WIDGET (view)),422 gtk_widget_get_scale_factor (GTK_WIDGET (view)),
442#endif
443 0);423 0);
444424
445 if (icon_info)425 if (icon_info)
@@ -499,7 +479,6 @@
499_midori_web_view_load_icon (MidoriView* view)479_midori_web_view_load_icon (MidoriView* view)
500{480{
501 GdkPixbuf* pixbuf = NULL;481 GdkPixbuf* pixbuf = NULL;
502 #ifdef HAVE_WEBKIT2
503 cairo_surface_t* surface = webkit_web_view_get_favicon (WEBKIT_WEB_VIEW (view->web_view));482 cairo_surface_t* surface = webkit_web_view_get_favicon (WEBKIT_WEB_VIEW (view->web_view));
504 if (surface != NULL483 if (surface != NULL
505 && (pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,484 && (pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
@@ -508,11 +487,6 @@
508 {487 {
509 midori_view_apply_icon (view, G_ICON (pixbuf), view->icon_uri);488 midori_view_apply_icon (view, G_ICON (pixbuf), view->icon_uri);
510 }489 }
511 #else
512 if ((pixbuf = webkit_web_view_try_get_favicon_pixbuf (
513 WEBKIT_WEB_VIEW (view->web_view), 0, 0)))
514 midori_view_apply_icon (view, G_ICON (pixbuf), view->icon_uri);
515 #endif
516}490}
517491
518static void492static void
@@ -540,45 +514,20 @@
540 GTlsCertificateFlags* tls_flags,514 GTlsCertificateFlags* tls_flags,
541 gchar** hostname)515 gchar** hostname)
542{516{
543 #ifdef HAVE_WEBKIT2
544 WebKitWebView* web_view = WEBKIT_WEB_VIEW (view->web_view);517 WebKitWebView* web_view = WEBKIT_WEB_VIEW (view->web_view);
545 *hostname = midori_uri_parse_hostname (webkit_web_view_get_uri (web_view), NULL);518 *hostname = midori_uri_parse_hostname (webkit_web_view_get_uri (web_view), NULL);
546 gboolean success = webkit_web_view_get_tls_info (web_view, tls_cert, tls_flags);519 gboolean success = webkit_web_view_get_tls_info (web_view, tls_cert, tls_flags);
547 if (*tls_cert != NULL)520 if (*tls_cert != NULL)
548 g_object_ref (*tls_cert);521 g_object_ref (*tls_cert);
549 return success && *tls_flags == 0;522 return success && *tls_flags == 0;
550 #else
551 SoupMessage* message = midori_map_get_message (webkit_network_request_get_message (request));
552 if (message != NULL)
553 {
554 SoupURI* uri = soup_message_get_uri (message);
555 *hostname = uri ? g_strdup (uri->host) : NULL;
556 g_object_get (message, "tls-certificate", tls_cert, "tls-errors", tls_flags, NULL);
557 if (soup_message_get_flags (message) & SOUP_MESSAGE_CERTIFICATE_TRUSTED)
558 return TRUE;
559 return *tls_flags == 0;
560 }
561 *tls_cert = NULL;
562 *tls_flags = 0;
563 *hostname = NULL;
564 return FALSE;
565 #endif
566}523}
567524
568static gboolean525static gboolean
569midori_view_web_view_navigation_decision_cb (WebKitWebView* web_view,526midori_view_web_view_navigation_decision_cb (WebKitWebView* web_view,
570 #ifdef HAVE_WEBKIT2
571 WebKitPolicyDecision* decision,527 WebKitPolicyDecision* decision,
572 WebKitPolicyDecisionType decision_type,528 WebKitPolicyDecisionType decision_type,
573 #else
574 WebKitWebFrame* web_frame,
575 WebKitNetworkRequest* request,
576 WebKitWebNavigationAction* action,
577 WebKitWebPolicyDecision* decision,
578 #endif
579 MidoriView* view)529 MidoriView* view)
580{530{
581 #ifdef HAVE_WEBKIT2
582 if (decision_type == WEBKIT_POLICY_DECISION_TYPE_RESPONSE)531 if (decision_type == WEBKIT_POLICY_DECISION_TYPE_RESPONSE)
583 {532 {
584 WebKitURIResponse* response = webkit_response_policy_decision_get_response (533 WebKitURIResponse* response = webkit_response_policy_decision_get_response (
@@ -613,9 +562,6 @@
613562
614 WebKitURIRequest * request = webkit_navigation_policy_decision_get_request (WEBKIT_NAVIGATION_POLICY_DECISION (decision));563 WebKitURIRequest * request = webkit_navigation_policy_decision_get_request (WEBKIT_NAVIGATION_POLICY_DECISION (decision));
615 const gchar* uri = webkit_uri_request_get_uri (request);564 const gchar* uri = webkit_uri_request_get_uri (request);
616 #else
617 const gchar* uri = webkit_network_request_get_uri (request);
618 #endif
619 if (g_str_has_prefix (uri, "geo:") && strstr (uri, ","))565 if (g_str_has_prefix (uri, "geo:") && strstr (uri, ","))
620 {566 {
621 gchar* new_uri = sokoke_magic_uri (uri, TRUE, FALSE);567 gchar* new_uri = sokoke_magic_uri (uri, TRUE, FALSE);
@@ -627,11 +573,7 @@
627 {573 {
628 /* For security reasons, main content served as data: is limited to images574 /* For security reasons, main content served as data: is limited to images
629 http://lcamtuf.coredump.cx/switch/ */575 http://lcamtuf.coredump.cx/switch/ */
630 #ifdef HAVE_WEBKIT2
631 webkit_policy_decision_ignore (decision);576 webkit_policy_decision_ignore (decision);
632 #else
633 webkit_web_policy_decision_ignore (decision);
634 #endif
635 return TRUE;577 return TRUE;
636 }578 }
637 #ifdef HAVE_GCR579 #ifdef HAVE_GCR
@@ -641,11 +583,7 @@
641 If a "special", unverified page loads a form, it must be that page.583 If a "special", unverified page loads a form, it must be that page.
642 if (webkit_web_navigation_action_get_reason (action) == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED)584 if (webkit_web_navigation_action_get_reason (action) == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED)
643 FIXME: Verify more stricly that this cannot be eg. a simple Reload */585 FIXME: Verify more stricly that this cannot be eg. a simple Reload */
644 #ifdef HAVE_WEBKIT2
645 if (decision_type == WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION)586 if (decision_type == WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION)
646 #else
647 if (webkit_web_navigation_action_get_reason (action) == WEBKIT_WEB_NAVIGATION_REASON_RELOAD)
648 #endif
649 {587 {
650 GTlsCertificate* tls_cert;588 GTlsCertificate* tls_cert;
651 GTlsCertificateFlags tls_flags;589 GTlsCertificateFlags tls_flags;
@@ -672,7 +610,7 @@
672 "<a href=\"http://midori-browser.org/faqs/\" target=\"_blank\">FAQ</a>, section "610 "<a href=\"http://midori-browser.org/faqs/\" target=\"_blank\">FAQ</a>, section "
673 "\"<a href=\"http://midori-browser.org/faqs/#security_features\" target=\"_blank\">"611 "\"<a href=\"http://midori-browser.org/faqs/#security_features\" target=\"_blank\">"
674 "Security Features</a>\", to understand how you can solve this problem."),612 "Security Features</a>\", to understand how you can solve this problem."),
675 _("Trust this website"), NULL);613 _("Trust this website"));
676 g_free (title);614 g_free (title);
677 g_free (slots);615 g_free (slots);
678 g_error_free (error);616 g_error_free (error);
@@ -721,11 +659,7 @@
721 g_signal_emit_by_name (view, "navigation-requested", uri, &handled);659 g_signal_emit_by_name (view, "navigation-requested", uri, &handled);
722 if (handled)660 if (handled)
723 {661 {
724 #ifdef HAVE_WEBKIT2
725 webkit_policy_decision_ignore (decision);662 webkit_policy_decision_ignore (decision);
726 #else
727 webkit_web_policy_decision_ignore (decision);
728 #endif
729 return TRUE;663 return TRUE;
730 }664 }
731665
@@ -798,8 +732,7 @@
798 midori_tab_stop_loading (MIDORI_TAB (view));732 midori_tab_stop_loading (MIDORI_TAB (view));
799 midori_view_display_error (view, NULL, NULL, NULL, _("Security unknown"),733 midori_view_display_error (view, NULL, NULL, NULL, _("Security unknown"),
800 midori_location_action_tls_flags_to_string (tls_flags), NULL,734 midori_location_action_tls_flags_to_string (tls_flags), NULL,
801 _("Trust this website"),735 _("Trust this website"));
802 NULL);
803 }736 }
804 g_object_unref (gcr_cert);737 g_object_unref (gcr_cert);
805 }738 }
@@ -919,10 +852,10 @@
919 }852 }
920853
921 /* Render icon as a PNG at the desired size */854 /* Render icon as a PNG at the desired size */
922 pixbuf = gtk_widget_render_icon (GTK_WIDGET (view), icon_name, icon_size, NULL);855 pixbuf = gtk_widget_render_icon_pixbuf (GTK_WIDGET (view), icon_name, icon_size);
923 if (!pixbuf)856 if (!pixbuf)
924 pixbuf = gtk_widget_render_icon (GTK_WIDGET (view),857 pixbuf = gtk_widget_render_icon_pixbuf (GTK_WIDGET (view),
925 GTK_STOCK_MISSING_IMAGE, icon_size, NULL);858 GTK_STOCK_MISSING_IMAGE, icon_size);
926 if (pixbuf)859 if (pixbuf)
927 {860 {
928 gboolean success;861 gboolean success;
@@ -939,14 +872,9 @@
939 encoded = g_base64_encode ((guchar*)buffer, buffer_size);872 encoded = g_base64_encode ((guchar*)buffer, buffer_size);
940 data_uri = g_strconcat ("data:image/png;base64,", encoded, NULL);873 data_uri = g_strconcat ("data:image/png;base64,", encoded, NULL);
941 g_free (encoded);874 g_free (encoded);
942 #ifdef HAVE_WEBKIT2
943 GInputStream* stream = g_memory_input_stream_new_from_data (buffer, buffer_size, g_free);875 GInputStream* stream = g_memory_input_stream_new_from_data (buffer, buffer_size, g_free);
944 webkit_uri_scheme_request_finish (request, stream, -1, "image/png");876 webkit_uri_scheme_request_finish (request, stream, -1, "image/png");
945 g_object_unref (stream);877 g_object_unref (stream);
946 #else
947 g_free (buffer);
948 webkit_network_request_set_uri (request, data_uri);
949 #endif
950 g_free (data_uri);878 g_free (data_uri);
951 return;879 return;
952 }880 }
@@ -1167,12 +1095,7 @@
1167 const gchar* message,1095 const gchar* message,
1168 const gchar* description,1096 const gchar* description,
1169 const gchar* suggestions,1097 const gchar* suggestions,
1170 const gchar* try_again,1098 const gchar* try_again)
1171#ifndef HAVE_WEBKIT2
1172 WebKitWebFrame* web_frame)
1173#else
1174 void* web_frame)
1175#endif
1176{1099{
1177 gchar* path = midori_paths_get_res_filename ("error.html");1100 gchar* path = midori_paths_get_res_filename ("error.html");
1178 gchar* template;1101 gchar* template;
@@ -1191,11 +1114,6 @@
1191 is_main_frame = web_frame && (webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view)) == web_frame);1114 is_main_frame = web_frame && (webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view)) == web_frame);
1192 #endif1115 #endif
11931116
1194 #if !GTK_CHECK_VERSION (3, 0, 0)
1195 /* g_object_get_valist: object class `GtkSettings' has no property named `gtk-button-images' */
1196 g_type_class_unref (g_type_class_ref (GTK_TYPE_BUTTON));
1197 #endif
1198
1199 GtkSettings* gtk_settings = gtk_widget_get_settings (view->web_view);1117 GtkSettings* gtk_settings = gtk_widget_get_settings (view->web_view);
1200 gboolean show_button_images = gtk_settings != NULL1118 gboolean show_button_images = gtk_settings != NULL
1201 && katze_object_get_boolean (gtk_settings, "gtk-button-images");1119 && katze_object_get_boolean (gtk_settings, "gtk-button-images");
@@ -1223,7 +1141,7 @@
1223 g_free (title_escaped);1141 g_free (title_escaped);
1224 g_free (template);1142 g_free (template);
12251143
1226 midori_view_set_html (view, result, uri, web_frame);1144 midori_view_set_html (view, result, uri, NULL);
12271145
1228 g_free (result);1146 g_free (result);
1229 g_free (path);1147 g_free (path);
@@ -1237,11 +1155,7 @@
12371155
1238static gboolean1156static gboolean
1239webkit_web_view_load_error_cb (WebKitWebView* web_view,1157webkit_web_view_load_error_cb (WebKitWebView* web_view,
1240#ifdef HAVE_WEBKIT2
1241 WebKitLoadEvent load_event,1158 WebKitLoadEvent load_event,
1242#else
1243 WebKitWebFrame* web_frame,
1244#endif
1245 const gchar* uri,1159 const gchar* uri,
1246 GError* error,1160 GError* error,
1247 MidoriView* view)1161 MidoriView* view)
@@ -1250,12 +1164,6 @@
1250 didFailProvisionalLoadWithErrorForFrame early-returns if the frame isn't1164 didFailProvisionalLoadWithErrorForFrame early-returns if the frame isn't
1251 main, so we know that the pertinent frame here is the view's main frame--so1165 main, so we know that the pertinent frame here is the view's main frame--so
1252 it's safe for midori_view_display_error to assume it fills in a main frame*/1166 it's safe for midori_view_display_error to assume it fills in a main frame*/
1253 #ifdef HAVE_WEBKIT2
1254 void* web_frame = NULL;
1255 void* main_frame = NULL;
1256 #else
1257 WebKitWebFrame* main_frame = webkit_web_view_get_main_frame (web_view);
1258 #endif
1259 gchar* title;1167 gchar* title;
1260 gchar* message;1168 gchar* message;
1261 gboolean result;1169 gboolean result;
@@ -1299,11 +1207,10 @@
12991207
1300 result = midori_view_display_error (view, uri, "stock://dialog/network-error", title,1208 result = midori_view_display_error (view, uri, "stock://dialog/network-error", title,
1301 message, error->message, NULL,1209 message, error->message, NULL,
1302 _("Try Again"), web_frame);1210 _("Try Again"));
13031211
1304 /* if the main frame for the whole tab has a network error, set tab error status */1212 // FIXME: do this on the main frame only
1305 if (web_frame == main_frame)1213 midori_tab_set_load_error (MIDORI_TAB (view), MIDORI_LOAD_ERROR_NETWORK);
1306 midori_tab_set_load_error (MIDORI_TAB (view), MIDORI_LOAD_ERROR_NETWORK);
13071214
1308 g_free (message);1215 g_free (message);
1309 g_free (title);1216 g_free (title);
@@ -1423,7 +1330,6 @@
1423 midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);1330 midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
1424}1331}
14251332
1426#ifdef HAVE_WEBKIT2
1427static void1333static void
1428midori_view_web_view_crashed_cb (WebKitWebView* web_view,1334midori_view_web_view_crashed_cb (WebKitWebView* web_view,
1429 MidoriView* view)1335 MidoriView* view)
@@ -1432,7 +1338,7 @@
1432 gchar* title = g_strdup_printf (_("Oops - %s"), uri);1338 gchar* title = g_strdup_printf (_("Oops - %s"), uri);
1433 gchar* message = g_strdup_printf (_("Something went wrong with '%s'."), uri);1339 gchar* message = g_strdup_printf (_("Something went wrong with '%s'."), uri);
1434 midori_view_display_error (view, uri, NULL, title,1340 midori_view_display_error (view, uri, NULL, title,
1435 message, "", NULL, _("Try again"), NULL);1341 message, "", NULL, _("Try again"));
1436 g_free (message);1342 g_free (message);
1437 g_free (title);1343 g_free (title);
1438}1344}
@@ -1464,50 +1370,16 @@
14641370
1465 g_object_thaw_notify (G_OBJECT (view));1371 g_object_thaw_notify (G_OBJECT (view));
1466}1372}
1467#else
1468static void
1469midori_view_web_view_notify_load_status_cb (WebKitWebView* web_view,
1470 GParamSpec* pspec,
1471 MidoriView* view)
1472{
1473 g_object_freeze_notify (G_OBJECT (view));
1474
1475 switch (webkit_web_view_get_load_status (web_view))
1476 {
1477 case WEBKIT_LOAD_PROVISIONAL:
1478 midori_view_load_started (view);
1479 break;
1480 case WEBKIT_LOAD_COMMITTED:
1481 midori_view_load_committed (view);
1482 break;
1483 case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT:
1484 /* Not implemented */
1485 break;
1486 case WEBKIT_LOAD_FINISHED:
1487 case WEBKIT_LOAD_FAILED:
1488 midori_view_load_finished (view);
1489 break;
1490 default:
1491 g_warn_if_reached ();
1492 }
1493
1494 g_object_thaw_notify (G_OBJECT (view));
1495}
1496#endif
14971373
1498static void1374static void
1499midori_web_view_notify_icon_uri_cb (WebKitWebView* web_view,1375midori_web_view_notify_icon_uri_cb (WebKitWebView* web_view,
1500 GParamSpec* pspec,1376 GParamSpec* pspec,
1501 MidoriView* view)1377 MidoriView* view)
1502{1378{
1503#ifdef HAVE_WEBKIT2
1504 const gchar* uri = webkit_web_view_get_uri (web_view);1379 const gchar* uri = webkit_web_view_get_uri (web_view);
1505 WebKitWebContext* context = webkit_web_context_get_default ();1380 WebKitWebContext* context = webkit_web_context_get_default ();
1506 WebKitFaviconDatabase* favicon_database = webkit_web_context_get_favicon_database (context);1381 WebKitFaviconDatabase* favicon_database = webkit_web_context_get_favicon_database (context);
1507 gchar* icon_uri = webkit_favicon_database_get_favicon_uri (favicon_database, uri);1382 gchar* icon_uri = webkit_favicon_database_get_favicon_uri (favicon_database, uri);
1508#else
1509 gchar* icon_uri = g_strdup (webkit_web_view_get_icon_uri (web_view));
1510#endif
1511 katze_assign (view->icon_uri, icon_uri);1383 katze_assign (view->icon_uri, icon_uri);
1512 _midori_web_view_load_icon (view);1384 _midori_web_view_load_icon (view);
1513}1385}
@@ -1522,17 +1394,6 @@
1522 g_object_notify (G_OBJECT (view), "title");1394 g_object_notify (G_OBJECT (view), "title");
1523}1395}
15241396
1525#ifndef HAVE_WEBKIT2
1526static void
1527webkit_web_view_statusbar_text_changed_cb (WebKitWebView* web_view,
1528 const gchar* text,
1529 MidoriView* view)
1530{
1531 midori_tab_set_statusbar_text (MIDORI_TAB (view), text);
1532}
1533#endif
1534
1535#if GTK_CHECK_VERSION(3, 2, 0)
1536static gboolean1397static gboolean
1537midori_view_overlay_frame_enter_notify_event_cb (GtkOverlay* overlay,1398midori_view_overlay_frame_enter_notify_event_cb (GtkOverlay* overlay,
1538 GdkEventCrossing* event,1399 GdkEventCrossing* event,
@@ -1544,7 +1405,6 @@
1544 ? GTK_ALIGN_END : GTK_ALIGN_START);1405 ? GTK_ALIGN_END : GTK_ALIGN_START);
1545 return FALSE;1406 return FALSE;
1546}1407}
1547#endif
15481408
1549static gboolean1409static gboolean
1550midori_view_web_view_leave_notify_event_cb (WebKitWebView* web_view,1410midori_view_web_view_leave_notify_event_cb (WebKitWebView* web_view,
@@ -1557,16 +1417,10 @@
15571417
1558static void1418static void
1559webkit_web_view_hovering_over_link_cb (WebKitWebView* web_view,1419webkit_web_view_hovering_over_link_cb (WebKitWebView* web_view,
1560 #ifdef HAVE_WEBKIT2
1561 WebKitHitTestResult* hit_test_result,1420 WebKitHitTestResult* hit_test_result,
1562 guint modifiers,1421 guint modifiers,
1563 #else
1564 const gchar* tooltip,
1565 const gchar* link_uri,
1566 #endif
1567 MidoriView* view)1422 MidoriView* view)
1568{1423{
1569 #ifdef HAVE_WEBKIT2
1570 katze_object_assign (view->hit_test, g_object_ref (hit_test_result));1424 katze_object_assign (view->hit_test, g_object_ref (hit_test_result));
1571 if (!webkit_hit_test_result_context_is_link (hit_test_result))1425 if (!webkit_hit_test_result_context_is_link (hit_test_result))
1572 {1426 {
@@ -1574,7 +1428,6 @@
1574 return;1428 return;
1575 }1429 }
1576 const gchar* link_uri = webkit_hit_test_result_get_link_uri (hit_test_result);1430 const gchar* link_uri = webkit_hit_test_result_get_link_uri (hit_test_result);
1577 #endif
15781431
1579 katze_assign (view->link_uri, g_strdup (link_uri));1432 katze_assign (view->link_uri, g_strdup (link_uri));
1580 if (link_uri && g_str_has_prefix (link_uri, "mailto:"))1433 if (link_uri && g_str_has_prefix (link_uri, "mailto:"))
@@ -1594,33 +1447,6 @@
1594 return g_str_has_prefix (uri, "javascript:") || g_str_has_prefix (uri, "mailto:");1447 return g_str_has_prefix (uri, "javascript:") || g_str_has_prefix (uri, "mailto:");
1595}1448}
15961449
1597static void
1598midori_view_ensure_link_uri (MidoriView* view,
1599 gint *x,
1600 gint *y,
1601 GdkEventButton* event)
1602{
1603#ifndef HAVE_WEBKIT2
1604 g_return_if_fail (MIDORI_IS_VIEW (view));
1605
1606 if (gtk_widget_get_window (view->web_view))
1607 {
1608
1609 if (x != NULL)
1610 *x = event->x;
1611 if (y != NULL)
1612 *y = event->y;
1613
1614 katze_object_assign (view->hit_test,
1615 g_object_ref (
1616 webkit_web_view_get_hit_test_result (
1617 WEBKIT_WEB_VIEW (view->web_view), event)));
1618 katze_assign (view->link_uri,
1619 katze_object_get_string (view->hit_test, "link-uri"));
1620 }
1621#endif
1622}
1623
1624#define MIDORI_KEYS_MODIFIER_MASK (GDK_SHIFT_MASK | GDK_CONTROL_MASK \1450#define MIDORI_KEYS_MODIFIER_MASK (GDK_SHIFT_MASK | GDK_CONTROL_MASK \
1625 | GDK_MOD1_MASK | GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK )1451 | GDK_MOD1_MASK | GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK )
16261452
@@ -1633,7 +1459,6 @@
1633 gboolean background;1459 gboolean background;
16341460
1635 event->state = event->state & MIDORI_KEYS_MODIFIER_MASK;1461 event->state = event->state & MIDORI_KEYS_MODIFIER_MASK;
1636 midori_view_ensure_link_uri (view, NULL, NULL, event);
1637 link_uri = midori_view_get_link_uri (view);1462 link_uri = midori_view_get_link_uri (view);
1638 view->button_press_handled = FALSE;1463 view->button_press_handled = FALSE;
16391464
@@ -1681,11 +1506,7 @@
1681 view->button_press_handled = TRUE;1506 view->button_press_handled = TRUE;
1682 return TRUE;1507 return TRUE;
1683 }1508 }
1684 #if GTK_CHECK_VERSION (3, 4, 0)
1685 if (katze_object_get_boolean (gtk_widget_get_settings (view->web_view), "gtk-enable-primary-paste"))1509 if (katze_object_get_boolean (gtk_widget_get_settings (view->web_view), "gtk-enable-primary-paste"))
1686 #else
1687 if (midori_settings_get_middle_click_opens_selection (MIDORI_SETTINGS (view->settings)))
1688 #endif
1689 {1510 {
1690 #ifndef HAVE_WEBKIT21511 #ifndef HAVE_WEBKIT2
1691 WebKitHitTestResult* result = webkit_web_view_get_hit_test_result (web_view, event);1512 WebKitHitTestResult* result = webkit_web_view_get_hit_test_result (web_view, event);
@@ -1754,9 +1575,7 @@
1754 break;1575 break;
1755 case 3:1576 case 3:
1756 /* Older versions don't have the context-menu signal */1577 /* Older versions don't have the context-menu signal */
1757 #if WEBKIT_CHECK_VERSION (1, 10, 0)
1758 if (event->state & GDK_CONTROL_MASK)1578 if (event->state & GDK_CONTROL_MASK)
1759 #endif
1760 {1579 {
1761 /* Ctrl + Right-click suppresses javascript button handling */1580 /* Ctrl + Right-click suppresses javascript button handling */
1762 GtkWidget* menu = gtk_menu_new ();1581 GtkWidget* menu = gtk_menu_new ();
@@ -1995,21 +1814,12 @@
1995 if (character == (event->keyval | 0x01000000))1814 if (character == (event->keyval | 0x01000000))
1996 return FALSE;1815 return FALSE;
19971816
1998 #ifdef HAVE_WEBKIT2
1999 WebKitHitTestResultContext context = katze_object_get_int (view->hit_test, "context");1817 WebKitHitTestResultContext context = katze_object_get_int (view->hit_test, "context");
2000 if (!(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE))1818 if (!(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE))
2001 #else
2002 if (!webkit_web_view_can_cut_clipboard (web_view)
2003 && !webkit_web_view_can_paste_clipboard (web_view))
2004 #endif
2005 {1819 {
2006 gchar* text = character ? g_strdup_printf ("%c", character) : NULL;1820 gchar* text = character ? g_strdup_printf ("%c", character) : NULL;
2007 #if GTK_CHECK_VERSION(3, 2, 0)
2008 midori_findbar_search_text (MIDORI_FINDBAR (view->overlay_find),1821 midori_findbar_search_text (MIDORI_FINDBAR (view->overlay_find),
2009 (GtkWidget*)view, TRUE, katze_str_non_null (text));1822 (GtkWidget*)view, TRUE, katze_str_non_null (text));
2010 #else
2011 g_signal_emit_by_name (view, "search-text", TRUE, katze_str_non_null (text));
2012 #endif
2013 g_free (text);1823 g_free (text);
2014 return TRUE;1824 return TRUE;
2015 }1825 }
@@ -2061,19 +1871,10 @@
2061 MidoriDownloadType type,1871 MidoriDownloadType type,
2062 const gchar* uri)1872 const gchar* uri)
2063{1873{
2064#ifdef HAVE_WEBKIT2
2065 WebKitDownload* download = webkit_web_view_download_uri (WEBKIT_WEB_VIEW (view->web_view), uri);1874 WebKitDownload* download = webkit_web_view_download_uri (WEBKIT_WEB_VIEW (view->web_view), uri);
2066 WebKitWebContext * web_context = webkit_web_view_get_context (WEBKIT_WEB_VIEW (view->web_view));1875 WebKitWebContext * web_context = webkit_web_view_get_context (WEBKIT_WEB_VIEW (view->web_view));
2067 midori_download_set_type (download, type);1876 midori_download_set_type (download, type);
2068 g_signal_emit_by_name (web_context, "download-started", download, view);1877 g_signal_emit_by_name (web_context, "download-started", download, view);
2069#else
2070 WebKitNetworkRequest* request = webkit_network_request_new (uri);
2071 WebKitDownload* download = webkit_download_new (request);
2072 g_object_unref (request);
2073 midori_download_set_type (download, type);
2074 gboolean handled;
2075 g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
2076 #endif
2077}1878}
20781879
2079static void1880static void
@@ -2607,14 +2408,10 @@
2607 g_return_if_fail (MIDORI_IS_VIEW (view));2408 g_return_if_fail (MIDORI_IS_VIEW (view));
2608 g_return_if_fail (GTK_IS_MENU_SHELL (menu));2409 g_return_if_fail (GTK_IS_MENU_SHELL (menu));
26092410
2610 GdkEvent* event = gtk_get_current_event();
2611 midori_view_ensure_link_uri (view, NULL, NULL, (GdkEventButton *)event);
2612 gdk_event_free (event);
2613 MidoriContextAction* context_action = midori_view_get_page_context_action (view, view->hit_test);2411 MidoriContextAction* context_action = midori_view_get_page_context_action (view, view->hit_test);
2614 midori_context_action_create_menu (context_action, GTK_MENU (menu), FALSE);2412 midori_context_action_create_menu (context_action, GTK_MENU (menu), FALSE);
2615}2413}
26162414
2617#if WEBKIT_CHECK_VERSION (1, 10, 0)
2618static gboolean2415static gboolean
2619midori_view_web_view_context_menu_cb (WebKitWebView* web_view,2416midori_view_web_view_context_menu_cb (WebKitWebView* web_view,
2620 #ifdef HAVE_WEBKIT22417 #ifdef HAVE_WEBKIT2
@@ -2628,11 +2425,6 @@
2628 #endif2425 #endif
2629 MidoriView* view)2426 MidoriView* view)
2630{2427{
2631 #ifndef HAVE_WEBKIT2
2632 GdkEvent* event = gtk_get_current_event();
2633 midori_view_ensure_link_uri (view, NULL, NULL, (GdkEventButton *)event);
2634 gdk_event_free (event);
2635 #endif
2636 MidoriContextAction* menu = midori_view_get_page_context_action (view, hit_test_result);2428 MidoriContextAction* menu = midori_view_get_page_context_action (view, hit_test_result);
2637 /* Retain specific menu items we can't re-create easily */2429 /* Retain specific menu items we can't re-create easily */
2638 guint guesses = 0, guesses_max = 10; /* Maximum number of spelling suggestions */2430 guint guesses = 0, guesses_max = 10; /* Maximum number of spelling suggestions */
@@ -2669,7 +2461,6 @@
2669 #endif2461 #endif
2670 return FALSE;2462 return FALSE;
2671}2463}
2672#endif
26732464
2674static gboolean2465static gboolean
2675midori_view_web_view_close_cb (WebKitWebView* web_view,2466midori_view_web_view_close_cb (WebKitWebView* web_view,
@@ -2994,10 +2785,6 @@
2994 const gchar* source_id,2785 const gchar* source_id,
2995 MidoriView* view)2786 MidoriView* view)
2996{2787{
2997 if (g_object_get_data (G_OBJECT (webkit_get_default_session ()),
2998 "pass-through-console"))
2999 return FALSE;
3000
3001 if (!strncmp (message, "speed_dial-save", 13))2788 if (!strncmp (message, "speed_dial-save", 13))
3002 {2789 {
3003 MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));2790 MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
@@ -3505,9 +3292,7 @@
3505 GtkIconTheme* icon_theme;3292 GtkIconTheme* icon_theme;
3506 GdkPixbuf* icon;3293 GdkPixbuf* icon;
3507 GdkPixbuf* gray_icon;3294 GdkPixbuf* gray_icon;
3508 #if GTK_CHECK_VERSION (3, 0, 0)
3509 GtkWidget* scrolled;3295 GtkWidget* scrolled;
3510 #endif
35113296
3512 label = midori_view_get_display_title (view);3297 label = midori_view_get_display_title (view);
3513 title = g_strdup_printf (_("Inspect page - %s"), label);3298 title = g_strdup_printf (_("Inspect page - %s"), label);
@@ -3542,15 +3327,10 @@
3542 else3327 else
3543 gtk_window_set_icon_name (GTK_WINDOW (window), icon_name);3328 gtk_window_set_icon_name (GTK_WINDOW (window), icon_name);
3544 gtk_widget_set_size_request (GTK_WIDGET (inspector_view), 700, 100);3329 gtk_widget_set_size_request (GTK_WIDGET (inspector_view), 700, 100);
3545 #if GTK_CHECK_VERSION (3, 0, 0)
3546 scrolled = gtk_scrolled_window_new (NULL, NULL);3330 scrolled = gtk_scrolled_window_new (NULL, NULL);
3547 gtk_container_add (GTK_CONTAINER (scrolled), inspector_view);3331 gtk_container_add (GTK_CONTAINER (scrolled), inspector_view);
3548 gtk_container_add (GTK_CONTAINER (window), scrolled);3332 gtk_container_add (GTK_CONTAINER (window), scrolled);
3549 gtk_widget_show_all (scrolled);3333 gtk_widget_show_all (scrolled);
3550 #else
3551 gtk_container_add (GTK_CONTAINER (window), inspector_view);
3552 gtk_widget_show_all (inspector_view);
3553 #endif
35543334
3555 g_signal_connect (window, "key-press-event",3335 g_signal_connect (window, "key-press-event",
3556 G_CALLBACK (midori_view_inspector_window_key_press_event_cb), NULL);3336 G_CALLBACK (midori_view_inspector_window_key_press_event_cb), NULL);
@@ -3615,14 +3395,10 @@
3615{3395{
3616 GtkWidget* inspector_view = GTK_WIDGET (webkit_web_inspector_get_web_view (inspector));3396 GtkWidget* inspector_view = GTK_WIDGET (webkit_web_inspector_get_web_view (inspector));
36173397
3618 #if defined(HAVE_WEBKIT2) || GTK_CHECK_VERSION (3, 0, 0)
3619 GtkWidget* scrolled = gtk_widget_get_parent (inspector_view);3398 GtkWidget* scrolled = gtk_widget_get_parent (inspector_view);
3620 if (!scrolled)3399 if (!scrolled)
3621 return NULL;3400 return NULL;
3622 return gtk_widget_get_parent (scrolled);3401 return gtk_widget_get_parent (scrolled);
3623 #else
3624 return gtk_widget_get_parent (inspector_view);
3625 #endif
3626}3402}
36273403
3628static gboolean3404static gboolean
@@ -3667,7 +3443,6 @@
36673443
3668 view->web_view = GTK_WIDGET (midori_tab_get_web_view (MIDORI_TAB (view)));3444 view->web_view = GTK_WIDGET (midori_tab_get_web_view (MIDORI_TAB (view)));
3669 g_object_connect (view->web_view,3445 g_object_connect (view->web_view,
3670 #ifdef HAVE_WEBKIT2
3671 "signal::load-failed",3446 "signal::load-failed",
3672 webkit_web_view_load_error_cb, view,3447 webkit_web_view_load_error_cb, view,
3673 "signal::load-changed",3448 "signal::load-changed",
@@ -3686,47 +3461,6 @@
3686 midori_view_web_view_context_menu_cb, view,3461 midori_view_web_view_context_menu_cb, view,
3687 "signal::create",3462 "signal::create",
3688 webkit_web_view_create_web_view_cb, view,3463 webkit_web_view_create_web_view_cb, view,
3689 #else
3690 "signal::notify::load-status",
3691 midori_view_web_view_notify_load_status_cb, view,
3692 "signal::notify::progress",
3693 webkit_web_view_progress_changed_cb, view,
3694 "signal::script-alert",
3695 midori_view_web_view_script_alert_cb, view,
3696 "signal::window-object-cleared",
3697 webkit_web_view_window_object_cleared_cb, view,
3698 "signal::create-web-view",
3699 webkit_web_view_create_web_view_cb, view,
3700 "signal-after::mime-type-policy-decision-requested",
3701 webkit_web_view_mime_type_decision_cb, view,
3702 "signal::print-requested",
3703 midori_view_web_view_print_requested_cb, view,
3704 "signal-after::load-error",
3705 webkit_web_view_load_error_cb, view,
3706 "signal::navigation-policy-decision-requested",
3707 midori_view_web_view_navigation_decision_cb, view,
3708 "signal::resource-request-starting",
3709 midori_view_web_view_resource_request_cb, view,
3710 "signal::database-quota-exceeded",
3711 midori_view_web_view_database_quota_exceeded_cb, view,
3712 "signal::geolocation-policy-decision-requested",
3713 midori_view_web_view_geolocation_decision_cb, view,
3714 "signal::notify::icon-uri",
3715 midori_web_view_notify_icon_uri_cb, view,
3716 "signal::hovering-over-link",
3717 webkit_web_view_hovering_over_link_cb, view,
3718 "signal::status-bar-text-changed",
3719 webkit_web_view_statusbar_text_changed_cb, view,
3720 #if WEBKIT_CHECK_VERSION (1, 10, 0)
3721 "signal::context-menu",
3722 midori_view_web_view_context_menu_cb, view,
3723 #endif
3724 "signal::console-message",
3725 webkit_web_view_console_message_cb, view,
3726 "signal::download-requested",
3727 midori_view_download_requested_cb, view,
3728 #endif
3729
3730 "signal::notify::title",3464 "signal::notify::title",
3731 webkit_web_view_notify_title_cb, view,3465 webkit_web_view_notify_title_cb, view,
3732 "signal::leave-notify-event",3466 "signal::leave-notify-event",
@@ -3750,7 +3484,6 @@
3750 #endif3484 #endif
3751 }3485 }
37523486
3753 #ifdef HAVE_WEBKIT2
3754 if (g_signal_lookup ("web-process-crashed", WEBKIT_TYPE_WEB_VIEW))3487 if (g_signal_lookup ("web-process-crashed", WEBKIT_TYPE_WEB_VIEW))
3755 g_signal_connect (view->web_view, "web-process-crashed",3488 g_signal_connect (view->web_view, "web-process-crashed",
3756 (GCallback)midori_view_web_view_crashed_cb, view);3489 (GCallback)midori_view_web_view_crashed_cb, view);
@@ -3762,9 +3495,7 @@
3762 "stock", midori_view_uri_scheme_res, NULL, NULL);3495 "stock", midori_view_uri_scheme_res, NULL, NULL);
3763 g_signal_connect (context, "download-started",3496 g_signal_connect (context, "download-started",
3764 G_CALLBACK (midori_view_download_started_cb), view);3497 G_CALLBACK (midori_view_download_started_cb), view);
3765 #endif
37663498
3767 #if GTK_CHECK_VERSION(3, 2, 0)
3768 view->overlay = gtk_overlay_new ();3499 view->overlay = gtk_overlay_new ();
3769 gtk_widget_show (view->overlay);3500 gtk_widget_show (view->overlay);
3770 gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window);3501 gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window);
@@ -3791,9 +3522,6 @@
3791 gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay),3522 gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay),
3792 view->overlay_find);3523 view->overlay_find);
3793 gtk_widget_set_no_show_all (view->overlay_find, TRUE);3524 gtk_widget_set_no_show_all (view->overlay_find, TRUE);
3794 #else
3795 gtk_box_pack_start (GTK_BOX (view), view->scrolled_window, TRUE, TRUE, 0);
3796 #endif
37973525
3798 #ifndef HAVE_WEBKIT23526 #ifndef HAVE_WEBKIT2
3799 gtk_container_add (GTK_CONTAINER (view->scrolled_window), view->web_view);3527 gtk_container_add (GTK_CONTAINER (view->scrolled_window), view->web_view);
@@ -3840,22 +3568,15 @@
3840 midori_view_add_version (markup, html, g_strdup_printf ("GTK+ %s (%u.%u.%u)\tGlib %s (%u.%u.%u)",3568 midori_view_add_version (markup, html, g_strdup_printf ("GTK+ %s (%u.%u.%u)\tGlib %s (%u.%u.%u)",
3841 GTK_VERSION, gtk_major_version, gtk_minor_version, gtk_micro_version,3569 GTK_VERSION, gtk_major_version, gtk_minor_version, gtk_micro_version,
3842 GIO_VERSION, glib_major_version, glib_minor_version, glib_micro_version));3570 GIO_VERSION, glib_major_version, glib_minor_version, glib_micro_version));
3843#ifndef HAVE_WEBKIT2
3844 midori_view_add_version (markup, html, g_strdup_printf ("WebKitGTK+ %s (%u.%u.%u)\tlibSoup %s",
3845 WEBKIT_VERSION, webkit_major_version (), webkit_minor_version (), webkit_micro_version (),
3846#else
3847 midori_view_add_version (markup, html, g_strdup_printf ("WebKit2GTK+ %s (%u.%u.%u)\tlibSoup %s",3571 midori_view_add_version (markup, html, g_strdup_printf ("WebKit2GTK+ %s (%u.%u.%u)\tlibSoup %s",
3848 WEBKIT_VERSION, webkit_get_major_version (), webkit_get_minor_version (), webkit_get_micro_version (),3572 WEBKIT_VERSION, webkit_get_major_version (), webkit_get_minor_version (), webkit_get_micro_version (),
3849#endif
3850 LIBSOUP_VERSION));3573 LIBSOUP_VERSION));
3851 midori_view_add_version (markup, html, g_strdup_printf ("cairo %s (%s)\tlibnotify %s",3574 midori_view_add_version (markup, html, g_strdup_printf ("cairo %s (%s)",
3852 CAIRO_VERSION_STRING, cairo_version_string (),3575 CAIRO_VERSION_STRING, cairo_version_string ()));
3853 LIBNOTIFY_VERSION));
3854 midori_view_add_version (markup, html, g_strdup_printf ("gcr %s\tgranite %s",3576 midori_view_add_version (markup, html, g_strdup_printf ("gcr %s\tgranite %s",
3855 GCR_VERSION, GRANITE_VERSION));3577 GCR_VERSION, GRANITE_VERSION));
3856}3578}
38573579
3858#ifdef HAVE_WEBKIT2
3859static void3580static void
3860midori_view_get_plugins_cb (GObject* object,3581midori_view_get_plugins_cb (GObject* object,
3861 GAsyncResult* result,3582 GAsyncResult* result,
@@ -3865,7 +3586,6 @@
3865 g_object_set_data (object, "nsplugins", plugins);3586 g_object_set_data (object, "nsplugins", plugins);
3866 midori_view_reload (view, FALSE);3587 midori_view_reload (view, FALSE);
3867}3588}
3868#endif
38693589
3870void3590void
3871midori_view_list_plugins (MidoriView* view,3591midori_view_list_plugins (MidoriView* view,
@@ -3880,7 +3600,6 @@
3880 else3600 else
3881 g_string_append_c (ns_plugins, '\n');3601 g_string_append_c (ns_plugins, '\n');
38823602
3883 #ifdef HAVE_WEBKIT2
3884 WebKitWebContext* context = webkit_web_context_get_default ();3603 WebKitWebContext* context = webkit_web_context_get_default ();
3885 GList* plugins = g_object_get_data (G_OBJECT (context), "nsplugins");3604 GList* plugins = g_object_get_data (G_OBJECT (context), "nsplugins");
3886 if (plugins == NULL)3605 if (plugins == NULL)
@@ -3896,20 +3615,6 @@
3896 webkit_plugin_get_name (plugins->data),3615 webkit_plugin_get_name (plugins->data),
3897 html ? webkit_plugin_get_description (plugins->data) : ""));3616 html ? webkit_plugin_get_description (plugins->data) : ""));
3898 }3617 }
3899 #else
3900 WebKitWebPluginDatabase* pdb = webkit_get_web_plugin_database ();
3901 GSList* plugins = webkit_web_plugin_database_get_plugins (pdb);
3902 GSList* plugin = plugins;
3903 for (; plugin != NULL; plugin = g_slist_next (plugin))
3904 {
3905 if (midori_web_settings_skip_plugin (webkit_web_plugin_get_path (plugin->data)))
3906 continue;
3907 midori_view_add_version (ns_plugins, html, g_strdup_printf ("%s\t%s",
3908 webkit_web_plugin_get_name (plugin->data),
3909 html ? webkit_web_plugin_get_description (plugin->data) : ""));
3910 }
3911 webkit_web_plugin_database_plugins_list_free (plugins);
3912 #endif
3913}3618}
39143619
3915void3620void
@@ -3984,8 +3689,7 @@
3984 _("Page loading delayed:"),3689 _("Page loading delayed:"),
3985 _("Loading delayed either due to a recent crash or startup preferences."),3690 _("Loading delayed either due to a recent crash or startup preferences."),
3986 NULL,3691 NULL,
3987 _("Load Page"),3692 _("Load Page"));
3988 NULL);
3989 }3693 }
3990 else if (g_str_has_prefix (uri, "javascript:"))3694 else if (g_str_has_prefix (uri, "javascript:"))
3991 {3695 {
@@ -4031,7 +3735,6 @@
4031{3735{
4032 g_return_if_fail (MIDORI_IS_VIEW (view));3736 g_return_if_fail (MIDORI_IS_VIEW (view));
40333737
4034 #if GTK_CHECK_VERSION (3, 2, 0)
4035 if (text == NULL)3738 if (text == NULL)
4036 gtk_widget_hide (gtk_widget_get_parent (view->overlay_label));3739 gtk_widget_hide (gtk_widget_get_parent (view->overlay_label));
4037 else3740 else
@@ -4039,7 +3742,6 @@
4039 gtk_label_set_text (GTK_LABEL (view->overlay_label), text);3742 gtk_label_set_text (GTK_LABEL (view->overlay_label), text);
4040 gtk_widget_show (gtk_widget_get_parent (view->overlay_label));3743 gtk_widget_show (gtk_widget_get_parent (view->overlay_label));
4041 }3744 }
4042 #endif
4043}3745}
40443746
4045/**3747/**
@@ -4532,69 +4234,6 @@
4532 if (g_str_has_prefix (uri, "file:///"))4234 if (g_str_has_prefix (uri, "file:///"))
4533 return g_filename_from_uri (uri, NULL, NULL);4235 return g_filename_from_uri (uri, NULL, NULL);
45344236
4535#ifndef HAVE_WEBKIT2
4536 WebKitWebFrame *frame;
4537 WebKitWebDataSource *data_source;
4538 const GString *data;
4539 gchar* unique_filename;
4540 gint fd;
4541 FILE* fp;
4542 size_t ret;
4543
4544 frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
4545
4546 if (use_dom)
4547 {
4548 WebKitDOMDocument* doc;
4549
4550 #if WEBKIT_CHECK_VERSION (1, 9, 5)
4551 doc = webkit_web_frame_get_dom_document (frame);
4552 #else
4553 doc = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view->web_view));
4554 #endif
4555
4556 WebKitDOMElement* root = webkit_dom_document_query_selector (doc, ":root", NULL);
4557 const gchar* content = webkit_dom_html_element_get_outer_html (WEBKIT_DOM_HTML_ELEMENT (root));
4558 data = g_string_new (content);
4559 } else {
4560 data_source = webkit_web_frame_get_data_source (frame);
4561 data = webkit_web_data_source_get_data (data_source);
4562 }
4563
4564 if (!outfile)
4565 {
4566 gchar* extension = midori_download_get_extension_for_uri (uri, NULL);
4567 const gchar* mime_type = midori_tab_get_mime_type (MIDORI_TAB (view));
4568 unique_filename = g_strdup_printf ("%s/%uXXXXXX%s", midori_paths_get_tmp_dir (),
4569 g_str_hash (uri), midori_download_fallback_extension (extension, mime_type));
4570 g_free (extension);
4571 katze_mkdir_with_parents (midori_paths_get_tmp_dir (), 0700);
4572 fd = g_mkstemp (unique_filename);
4573 }
4574 else
4575 {
4576 unique_filename = g_strdup (outfile);
4577 fd = g_open (unique_filename, O_WRONLY|O_CREAT, 0644);
4578 }
4579
4580 if (fd != -1)
4581 {
4582 if ((fp = fdopen (fd, "w")))
4583 {
4584 ret = fwrite (data ? data->str : "", 1, data ? data->len : 0, fp);
4585 fclose (fp);
4586 if (ret - (data ? data->len : 0) != 0)
4587 {
4588 midori_view_add_info_bar (view, GTK_MESSAGE_ERROR,
4589 unique_filename, NULL, view,
4590 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
4591 katze_assign (unique_filename, NULL);
4592 }
4593 }
4594 close (fd);
4595 }
4596 return unique_filename;
4597#else
4598 GFile *file;4237 GFile *file;
4599 char *converted = NULL;4238 char *converted = NULL;
4600 WebKitWebView * web_view = WEBKIT_WEB_VIEW (view->web_view);4239 WebKitWebView * web_view = WEBKIT_WEB_VIEW (view->web_view);
@@ -4619,7 +4258,6 @@
4619 g_free (converted);4258 g_free (converted);
4620 g_object_unref (file);4259 g_object_unref (file);
4621 return converted;4260 return converted;
4622#endif
4623}4261}
46244262
4625/**4263/**
@@ -4835,11 +4473,8 @@
4835 g_return_if_fail (MIDORI_IS_VIEW (view));4473 g_return_if_fail (MIDORI_IS_VIEW (view));
48364474
4837 GtkPrintSettings* settings = gtk_print_settings_new ();4475 GtkPrintSettings* settings = gtk_print_settings_new ();
4838 #if GTK_CHECK_VERSION (3, 6, 0)
4839 gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_OUTPUT_BASENAME, midori_view_get_display_title (view));4476 gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_OUTPUT_BASENAME, midori_view_get_display_title (view));
4840 #endif
48414477
4842#ifdef HAVE_WEBKIT2
4843 WebKitPrintOperation* operation = webkit_print_operation_new (WEBKIT_WEB_VIEW (view->web_view));4478 WebKitPrintOperation* operation = webkit_print_operation_new (WEBKIT_WEB_VIEW (view->web_view));
4844 webkit_print_operation_set_print_settings (operation, settings);4479 webkit_print_operation_set_print_settings (operation, settings);
4845 g_object_unref (settings);4480 g_object_unref (settings);
@@ -4852,41 +4487,6 @@
4852 GTK_WINDOW (midori_browser_get_for_widget (view->web_view)));4487 GTK_WINDOW (midori_browser_get_for_widget (view->web_view)));
4853 }4488 }
4854 g_object_unref (operation);4489 g_object_unref (operation);
4855#else
4856 WebKitWebFrame* frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
4857 GtkPrintOperation* operation = gtk_print_operation_new ();
4858 gtk_print_operation_set_print_settings (operation, settings);
4859 g_object_unref (settings);
4860 gtk_print_operation_set_custom_tab_label (operation, _("Features"));
4861 gtk_print_operation_set_embed_page_setup (operation, TRUE);
4862 g_signal_connect (operation, "create-custom-widget",
4863 G_CALLBACK (midori_view_print_create_custom_widget_cb), view);
4864 GError* error = NULL;
4865
4866 if (katze_object_get_boolean (view->settings, "print-without-dialog")) {
4867 webkit_web_frame_print_full (frame, operation,
4868 GTK_PRINT_OPERATION_ACTION_PRINT, &error);
4869 }
4870 else {
4871 webkit_web_frame_print_full (frame, operation,
4872 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, &error);
4873 }
4874 g_object_unref (operation);
4875
4876 if (error)
4877 {
4878 GtkWidget* window = gtk_widget_get_toplevel (GTK_WIDGET (view));
4879 GtkWidget* dialog = gtk_message_dialog_new (
4880 gtk_widget_is_toplevel (window) ? GTK_WINDOW (window) : NULL,
4881 GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
4882 GTK_BUTTONS_CLOSE, "%s", error->message);
4883 g_error_free (error);
4884
4885 g_signal_connect_swapped (dialog, "response",
4886 G_CALLBACK (gtk_widget_destroy), dialog);
4887 gtk_widget_show (dialog);
4888 }
4889#endif
4890}4490}
48914491
4892/**4492/**
@@ -4906,14 +4506,12 @@
4906{4506{
4907 g_return_if_fail (MIDORI_IS_VIEW (view));4507 g_return_if_fail (MIDORI_IS_VIEW (view));
49084508
4909 #if GTK_CHECK_VERSION (3, 2, 0)
4910 if (gtk_widget_get_visible (view->overlay_find))4509 if (gtk_widget_get_visible (view->overlay_find))
4911 {4510 {
4912 text = midori_findbar_get_text (MIDORI_FINDBAR (view->overlay_find));4511 text = midori_findbar_get_text (MIDORI_FINDBAR (view->overlay_find));
4913 midori_tab_find (MIDORI_TAB (view), text, case_sensitive, forward);4512 midori_tab_find (MIDORI_TAB (view), text, case_sensitive, forward);
4914 return;4513 return;
4915 }4514 }
4916 #endif
4917 g_signal_emit_by_name (view, "search-text",4515 g_signal_emit_by_name (view, "search-text",
4918 midori_tab_find (MIDORI_TAB (view), text, case_sensitive, forward), NULL);4516 midori_tab_find (MIDORI_TAB (view), text, case_sensitive, forward), NULL);
4919}4517}
@@ -5019,17 +4617,9 @@
5019{4617{
5020 g_return_val_if_fail (GTK_IS_WIDGET (web_view), NULL);4618 g_return_val_if_fail (GTK_IS_WIDGET (web_view), NULL);
50214619
5022 #ifdef HAVE_WEBKIT2
5023 GtkWidget* scrolled = web_view;4620 GtkWidget* scrolled = web_view;
5024 #else
5025 GtkWidget* scrolled = gtk_widget_get_parent (web_view);
5026 #endif
5027 #if GTK_CHECK_VERSION(3, 2, 0)
5028 GtkWidget* overlay = gtk_widget_get_parent (scrolled);4621 GtkWidget* overlay = gtk_widget_get_parent (scrolled);
5029 GtkWidget* view = gtk_widget_get_parent (overlay);4622 GtkWidget* view = gtk_widget_get_parent (overlay);
5030 #else
5031 GtkWidget* view = gtk_widget_get_parent (scrolled);
5032 #endif
5033 return MIDORI_VIEW (view);4623 return MIDORI_VIEW (view);
5034}4624}
5035/**4625/**
50364626
=== modified file 'midori/midori-websettings.c'
--- midori/midori-websettings.c 2016-01-15 19:18:17 +0000
+++ midori/midori-websettings.c 2017-11-26 09:48:19 +0000
@@ -37,11 +37,7 @@
37 #include <windows.h>37 #include <windows.h>
38#endif38#endif
3939
40#ifdef HAVE_WEBKIT2
41#define WEB_SETTINGS_STRING(x) "WebKitSettings::"x""40#define WEB_SETTINGS_STRING(x) "WebKitSettings::"x""
42#else
43#define WEB_SETTINGS_STRING(x) "WebKitWebSettings::"x""
44#endif
4541
46struct _MidoriWebSettings42struct _MidoriWebSettings
47{43{
@@ -569,14 +565,6 @@
569 web_settings->user_stylesheet_uri = web_settings->user_stylesheet_uri_cached = NULL;565 web_settings->user_stylesheet_uri = web_settings->user_stylesheet_uri_cached = NULL;
570 web_settings->user_stylesheets = NULL;566 web_settings->user_stylesheets = NULL;
571567
572 #if defined (_WIN32) && !GTK_CHECK_VERSION (3, 0, 0)
573 /* Try to work-around black borders on native widgets and GTK+2 on Win32 */
574 midori_web_settings_add_style (web_settings, "black-widgets-workaround",
575 "input[type='checkbox'] { -webkit-appearance: checkbox !important }"
576 " input[type='radio'] { -webkit-appearance: radio !important }"
577 " * { -webkit-appearance: none !important }");
578 #endif
579
580 g_signal_connect (web_settings, "notify::default-charset",568 g_signal_connect (web_settings, "notify::default-charset",
581 G_CALLBACK (notify_default_encoding_cb), NULL);569 G_CALLBACK (notify_default_encoding_cb), NULL);
582 g_signal_connect (web_settings, "notify::default-font-family",570 g_signal_connect (web_settings, "notify::default-font-family",
@@ -818,13 +806,9 @@
818 gchar* platform;806 gchar* platform;
819 const gchar* os = midori_web_settings_get_system_name (NULL, &platform);807 const gchar* os = midori_web_settings_get_system_name (NULL, &platform);
820808
821 #ifndef HAVE_WEBKIT2809 // FIXME: use version from WebKit
822 const int webcore_major = WEBKIT_USER_AGENT_MAJOR_VERSION;
823 const int webcore_minor = WEBKIT_USER_AGENT_MINOR_VERSION;
824 #else
825 const int webcore_major = 537;810 const int webcore_major = 537;
826 const int webcore_minor = 32;811 const int webcore_minor = 32;
827 #endif
828812
829 g_object_set (web_settings, "enable-site-specific-quirks",813 g_object_set (web_settings, "enable-site-specific-quirks",
830 identify_as != MIDORI_IDENT_GENUINE, NULL);814 identify_as != MIDORI_IDENT_GENUINE, NULL);
@@ -858,124 +842,6 @@
858 }842 }
859}843}
860844
861#ifndef HAVE_WEBKIT2
862/* Provide a new way for SoupSession to assume an 'Accept-Language'
863 string automatically from the return value of g_get_language_names(),
864 properly formatted according to RFC2616.
865 Copyright (C) 2009 Mario Sanchez Prada <msanchez@igalia.com>
866 Copyright (C) 2009 Dan Winship <danw@gnome.org>
867 Mostly copied from libSoup 2.29, coding style adjusted */
868
869/* Converts a language in POSIX format and to be RFC2616 compliant */
870/* Based on code from epiphany-webkit (ephy_langs_append_languages()) */
871
872static gchar *
873sokoke_posix_lang_to_rfc2616 (const gchar *language)
874{
875 if (!strchr (language, '.') && !strchr (language, '@') && language[0] != 'C')
876 /* change to lowercase and '_' to '-' */
877 return g_strdelimit (g_ascii_strdown (language, -1), "_", '-');
878
879 return NULL;
880}
881
882/* Adds a quality value to a string (any value between 0 and 1). */
883static gchar *
884sokoke_add_quality_value (const gchar *str,
885 float qvalue)
886{
887 if ((qvalue >= 0.0) && (qvalue <= 1.0))
888 {
889 int qv_int = (qvalue * 1000 + 0.5);
890 return g_strdup_printf ("%s;q=%d.%d",
891 str, (int) (qv_int / 1000), qv_int % 1000);
892 }
893
894 return g_strdup (str);
895}
896
897/* Returns a RFC2616 compliant languages list from system locales */
898static gchar *
899sokoke_accept_languages (const gchar* const * lang_names)
900{
901 GString* langs = NULL;
902 char *cur_lang = NULL;
903 char *prev_lang = NULL;
904 float delta;
905 int i, n_lang_names;
906
907 /* Calculate delta for setting the quality values */
908 n_lang_names = g_strv_length ((gchar **)lang_names);
909 delta = 0.999 / (n_lang_names - 1);
910
911 /* Build the array of languages */
912 langs = g_string_sized_new (n_lang_names);
913 for (i = 0; lang_names[i] != NULL; i++)
914 {
915 cur_lang = sokoke_posix_lang_to_rfc2616 (lang_names[i]);
916
917 /* Apart from getting a valid RFC2616 compliant
918 language, also get rid of extra variants */
919 if (cur_lang && (!prev_lang ||
920 (!strcmp (prev_lang, cur_lang) || !strstr (prev_lang, cur_lang))))
921 {
922
923 gchar *qv_lang = NULL;
924
925 /* Save reference for further comparison */
926 prev_lang = cur_lang;
927
928 /* Add the quality value and append it */
929 qv_lang = sokoke_add_quality_value (cur_lang, 1 - i * delta);
930 if (langs->len > 0)
931 g_string_append_c (langs, ',');
932 g_string_append (langs, qv_lang);
933 }
934 }
935
936 /* Fallback: add "en" if list is empty */
937 if (langs->len == 0)
938 g_string_append (langs, "en");
939
940 return g_string_free (langs, FALSE);
941}
942
943
944static void
945midori_web_settings_update_accept_language (MidoriWebSettings* settings)
946{
947 gchar* languages = settings->http_accept_language;
948 /* Empty, use the system locales */
949 if (!(languages && *languages))
950 katze_assign (settings->accept, sokoke_accept_languages (g_get_language_names ()));
951 /* No =, no ., looks like a list of language names */
952 else if (!(strchr (languages, '=') && strchr (languages, '.')))
953 {
954 gchar ** lang_names = g_strsplit_set (languages, ",; ", -1);
955 katze_assign (settings->accept, sokoke_accept_languages ((const gchar* const *)lang_names));
956 g_strfreev (lang_names);
957 }
958 /* Presumably a well formatted list including priorities */
959 else
960 katze_assign (settings->accept, g_strdup (languages));
961}
962
963/**
964 * midori_web_settings_get_accept_language:
965 *
966 * Returns the value of the accept-language header to send to web servers
967 *
968 * Returns: the accept-language string
969 **/
970const gchar*
971midori_web_settings_get_accept_language (MidoriWebSettings* settings)
972{
973 if (!settings->accept)
974 midori_web_settings_update_accept_language (settings);
975 return settings->accept;
976}
977#endif
978
979static void845static void
980midori_web_settings_process_stylesheets (MidoriWebSettings* settings,846midori_web_settings_process_stylesheets (MidoriWebSettings* settings,
981 gint delta_len);847 gint delta_len);
@@ -1038,11 +904,7 @@
1038 case PROP_ENABLE_PLUGINS:904 case PROP_ENABLE_PLUGINS:
1039 g_object_set (web_settings,905 g_object_set (web_settings,
1040 WEB_SETTINGS_STRING ("enable-plugins"), g_value_get_boolean (value),906 WEB_SETTINGS_STRING ("enable-plugins"), g_value_get_boolean (value),
1041 #ifdef HAVE_WEBKIT2
1042 "enable-java", g_value_get_boolean (value),907 "enable-java", g_value_get_boolean (value),
1043 #else
1044 "enable-java-applet", g_value_get_boolean (value),
1045 #endif
1046 NULL);908 NULL);
1047 break;909 break;
1048 case PROP_ENABLE_PAGE_CACHE:910 case PROP_ENABLE_PAGE_CACHE:
@@ -1075,7 +937,6 @@
1075 break;937 break;
1076 case PROP_PREFERRED_LANGUAGES:938 case PROP_PREFERRED_LANGUAGES:
1077 katze_assign (web_settings->http_accept_language, g_value_dup_string (value));939 katze_assign (web_settings->http_accept_language, g_value_dup_string (value));
1078 #ifdef HAVE_WEBKIT2
1079 WebKitWebContext* context = webkit_web_context_get_default ();940 WebKitWebContext* context = webkit_web_context_get_default ();
1080 gchar** languages = web_settings->http_accept_language941 gchar** languages = web_settings->http_accept_language
1081 ? g_strsplit_set (web_settings->http_accept_language, ",; ", -1)942 ? g_strsplit_set (web_settings->http_accept_language, ",; ", -1)
@@ -1083,11 +944,6 @@
1083 webkit_web_context_set_preferred_languages (context, (const gchar* const*)languages);944 webkit_web_context_set_preferred_languages (context, (const gchar* const*)languages);
1084 webkit_web_context_set_spell_checking_languages (context, (const gchar* const*)languages);945 webkit_web_context_set_spell_checking_languages (context, (const gchar* const*)languages);
1085 g_strfreev (languages);946 g_strfreev (languages);
1086 #else
1087 g_object_set (web_settings, "spell-checking-languages",
1088 web_settings->http_accept_language, NULL);
1089 midori_web_settings_update_accept_language (web_settings);
1090 #endif
1091 break;947 break;
1092 case PROP_SITE_DATA_RULES:948 case PROP_SITE_DATA_RULES:
1093 katze_assign (web_settings->site_data_rules, g_value_dup_string (value));949 katze_assign (web_settings->site_data_rules, g_value_dup_string (value));
@@ -1248,12 +1104,7 @@
1248 WEB_SETTINGS_STRING ("enable-fullscreen")));1104 WEB_SETTINGS_STRING ("enable-fullscreen")));
1249 break;1105 break;
1250 case PROP_USER_STYLESHEET_URI:1106 case PROP_USER_STYLESHEET_URI:
1251#ifdef HAVE_WEBKIT2
1252 g_value_set_string (value, web_settings->user_stylesheet_uri);1107 g_value_set_string (value, web_settings->user_stylesheet_uri);
1253#else
1254 g_value_take_string (value, katze_object_get_string (web_settings,
1255 WEB_SETTINGS_STRING ("user-stylesheet-uri")));
1256#endif
1257 break;1108 break;
1258 case PROP_PRINT_WITHOUT_DIALOG:1109 case PROP_PRINT_WITHOUT_DIALOG:
1259 g_value_set_boolean (value, web_settings->print_without_dialog);1110 g_value_set_boolean (value, web_settings->print_without_dialog);
@@ -1312,11 +1163,7 @@
13121163
1313 /* data: uri prefix from Source/WebCore/page/Page.cpp:700 in WebKit */1164 /* data: uri prefix from Source/WebCore/page/Page.cpp:700 in WebKit */
1314 encoded = g_strconcat ("data:text/css;charset=utf-8;base64,", css->str, NULL);1165 encoded = g_strconcat ("data:text/css;charset=utf-8;base64,", css->str, NULL);
1315 #ifdef HAVE_WEBKIT2
1316 /* TODO: webkit_web_view_group_add_user_style_sheet */1166 /* TODO: webkit_web_view_group_add_user_style_sheet */
1317 #else
1318 g_object_set (settings, WEB_SETTINGS_STRING ("user-stylesheet-uri"), encoded, NULL);
1319 #endif
1320 g_free (encoded);1167 g_free (encoded);
1321 g_string_free (css, TRUE);1168 g_string_free (css, TRUE);
1322}1169}
13231170
=== modified file 'midori/midori-window.vala'
--- midori/midori-window.vala 2015-09-25 21:30:31 +0000
+++ midori/midori-window.vala 2017-11-26 09:48:19 +0000
@@ -14,7 +14,6 @@
14 Gtk.Widget? _toolbar = null;14 Gtk.Widget? _toolbar = null;
15 public Gtk.Widget? toolbar { get {15 public Gtk.Widget? toolbar { get {
16 if (_toolbar == null) {16 if (_toolbar == null) {
17#if HAVE_GTK3
18 if (strcmp (Environment.get_variable ("GTK_CSD"), "1") == 0) {17 if (strcmp (Environment.get_variable ("GTK_CSD"), "1") == 0) {
19 var toolbar = new Gtk.HeaderBar ();18 var toolbar = new Gtk.HeaderBar ();
20 toolbar.show_close_button = true;19 toolbar.show_close_button = true;
@@ -23,12 +22,10 @@
23 _toolbar = toolbar;22 _toolbar = toolbar;
24 return _toolbar;23 return _toolbar;
25 }24 }
26#endif25
27 var toolbar = new Gtk.Toolbar ();26 var toolbar = new Gtk.Toolbar ();
28 toolbar.show_arrow = true;27 toolbar.show_arrow = true;
29#if HAVE_GTK3
30 toolbar.get_style_context ().add_class ("primary-toolbar");28 toolbar.get_style_context ().add_class ("primary-toolbar");
31#endif
32 toolbar.popup_context_menu.connect ((x, y, button) => {29 toolbar.popup_context_menu.connect ((x, y, button) => {
33 return button == 3 && context_menu (toolbar); });30 return button == 3 && context_menu (toolbar); });
34 _toolbar = toolbar;31 _toolbar = toolbar;
@@ -136,7 +133,6 @@
136 all_actions = actions + "," + extra_actions + ",CompactMenu";133 all_actions = actions + "," + extra_actions + ",CompactMenu";
137 string[] names = all_actions.split (",");134 string[] names = all_actions.split (",");
138135
139#if HAVE_GTK3
140 var headerbar = _toolbar as Gtk.HeaderBar;136 var headerbar = _toolbar as Gtk.HeaderBar;
141 if (headerbar != null) {137 if (headerbar != null) {
142 var tail = new List<Gtk.ToolItem> ();138 var tail = new List<Gtk.ToolItem> ();
@@ -171,7 +167,6 @@
171 set_titlebar (headerbar);167 set_titlebar (headerbar);
172 return;168 return;
173 }169 }
174#endif
175170
176 var toolbar = (Gtk.Toolbar)_toolbar;171 var toolbar = (Gtk.Toolbar)_toolbar;
177 string? previous = null;172 string? previous = null;
@@ -211,9 +206,7 @@
211 public void add_toolbar (Gtk.Widget toolbar) {206 public void add_toolbar (Gtk.Widget toolbar) {
212 var _toolbar = toolbar as Gtk.Toolbar;207 var _toolbar = toolbar as Gtk.Toolbar;
213 if (_toolbar != null) {208 if (_toolbar != null) {
214#if HAVE_GTK3
215 get_style_context ().add_class ("secondary-toolbar");209 get_style_context ().add_class ("secondary-toolbar");
216#endif
217 _toolbar.popup_context_menu.connect ((x, y, button) => {210 _toolbar.popup_context_menu.connect ((x, y, button) => {
218 return button == 3 && context_menu (toolbar);211 return button == 3 && context_menu (toolbar);
219 });212 });
220213
=== modified file 'midori/sokoke.c'
--- midori/sokoke.c 2015-12-29 21:41:07 +0000
+++ midori/sokoke.c 2017-11-26 09:48:19 +0000
@@ -562,16 +562,6 @@
562 g_free (markup);562 g_free (markup);
563 gtk_widget_destroy (entry);563 gtk_widget_destroy (entry);
564564
565 #if !GTK_CHECK_VERSION (3, 0, 0)
566 {
567 GtkStyle* style = gtk_widget_get_style (entry);
568 gtk_widget_modify_bg (xfce_heading, GTK_STATE_NORMAL,
569 &style->base[GTK_STATE_NORMAL]);
570 gtk_widget_modify_fg (label, GTK_STATE_NORMAL
571 , &style->text[GTK_STATE_NORMAL]);
572 }
573 #endif
574
575 vbox = gtk_vbox_new (FALSE, 0);565 vbox = gtk_vbox_new (FALSE, 0);
576 gtk_box_pack_start (GTK_BOX (vbox), xfce_heading, FALSE, FALSE, 0);566 gtk_box_pack_start (GTK_BOX (vbox), xfce_heading, FALSE, FALSE, 0);
577567
@@ -752,14 +742,6 @@
752 gpointer user_data)742 gpointer user_data)
753{743{
754 gchar* hostname;744 gchar* hostname;
755#ifndef HAVE_WEBKIT2
756 SoupURI* soup_uri;
757 SoupSession* session = webkit_get_default_session ();
758
759 g_object_get (G_OBJECT (session), "proxy-uri", &soup_uri, NULL);
760 if (soup_uri)
761 return FALSE;
762#endif
763745
764 if (settings && !katze_object_get_boolean (settings, "enable-dns-prefetching"))746 if (settings && !katze_object_get_boolean (settings, "enable-dns-prefetching"))
765 return FALSE;747 return FALSE;
@@ -772,41 +754,10 @@
772 return FALSE;754 return FALSE;
773 }755 }
774756
775#ifdef HAVE_WEBKIT2
776 WebKitWebContext* context = webkit_web_context_get_default ();757 WebKitWebContext* context = webkit_web_context_get_default ();
777 webkit_web_context_prefetch_dns (context, hostname);758 webkit_web_context_prefetch_dns (context, hostname);
778 g_free (hostname);759 g_free (hostname);
779 return FALSE;760 return FALSE;
780#else
781 #define MAXHOSTS 50
782 static gchar* hosts = NULL;
783 static gint host_count = G_MAXINT;
784
785 if (!hosts ||
786 !g_regex_match_simple (hostname, hosts,
787 G_REGEX_CASELESS, G_REGEX_MATCH_NOTEMPTY))
788 {
789 SoupAddress* address;
790 gchar* new_hosts;
791
792 address = soup_address_new (hostname, SOUP_ADDRESS_ANY_PORT);
793 soup_address_resolve_async (address, 0, 0, (SoupAddressCallback)callback, user_data);
794 g_object_unref (address);
795
796 if (host_count > MAXHOSTS)
797 {
798 katze_assign (hosts, g_strdup (""));
799 host_count = 0;
800 }
801 host_count++;
802 new_hosts = g_strdup_printf ("%s|%s", hosts, hostname);
803 katze_assign (hosts, new_hosts);
804 }
805 else if (callback)
806 ((SoupAddressCallback)callback) (NULL, SOUP_STATUS_OK, user_data);
807 g_free (hostname);
808 return TRUE;
809#endif
810}761}
811762
812static void763static void
@@ -1009,11 +960,7 @@
1009 if (hIcon == NULL)960 if (hIcon == NULL)
1010 return NULL;961 return NULL;
1011962
1012#if GTK_CHECK_VERSION (3, 9, 12)
1013 pixbuf = gdk_win32_icon_to_pixbuf_libgtk_only (hIcon, NULL, NULL);963 pixbuf = gdk_win32_icon_to_pixbuf_libgtk_only (hIcon, NULL, NULL);
1014#else
1015 pixbuf = gdk_win32_icon_to_pixbuf_libgtk_only (hIcon);
1016#endif
1017 DestroyIcon (hIcon);964 DestroyIcon (hIcon);
1018965
1019 return pixbuf;966 return pixbuf;
1020967
=== modified file 'midori/sokoke.h'
--- midori/sokoke.h 2015-12-29 21:41:07 +0000
+++ midori/sokoke.h 2017-11-26 09:48:19 +0000
@@ -16,7 +16,6 @@
16#include <JavaScriptCore/JavaScript.h>16#include <JavaScriptCore/JavaScript.h>
17#include "katze/katze.h"17#include "katze/katze.h"
18#include <midori/midori-websettings.h>18#include <midori/midori-websettings.h>
19#include <katze/gtk3-compat.h>
2019
21gchar*20gchar*
22sokoke_js_script_eval (JSContextRef js_context,21sokoke_js_script_eval (JSContextRef js_context,
2322
=== removed file 'midori/webkit2gtk-web-extension-4.0.vapi'
--- midori/webkit2gtk-web-extension-4.0.vapi 2015-04-19 14:06:12 +0000
+++ midori/webkit2gtk-web-extension-4.0.vapi 1970-01-01 00:00:00 +0000
@@ -1,2801 +0,0 @@
1/* webkit2gtk-web-extension-4.0.vapi generated by vapigen, do not modify. */
2
3[CCode (cprefix = "WebKit", gir_namespace = "WebKit2WebExtension", gir_version = "4.0", lower_case_cprefix = "webkit_")]
4namespace WebKit {
5 namespace DOM {
6 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_attr_get_type ()")]
7 [GIR (name = "DOMAttr")]
8 public class Attr : WebKit.DOM.Node, WebKit.DOM.EventTarget {
9 [CCode (has_construct_function = false)]
10 protected Attr ();
11 public string get_name ();
12 public unowned WebKit.DOM.Element get_owner_element ();
13 public bool get_specified ();
14 public string get_value ();
15 public void set_value (string value) throws GLib.Error;
16 [NoAccessorMethod]
17 public bool is_id { get; }
18 public string name { owned get; }
19 public WebKit.DOM.Element owner_element { get; }
20 public bool specified { get; }
21 public string value { owned get; set; }
22 }
23 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_blob_get_type ()")]
24 [GIR (name = "DOMBlob")]
25 public class Blob : WebKit.DOM.Object {
26 [CCode (has_construct_function = false)]
27 protected Blob ();
28 public uint64 get_size ();
29 public uint64 size { get; }
30 [NoAccessorMethod]
31 public string type { owned get; }
32 }
33 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_cdata_section_get_type ()")]
34 [GIR (name = "DOMCDATASection")]
35 public class CDATASection : WebKit.DOM.Text, WebKit.DOM.EventTarget {
36 [CCode (has_construct_function = false)]
37 protected CDATASection ();
38 }
39 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_css_rule_get_type ()")]
40 [GIR (name = "DOMCSSRule")]
41 public class CSSRule : WebKit.DOM.Object {
42 [CCode (has_construct_function = false)]
43 protected CSSRule ();
44 public string get_css_text ();
45 public WebKit.DOM.CSSRule get_parent_rule ();
46 public WebKit.DOM.CSSStyleSheet get_parent_style_sheet ();
47 public ushort get_rule_type ();
48 public void set_css_text (string value) throws GLib.Error;
49 public string css_text { owned get; set; }
50 public WebKit.DOM.CSSRule parent_rule { owned get; }
51 public WebKit.DOM.CSSStyleSheet parent_style_sheet { owned get; }
52 [NoAccessorMethod]
53 public uint type { get; }
54 }
55 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_css_rule_list_get_type ()")]
56 [GIR (name = "DOMCSSRuleList")]
57 public class CSSRuleList : WebKit.DOM.Object {
58 [CCode (has_construct_function = false)]
59 protected CSSRuleList ();
60 public ulong get_length ();
61 public WebKit.DOM.CSSRule item (ulong index);
62 public ulong length { get; }
63 }
64 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_css_style_declaration_get_type ()")]
65 [GIR (name = "DOMCSSStyleDeclaration")]
66 public class CSSStyleDeclaration : WebKit.DOM.Object {
67 [CCode (has_construct_function = false)]
68 protected CSSStyleDeclaration ();
69 public string get_css_text ();
70 public ulong get_length ();
71 public WebKit.DOM.CSSRule get_parent_rule ();
72 public string get_property_priority (string propertyName);
73 public string get_property_shorthand (string propertyName);
74 public string get_property_value (string propertyName);
75 public bool is_property_implicit (string propertyName);
76 public string item (ulong index);
77 public string remove_property (string propertyName) throws GLib.Error;
78 public void set_css_text (string value) throws GLib.Error;
79 public void set_property (string propertyName, string value, string priority) throws GLib.Error;
80 public string css_text { owned get; set; }
81 public ulong length { get; }
82 public WebKit.DOM.CSSRule parent_rule { owned get; }
83 }
84 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_css_style_sheet_get_type ()")]
85 [GIR (name = "DOMCSSStyleSheet")]
86 public class CSSStyleSheet : WebKit.DOM.StyleSheet {
87 [CCode (has_construct_function = false)]
88 protected CSSStyleSheet ();
89 public long add_rule (string selector, string style, ulong index) throws GLib.Error;
90 public void delete_rule (ulong index) throws GLib.Error;
91 public WebKit.DOM.CSSRuleList get_css_rules ();
92 public WebKit.DOM.CSSRule get_owner_rule ();
93 public WebKit.DOM.CSSRuleList get_rules ();
94 public ulong insert_rule (string rule, ulong index) throws GLib.Error;
95 public void remove_rule (ulong index) throws GLib.Error;
96 public WebKit.DOM.CSSRuleList css_rules { owned get; }
97 public WebKit.DOM.CSSRule owner_rule { owned get; }
98 public WebKit.DOM.CSSRuleList rules { owned get; }
99 }
100 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_css_value_get_type ()")]
101 [GIR (name = "DOMCSSValue")]
102 public class CSSValue : WebKit.DOM.Object {
103 [CCode (has_construct_function = false)]
104 protected CSSValue ();
105 public string get_css_text ();
106 public ushort get_css_value_type ();
107 public void set_css_text (string value) throws GLib.Error;
108 public string css_text { owned get; set; }
109 public uint css_value_type { get; }
110 }
111 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_character_data_get_type ()")]
112 [GIR (name = "DOMCharacterData")]
113 public class CharacterData : WebKit.DOM.Node, WebKit.DOM.EventTarget {
114 [CCode (has_construct_function = false)]
115 protected CharacterData ();
116 public void append_data (string data) throws GLib.Error;
117 public void delete_data (ulong offset, ulong length) throws GLib.Error;
118 public string get_data ();
119 public ulong get_length ();
120 public void insert_data (ulong offset, string data) throws GLib.Error;
121 public void replace_data (ulong offset, ulong length, string data) throws GLib.Error;
122 public void set_data (string value) throws GLib.Error;
123 public string substring_data (ulong offset, ulong length) throws GLib.Error;
124 public string data { owned get; set; }
125 public ulong length { get; }
126 }
127 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_comment_get_type ()")]
128 [GIR (name = "DOMComment")]
129 public class Comment : WebKit.DOM.CharacterData, WebKit.DOM.EventTarget {
130 [CCode (has_construct_function = false)]
131 protected Comment ();
132 }
133 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_dom_implementation_get_type ()")]
134 [GIR (name = "DOMDOMImplementation")]
135 public class DOMImplementation : WebKit.DOM.Object {
136 [CCode (has_construct_function = false)]
137 protected DOMImplementation ();
138 public WebKit.DOM.CSSStyleSheet create_css_style_sheet (string title, string media) throws GLib.Error;
139 public unowned WebKit.DOM.Document create_document (string? namespaceURI, string qualifiedName, WebKit.DOM.DocumentType? doctype) throws GLib.Error;
140 public unowned WebKit.DOM.DocumentType create_document_type (string qualifiedName, string publicId, string systemId) throws GLib.Error;
141 public unowned WebKit.DOM.HTMLDocument create_html_document (string title);
142 public bool has_feature (string feature, string version);
143 }
144 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_dom_window_get_type ()")]
145 [GIR (name = "DOMDOMWindow")]
146 public class DOMWindow : WebKit.DOM.Object, WebKit.DOM.EventTarget {
147 [CCode (has_construct_function = false)]
148 protected DOMWindow ();
149 public bool webkit_message_handlers_post_message (string handler, string message);
150 [NoAccessorMethod]
151 public bool closed { get; }
152 [NoAccessorMethod]
153 public string default_status { owned get; set; }
154 [NoAccessorMethod]
155 public double device_pixel_ratio { get; }
156 [NoAccessorMethod]
157 public WebKit.DOM.Document document { owned get; }
158 [NoAccessorMethod]
159 public WebKit.DOM.Element frame_element { owned get; }
160 [NoAccessorMethod]
161 public WebKit.DOM.DOMWindow frames { owned get; }
162 [NoAccessorMethod]
163 public long inner_height { get; }
164 [NoAccessorMethod]
165 public long inner_width { get; }
166 [NoAccessorMethod]
167 public ulong length { get; }
168 [NoAccessorMethod]
169 public string name { owned get; set; }
170 [NoAccessorMethod]
171 public bool offscreen_buffering { get; }
172 [NoAccessorMethod]
173 public WebKit.DOM.DOMWindow opener { owned get; }
174 [NoAccessorMethod]
175 public long outer_height { get; }
176 [NoAccessorMethod]
177 public long outer_width { get; }
178 [NoAccessorMethod]
179 public long page_x_offset { get; }
180 [NoAccessorMethod]
181 public long page_y_offset { get; }
182 [NoAccessorMethod]
183 public WebKit.DOM.DOMWindow parent { owned get; }
184 [NoAccessorMethod]
185 public long screen_left { get; }
186 [NoAccessorMethod]
187 public long screen_top { get; }
188 [NoAccessorMethod]
189 public long screen_x { get; }
190 [NoAccessorMethod]
191 public long screen_y { get; }
192 [NoAccessorMethod]
193 public long scroll_x { get; }
194 [NoAccessorMethod]
195 public long scroll_y { get; }
196 [NoAccessorMethod]
197 public WebKit.DOM.DOMWindow self { owned get; }
198 [NoAccessorMethod]
199 public string status { owned get; set; }
200 [NoAccessorMethod]
201 public WebKit.DOM.DOMWindow top { owned get; }
202 [NoAccessorMethod]
203 public WebKit.DOM.DOMWindow window { owned get; }
204 }
205 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_document_get_type ()")]
206 [GIR (name = "DOMDocument")]
207 public class Document : WebKit.DOM.Node, WebKit.DOM.EventTarget {
208 [CCode (has_construct_function = false)]
209 protected Document ();
210 public unowned WebKit.DOM.Node adopt_node (WebKit.DOM.Node source) throws GLib.Error;
211 public unowned WebKit.DOM.Attr create_attribute (string name) throws GLib.Error;
212 public unowned WebKit.DOM.Attr create_attribute_ns (string? namespaceURI, string qualifiedName) throws GLib.Error;
213 public unowned WebKit.DOM.CDATASection create_cdata_section (string data) throws GLib.Error;
214 public unowned WebKit.DOM.Comment create_comment (string data);
215 public WebKit.DOM.CSSStyleDeclaration create_css_style_declaration ();
216 public unowned WebKit.DOM.DocumentFragment create_document_fragment ();
217 public unowned WebKit.DOM.Element create_element (string tagName) throws GLib.Error;
218 public unowned WebKit.DOM.Element create_element_ns (string? namespaceURI, string qualifiedName) throws GLib.Error;
219 public unowned WebKit.DOM.EntityReference create_entity_reference (string? name) throws GLib.Error;
220 public WebKit.DOM.Event create_event (string eventType) throws GLib.Error;
221 public WebKit.DOM.XPathExpression create_expression (string expression, WebKit.DOM.XPathNSResolver resolver) throws GLib.Error;
222 public WebKit.DOM.NodeIterator create_node_iterator (WebKit.DOM.Node root, ulong whatToShow, WebKit.DOM.NodeFilter? filter, bool expandEntityReferences) throws GLib.Error;
223 public WebKit.DOM.XPathNSResolver create_ns_resolver (WebKit.DOM.Node nodeResolver);
224 public unowned WebKit.DOM.ProcessingInstruction create_processing_instruction (string target, string data) throws GLib.Error;
225 public WebKit.DOM.Range create_range ();
226 public unowned WebKit.DOM.Text create_text_node (string data);
227 public WebKit.DOM.TreeWalker create_tree_walker (WebKit.DOM.Node root, ulong whatToShow, WebKit.DOM.NodeFilter? filter, bool expandEntityReferences) throws GLib.Error;
228 public unowned WebKit.DOM.Element element_from_point (long x, long y);
229 public WebKit.DOM.XPathResult evaluate (string expression, WebKit.DOM.Node contextNode, WebKit.DOM.XPathNSResolver? resolver, ushort type, WebKit.DOM.XPathResult? inResult) throws GLib.Error;
230 public bool exec_command (string command, bool userInterface, string value);
231 public unowned WebKit.DOM.Element get_active_element ();
232 public WebKit.DOM.HTMLCollection get_anchors ();
233 public WebKit.DOM.HTMLCollection get_applets ();
234 public unowned WebKit.DOM.HTMLElement get_body ();
235 public string get_character_set ();
236 public string get_charset ();
237 public string get_cookie () throws GLib.Error;
238 public string get_default_charset ();
239 public WebKit.DOM.DOMWindow get_default_view ();
240 public unowned WebKit.DOM.DocumentType get_doctype ();
241 public unowned WebKit.DOM.Element get_document_element ();
242 public string get_document_uri ();
243 public string get_domain ();
244 public unowned WebKit.DOM.Element get_element_by_id (string elementId);
245 public WebKit.DOM.NodeList get_elements_by_class_name (string tagname);
246 public WebKit.DOM.NodeList get_elements_by_name (string elementName);
247 public WebKit.DOM.NodeList get_elements_by_tag_name (string tagname);
248 public WebKit.DOM.NodeList get_elements_by_tag_name_ns (string namespaceURI, string localName);
249 public WebKit.DOM.HTMLCollection get_forms ();
250 public unowned WebKit.DOM.HTMLHeadElement get_head ();
251 public WebKit.DOM.HTMLCollection get_images ();
252 public WebKit.DOM.DOMImplementation get_implementation ();
253 public string get_input_encoding ();
254 public string get_last_modified ();
255 public WebKit.DOM.HTMLCollection get_links ();
256 public WebKit.DOM.CSSStyleDeclaration get_override_style (WebKit.DOM.Element element, string? pseudoElement);
257 public string get_preferred_stylesheet_set ();
258 public string get_ready_state ();
259 public string get_referrer ();
260 public string get_selected_stylesheet_set ();
261 public unowned WebKit.DOM.StyleSheetList get_style_sheets ();
262 public string get_title ();
263 public string get_url ();
264 public string get_xml_encoding ();
265 public bool get_xml_standalone ();
266 public string get_xml_version ();
267 public bool has_focus ();
268 public unowned WebKit.DOM.Node import_node (WebKit.DOM.Node importedNode, bool deep) throws GLib.Error;
269 public bool query_command_enabled (string command);
270 public bool query_command_indeterm (string command);
271 public bool query_command_state (string command);
272 public bool query_command_supported (string command);
273 public string query_command_value (string command);
274 public unowned WebKit.DOM.Element query_selector (string selectors) throws GLib.Error;
275 public WebKit.DOM.NodeList query_selector_all (string selectors) throws GLib.Error;
276 public void set_body (WebKit.DOM.HTMLElement value) throws GLib.Error;
277 public void set_charset (string value);
278 public void set_cookie (string value) throws GLib.Error;
279 public void set_document_uri (string value);
280 public void set_selected_stylesheet_set (string value);
281 public void set_title (string value);
282 public void set_xml_standalone (bool value) throws GLib.Error;
283 public void set_xml_version (string value) throws GLib.Error;
284 public WebKit.DOM.Element active_element { get; }
285 public WebKit.DOM.HTMLCollection anchors { owned get; }
286 public WebKit.DOM.HTMLCollection applets { owned get; }
287 public WebKit.DOM.HTMLElement body { get; }
288 public string character_set { owned get; }
289 public string charset { owned get; set; }
290 [NoAccessorMethod]
291 public string compat_mode { owned get; }
292 [NoAccessorMethod]
293 public string content_type { owned get; }
294 public string cookie { owned get; set; }
295 [NoAccessorMethod]
296 public WebKit.DOM.HTMLScriptElement current_script { owned get; }
297 public string default_charset { owned get; }
298 public WebKit.DOM.DOMWindow default_view { owned get; }
299 public WebKit.DOM.DocumentType doctype { get; }
300 public WebKit.DOM.Element document_element { get; }
301 public string document_uri { owned get; set; }
302 public string domain { owned get; }
303 public WebKit.DOM.HTMLCollection forms { owned get; }
304 public WebKit.DOM.HTMLHeadElement head { get; }
305 [NoAccessorMethod]
306 public bool hidden { get; }
307 public WebKit.DOM.HTMLCollection images { owned get; }
308 public WebKit.DOM.DOMImplementation implementation { owned get; }
309 public string input_encoding { owned get; }
310 public string last_modified { owned get; }
311 public WebKit.DOM.HTMLCollection links { owned get; }
312 [NoAccessorMethod]
313 public string origin { owned get; }
314 [NoAccessorMethod]
315 public WebKit.DOM.Element pointer_lock_element { owned get; }
316 public string preferred_stylesheet_set { owned get; }
317 public string ready_state { owned get; }
318 public string referrer { owned get; }
319 public string selected_stylesheet_set { owned get; set; }
320 public WebKit.DOM.StyleSheetList style_sheets { get; }
321 public string title { owned get; set; }
322 public string url { owned get; }
323 [NoAccessorMethod]
324 public string visibility_state { owned get; }
325 [NoAccessorMethod]
326 public WebKit.DOM.Element webkit_current_full_screen_element { owned get; }
327 [NoAccessorMethod]
328 public bool webkit_full_screen_keyboard_input_allowed { get; }
329 [NoAccessorMethod]
330 public WebKit.DOM.Element webkit_fullscreen_element { owned get; }
331 [NoAccessorMethod]
332 public bool webkit_fullscreen_enabled { get; }
333 [NoAccessorMethod]
334 public bool webkit_is_full_screen { get; }
335 public string xml_encoding { owned get; }
336 public bool xml_standalone { get; set; }
337 public string xml_version { owned get; set; }
338 }
339 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_document_fragment_get_type ()")]
340 [GIR (name = "DOMDocumentFragment")]
341 public class DocumentFragment : WebKit.DOM.Node, WebKit.DOM.EventTarget {
342 [CCode (has_construct_function = false)]
343 protected DocumentFragment ();
344 }
345 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_document_type_get_type ()")]
346 [GIR (name = "DOMDocumentType")]
347 public class DocumentType : WebKit.DOM.Node, WebKit.DOM.EventTarget {
348 [CCode (has_construct_function = false)]
349 protected DocumentType ();
350 public WebKit.DOM.NamedNodeMap get_entities ();
351 public string get_internal_subset ();
352 public string get_name ();
353 public WebKit.DOM.NamedNodeMap get_notations ();
354 public string get_public_id ();
355 public string get_system_id ();
356 public WebKit.DOM.NamedNodeMap entities { owned get; }
357 public string internal_subset { owned get; }
358 public string name { owned get; }
359 public WebKit.DOM.NamedNodeMap notations { owned get; }
360 public string public_id { owned get; }
361 public string system_id { owned get; }
362 }
363 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_element_get_type ()")]
364 [GIR (name = "DOMElement")]
365 public class Element : WebKit.DOM.Node, WebKit.DOM.EventTarget {
366 [CCode (has_construct_function = false)]
367 protected Element ();
368 public void blur ();
369 public void focus ();
370 public string get_attribute (string name);
371 public unowned WebKit.DOM.Attr get_attribute_node (string name);
372 public unowned WebKit.DOM.Attr get_attribute_node_ns (string namespaceURI, string localName);
373 public string get_attribute_ns (string namespaceURI, string localName);
374 public WebKit.DOM.NamedNodeMap get_attributes ();
375 public ulong get_child_element_count ();
376 public string get_class_name ();
377 public double get_client_height ();
378 public double get_client_left ();
379 public double get_client_top ();
380 public double get_client_width ();
381 public WebKit.DOM.NodeList get_elements_by_class_name (string name);
382 public WebKit.DOM.NodeList get_elements_by_tag_name (string name);
383 public WebKit.DOM.NodeList get_elements_by_tag_name_ns (string namespaceURI, string localName);
384 public unowned WebKit.DOM.Element get_first_element_child ();
385 public string get_id ();
386 public string get_inner_html ();
387 public unowned WebKit.DOM.Element get_last_element_child ();
388 public unowned WebKit.DOM.Element get_next_element_sibling ();
389 public double get_offset_height ();
390 public double get_offset_left ();
391 public unowned WebKit.DOM.Element get_offset_parent ();
392 public double get_offset_top ();
393 public double get_offset_width ();
394 public string get_outer_html ();
395 public unowned WebKit.DOM.Element get_previous_element_sibling ();
396 public long get_scroll_height ();
397 public long get_scroll_left ();
398 public long get_scroll_top ();
399 public long get_scroll_width ();
400 public WebKit.DOM.CSSStyleDeclaration get_style ();
401 public string get_tag_name ();
402 public bool has_attribute (string name);
403 public bool has_attribute_ns (string namespaceURI, string localName);
404 public bool has_attributes ();
405 public unowned WebKit.DOM.Element query_selector (string selectors) throws GLib.Error;
406 public WebKit.DOM.NodeList query_selector_all (string selectors) throws GLib.Error;
407 public void remove_attribute (string name);
408 public unowned WebKit.DOM.Attr remove_attribute_node (WebKit.DOM.Attr oldAttr) throws GLib.Error;
409 public void remove_attribute_ns (string namespaceURI, string localName);
410 public void scroll_by_lines (long lines);
411 public void scroll_by_pages (long pages);
412 public void scroll_into_view (bool alignWithTop);
413 public void scroll_into_view_if_needed (bool centerIfNeeded);
414 public void set_attribute (string name, string value) throws GLib.Error;
415 public unowned WebKit.DOM.Attr set_attribute_node (WebKit.DOM.Attr newAttr) throws GLib.Error;
416 public unowned WebKit.DOM.Attr set_attribute_node_ns (WebKit.DOM.Attr newAttr) throws GLib.Error;
417 public void set_attribute_ns (string? namespaceURI, string qualifiedName, string value) throws GLib.Error;
418 public void set_class_name (string value);
419 public void set_id (string value);
420 public void set_inner_html (string value) throws GLib.Error;
421 public void set_outer_html (string value) throws GLib.Error;
422 public void set_scroll_left (long value);
423 public void set_scroll_top (long value);
424 public WebKit.DOM.NamedNodeMap attributes { owned get; }
425 public ulong child_element_count { get; }
426 public string class_name { owned get; set; }
427 public double client_height { get; }
428 public double client_left { get; }
429 public double client_top { get; }
430 public double client_width { get; }
431 public WebKit.DOM.Element first_element_child { get; }
432 public string id { owned get; set; }
433 public string inner_html { owned get; set; }
434 public WebKit.DOM.Element last_element_child { get; }
435 public WebKit.DOM.Element next_element_sibling { get; }
436 public double offset_height { get; }
437 public double offset_left { get; }
438 public WebKit.DOM.Element offset_parent { get; }
439 public double offset_top { get; }
440 public double offset_width { get; }
441 public string outer_html { owned get; set; }
442 public WebKit.DOM.Element previous_element_sibling { get; }
443 public long scroll_height { get; }
444 public long scroll_left { get; set; }
445 public long scroll_top { get; set; }
446 public long scroll_width { get; }
447 public WebKit.DOM.CSSStyleDeclaration style { owned get; }
448 public string tag_name { owned get; }
449 [NoAccessorMethod]
450 public string webkit_region_overset { owned get; }
451 }
452 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_entity_reference_get_type ()")]
453 [GIR (name = "DOMEntityReference")]
454 public class EntityReference : WebKit.DOM.Node, WebKit.DOM.EventTarget {
455 [CCode (has_construct_function = false)]
456 protected EntityReference ();
457 }
458 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_event_get_type ()")]
459 [GIR (name = "DOMEvent")]
460 public class Event : WebKit.DOM.Object {
461 [CCode (has_construct_function = false)]
462 protected Event ();
463 public bool get_bubbles ();
464 public bool get_cancel_bubble ();
465 public bool get_cancelable ();
466 public WebKit.DOM.EventTarget get_current_target ();
467 public ushort get_event_phase ();
468 public string get_event_type ();
469 public bool get_return_value ();
470 public WebKit.DOM.EventTarget get_src_element ();
471 public WebKit.DOM.EventTarget get_target ();
472 public uint32 get_time_stamp ();
473 public void init_event (string eventTypeArg, bool canBubbleArg, bool cancelableArg);
474 public void prevent_default ();
475 public void set_cancel_bubble (bool value);
476 public void set_return_value (bool value);
477 public void stop_propagation ();
478 public bool bubbles { get; }
479 public bool cancel_bubble { get; set; }
480 public bool cancelable { get; }
481 public WebKit.DOM.EventTarget current_target { owned get; }
482 [NoAccessorMethod]
483 public bool default_prevented { get; }
484 public uint event_phase { get; }
485 public bool return_value { get; set; }
486 public WebKit.DOM.EventTarget src_element { owned get; }
487 public WebKit.DOM.EventTarget target { owned get; }
488 public uint time_stamp { get; }
489 [NoAccessorMethod]
490 public string type { owned get; }
491 }
492 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_file_get_type ()")]
493 [GIR (name = "DOMFile")]
494 public class File : WebKit.DOM.Blob {
495 [CCode (has_construct_function = false)]
496 protected File ();
497 public string get_name ();
498 public string name { owned get; }
499 }
500 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_file_list_get_type ()")]
501 [GIR (name = "DOMFileList")]
502 public class FileList : WebKit.DOM.Object {
503 [CCode (has_construct_function = false)]
504 protected FileList ();
505 public ulong get_length ();
506 public WebKit.DOM.File item (ulong index);
507 public ulong length { get; }
508 }
509 [CCode (cheader_filename = "webkit2/webkit-web-extension.h", type_id = "webkit_dom_html_anchor_element_get_type ()")]
510 [GIR (name = "DOMHTMLAnchorElement")]
511 public class HTMLAnchorElement : WebKit.DOM.HTMLElement, WebKit.DOM.EventTarget {
512 [CCode (has_construct_function = false)]
513 protected HTMLAnchorElement ();
514 public string get_charset ();
515 public string get_coords ();
516 public string get_hash ();
517 public string get_host ();
518 public string get_hostname ();
519 public string get_href ();
520 public string get_hreflang ();
521 public string get_name ();
522 public string get_pathname ();
523 public string get_port ();
524 public string get_protocol ();
525 public string get_rel ();
526 public string get_rev ();
527 public string get_search ();
528 public string get_shape ();
529 public string get_target ();
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: