From 5a5c391bcb18ffac9b9d8498b4c24948a673c822 Mon Sep 17 00:00:00 2001 From: Evgenii Pashkin Date: Sun, 24 Mar 2019 08:15:51 +0300 Subject: [PATCH] Regen with gir 7f03627 --- Cargo.toml | 4 + Gir.toml | 3 +- src/auto/authentication_request.rs | 8 +- src/auto/color_chooser_request.rs | 16 +- src/auto/context_menu_item.rs | 7 +- src/auto/cookie_manager.rs | 112 +++-- src/auto/download.rs | 72 ++-- src/auto/editor_state.rs | 8 +- src/auto/favicon_database.rs | 35 +- src/auto/file_chooser_request.rs | 32 +- src/auto/find_controller.rs | 48 +-- src/auto/javascript_result.rs | 17 +- src/auto/navigation_policy_decision.rs | 48 +-- src/auto/notification.rs | 48 +-- src/auto/print_custom_widget.rs | 16 +- src/auto/print_operation.rs | 45 +- src/auto/response_policy_decision.rs | 16 +- src/auto/settings.rs | 466 ++++++++++---------- src/auto/uri_request.rs | 8 +- src/auto/uri_response.rs | 48 +-- src/auto/uri_scheme_request.rs | 4 +- src/auto/user_content_manager.rs | 28 +- src/auto/user_media_permission_request.rs | 16 +- src/auto/user_script.rs | 8 + src/auto/user_style_sheet.rs | 8 + src/auto/web_context.rs | 72 ++-- src/auto/web_inspector.rs | 64 +-- src/auto/web_resource.rs | 81 ++-- src/auto/web_view.rs | 491 ++++++++++++---------- src/auto/website_data_manager.rs | 56 +-- src/web_view.rs | 1 - webkit2gtk-sys/Cargo.toml | 1 + webkit2gtk-sys/build.rs | 4 +- webkit2gtk-sys/src/lib.rs | 42 +- webkit2gtk-sys/tests/abi.rs | 4 +- 35 files changed, 1036 insertions(+), 901 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 33af62f5..4931067f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ travis-ci = { repository = "gtk-rs/webkit2gtk-rs" } name = "webkit2gtk" [features] +#default = ["v2_22"] v2_2 = [] v2_4 = ["v2_2"] v2_6 = ["v2_4", "webkit2gtk-sys/v2_6"] @@ -28,6 +29,9 @@ v2_10 = ["v2_8", "webkit2gtk-sys/v2_10"] v2_12 = ["v2_10", "webkit2gtk-sys/v2_12"] v2_14 = ["v2_12", "webkit2gtk-sys/v2_14"] v2_16 = ["v2_14", "webkit2gtk-sys/v2_16"] +v2_18 = ["v2_16", "webkit2gtk-sys/v2_18"] +v2_20 = ["v2_18", "webkit2gtk-sys/v2_20"] +v2_22 = ["v2_20", "webkit2gtk-sys/v2_22"] [dependencies] bitflags = "^1.0" diff --git a/Gir.toml b/Gir.toml index 14c676b5..527a0ffe 100644 --- a/Gir.toml +++ b/Gir.toml @@ -110,8 +110,9 @@ manual = [ "Gtk.PrintSettings", "Gtk.Widget", "Gtk.Window", - "JavaScriptCore.GlobalContext", + "JavaScriptCore.GlobalContextRef", "JavaScriptCore.Value", + "JavaScriptCore.ValueRef", "WebKit2.ScriptDialog", ] diff --git a/src/auto/authentication_request.rs b/src/auto/authentication_request.rs index 072ee205..02fe1a1a 100644 --- a/src/auto/authentication_request.rs +++ b/src/auto/authentication_request.rs @@ -134,17 +134,17 @@ impl> AuthenticationRequestExt for O { #[cfg(any(feature = "v2_2", feature = "dox"))] fn connect_cancelled(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"cancelled\0".as_ptr() as *const _, - transmute(cancelled_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(cancelled_trampoline:: as usize)), Box_::into_raw(f)) } } } #[cfg(any(feature = "v2_2", feature = "dox"))] -unsafe extern "C" fn cancelled_trampoline

(this: *mut ffi::WebKitAuthenticationRequest, f: glib_ffi::gpointer) +unsafe extern "C" fn cancelled_trampoline(this: *mut ffi::WebKitAuthenticationRequest, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&AuthenticationRequest::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/color_chooser_request.rs b/src/auto/color_chooser_request.rs index 96a9f5e2..b57553a8 100644 --- a/src/auto/color_chooser_request.rs +++ b/src/auto/color_chooser_request.rs @@ -110,31 +110,31 @@ impl> ColorChooserRequestExt for O { #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, - transmute(finished_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(finished_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_rgba_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::rgba\0".as_ptr() as *const _, - transmute(notify_rgba_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_rgba_trampoline:: as usize)), Box_::into_raw(f)) } } } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn finished_trampoline

(this: *mut ffi::WebKitColorChooserRequest, f: glib_ffi::gpointer) +unsafe extern "C" fn finished_trampoline(this: *mut ffi::WebKitColorChooserRequest, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&ColorChooserRequest::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_rgba_trampoline

(this: *mut ffi::WebKitColorChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_rgba_trampoline(this: *mut ffi::WebKitColorChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&ColorChooserRequest::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/context_menu_item.rs b/src/auto/context_menu_item.rs index a7104c34..30bb9818 100644 --- a/src/auto/context_menu_item.rs +++ b/src/auto/context_menu_item.rs @@ -24,7 +24,7 @@ impl ContextMenuItem { //} //#[cfg(any(feature = "v2_18", feature = "dox"))] - //pub fn new_from_gaction<'a, P: Into>>(action: /*Ignored*/&gio::Action, label: &str, target: P) -> ContextMenuItem { + //pub fn new_from_gaction(action: /*Ignored*/&gio::Action, label: &str, target: Option<&glib::Variant>) -> ContextMenuItem { // unsafe { TODO: call ffi::webkit_context_menu_item_new_from_gaction() } //} @@ -72,7 +72,7 @@ pub trait ContextMenuItemExt: 'static { fn is_separator(&self) -> bool; - fn set_submenu<'a, P: IsA + 'a, Q: Into>>(&self, submenu: Q); + fn set_submenu>(&self, submenu: Option<&P>); } impl> ContextMenuItemExt for O { @@ -103,8 +103,7 @@ impl> ContextMenuItemExt for O { } } - fn set_submenu<'a, P: IsA + 'a, Q: Into>>(&self, submenu: Q) { - let submenu = submenu.into(); + fn set_submenu>(&self, submenu: Option<&P>) { unsafe { ffi::webkit_context_menu_item_set_submenu(self.as_ref().to_glib_none().0, submenu.map(|p| p.as_ref()).to_glib_none().0); } diff --git a/src/auto/cookie_manager.rs b/src/auto/cookie_manager.rs index c6cef150..055aa096 100644 --- a/src/auto/cookie_manager.rs +++ b/src/auto/cookie_manager.rs @@ -35,7 +35,7 @@ pub const NONE_COOKIE_MANAGER: Option<&CookieManager> = None; pub trait CookieManagerExt: 'static { //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn add_cookie<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Q, callback: R); + //fn add_cookie, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Option<&P>, callback: Q); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_20", feature = "dox"))] @@ -45,7 +45,7 @@ pub trait CookieManagerExt: 'static { fn delete_all_cookies(&self); //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn delete_cookie<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Q, callback: R); + //fn delete_cookie, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Option<&P>, callback: Q); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_20", feature = "dox"))] @@ -54,20 +54,20 @@ pub trait CookieManagerExt: 'static { #[cfg_attr(feature = "v2_16", deprecated)] fn delete_cookies_for_domain(&self, domain: &str); - fn get_accept_policy<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, cancellable: Q, callback: R); + fn get_accept_policy, Q: FnOnce(Result) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q); #[cfg(feature = "futures")] fn get_accept_policy_future(&self) -> Box_> where Self: Sized + Clone; //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn get_cookies<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, uri: &str, cancellable: Q, callback: R); + //fn get_cookies, Q: FnOnce(Result, Error>) + Send + 'static>(&self, uri: &str, cancellable: Option<&P>, callback: Q); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_20", feature = "dox"))] //fn get_cookies_future(&self, uri: &str) -> Box_), Error = (Self, Error)>> where Self: Sized + Clone; #[cfg_attr(feature = "v2_16", deprecated)] - fn get_domains_with_cookies<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Q, callback: R); + fn get_domains_with_cookies, Q: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q); #[cfg_attr(feature = "v2_16", deprecated)] #[cfg(feature = "futures")] @@ -82,7 +82,7 @@ pub trait CookieManagerExt: 'static { impl> CookieManagerExt for O { //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn add_cookie<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Q, callback: R) { + //fn add_cookie, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Option<&P>, callback: Q) { // unsafe { TODO: call ffi::webkit_cookie_manager_add_cookie() } //} @@ -98,13 +98,13 @@ impl> CookieManagerExt for O { // let send = Fragile::new(send); // let obj_clone = Fragile::new(obj.clone()); // obj.add_cookie( - // &cookie, - // Some(&cancellable), - // move |res| { - // let obj = obj_clone.into_inner(); - // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - // let _ = send.into_inner().send(res); - // }, + // &cookie, + // Some(&cancellable), + // move |res| { + // let obj = obj_clone.into_inner(); + // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + // let _ = send.into_inner().send(res); + // }, // ); // cancellable @@ -118,7 +118,7 @@ impl> CookieManagerExt for O { } //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn delete_cookie<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Q, callback: R) { + //fn delete_cookie, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Option<&P>, callback: Q) { // unsafe { TODO: call ffi::webkit_cookie_manager_delete_cookie() } //} @@ -134,13 +134,13 @@ impl> CookieManagerExt for O { // let send = Fragile::new(send); // let obj_clone = Fragile::new(obj.clone()); // obj.delete_cookie( - // &cookie, - // Some(&cancellable), - // move |res| { - // let obj = obj_clone.into_inner(); - // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - // let _ = send.into_inner().send(res); - // }, + // &cookie, + // Some(&cancellable), + // move |res| { + // let obj = obj_clone.into_inner(); + // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + // let _ = send.into_inner().send(res); + // }, // ); // cancellable @@ -153,17 +153,16 @@ impl> CookieManagerExt for O { } } - fn get_accept_policy<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, cancellable: Q, callback: R) { - let cancellable = cancellable.into(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn get_accept_policy_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + fn get_accept_policy, Q: FnOnce(Result) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn get_accept_policy_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let ret = ffi::webkit_cookie_manager_get_accept_policy_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(from_glib(ret)) } else { Err(from_glib_full(error)) }; - let callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } - let callback = get_accept_policy_trampoline::; + let callback = get_accept_policy_trampoline::; unsafe { ffi::webkit_cookie_manager_get_accept_policy(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); } @@ -179,12 +178,12 @@ impl> CookieManagerExt for O { let send = Fragile::new(send); let obj_clone = Fragile::new(obj.clone()); obj.get_accept_policy( - Some(&cancellable), - move |res| { - let obj = obj_clone.into_inner(); - let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - let _ = send.into_inner().send(res); - }, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, ); cancellable @@ -192,7 +191,7 @@ impl> CookieManagerExt for O { } //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn get_cookies<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, uri: &str, cancellable: Q, callback: R) { + //fn get_cookies, Q: FnOnce(Result, Error>) + Send + 'static>(&self, uri: &str, cancellable: Option<&P>, callback: Q) { // unsafe { TODO: call ffi::webkit_cookie_manager_get_cookies() } //} @@ -208,30 +207,29 @@ impl> CookieManagerExt for O { // let send = Fragile::new(send); // let obj_clone = Fragile::new(obj.clone()); // obj.get_cookies( - // &uri, - // Some(&cancellable), - // move |res| { - // let obj = obj_clone.into_inner(); - // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - // let _ = send.into_inner().send(res); - // }, + // &uri, + // Some(&cancellable), + // move |res| { + // let obj = obj_clone.into_inner(); + // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + // let _ = send.into_inner().send(res); + // }, // ); // cancellable //}) //} - fn get_domains_with_cookies<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Q, callback: R) { - let cancellable = cancellable.into(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn get_domains_with_cookies_trampoline, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + fn get_domains_with_cookies, Q: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn get_domains_with_cookies_trampoline, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let ret = ffi::webkit_cookie_manager_get_domains_with_cookies_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(FromGlibPtrContainer::from_glib_full(ret)) } else { Err(from_glib_full(error)) }; - let callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } - let callback = get_domains_with_cookies_trampoline::; + let callback = get_domains_with_cookies_trampoline::; unsafe { ffi::webkit_cookie_manager_get_domains_with_cookies(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); } @@ -247,12 +245,12 @@ impl> CookieManagerExt for O { let send = Fragile::new(send); let obj_clone = Fragile::new(obj.clone()); obj.get_domains_with_cookies( - Some(&cancellable), - move |res| { - let obj = obj_clone.into_inner(); - let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - let _ = send.into_inner().send(res); - }, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, ); cancellable @@ -273,16 +271,16 @@ impl> CookieManagerExt for O { fn connect_changed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _, - transmute(changed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(changed_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn changed_trampoline

(this: *mut ffi::WebKitCookieManager, f: glib_ffi::gpointer) +unsafe extern "C" fn changed_trampoline(this: *mut ffi::WebKitCookieManager, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&CookieManager::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/download.rs b/src/auto/download.rs index adc9e676..75ad5f37 100644 --- a/src/auto/download.rs +++ b/src/auto/download.rs @@ -145,130 +145,130 @@ impl> DownloadExt for O { fn connect_created_destination(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"created-destination\0".as_ptr() as *const _, - transmute(created_destination_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(created_destination_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_decide_destination bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"decide-destination\0".as_ptr() as *const _, - transmute(decide_destination_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(decide_destination_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_failed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"failed\0".as_ptr() as *const _, - transmute(failed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(failed_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, - transmute(finished_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(finished_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_received_data(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"received-data\0".as_ptr() as *const _, - transmute(received_data_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(received_data_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn connect_property_allow_overwrite_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::allow-overwrite\0".as_ptr() as *const _, - transmute(notify_allow_overwrite_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_allow_overwrite_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_destination_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::destination\0".as_ptr() as *const _, - transmute(notify_destination_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_destination_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_estimated_progress_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::estimated-progress\0".as_ptr() as *const _, - transmute(notify_estimated_progress_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_estimated_progress_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_response_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::response\0".as_ptr() as *const _, - transmute(notify_response_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_response_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn created_destination_trampoline

(this: *mut ffi::WebKitDownload, destination: *mut libc::c_char, f: glib_ffi::gpointer) +unsafe extern "C" fn created_destination_trampoline(this: *mut ffi::WebKitDownload, destination: *mut libc::c_char, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &str) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Download::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(destination)) } -unsafe extern "C" fn decide_destination_trampoline

(this: *mut ffi::WebKitDownload, suggested_filename: *mut libc::c_char, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn decide_destination_trampoline bool + 'static>(this: *mut ffi::WebKitDownload, suggested_filename: *mut libc::c_char, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &str) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Download::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(suggested_filename)).to_glib() } -unsafe extern "C" fn failed_trampoline

(this: *mut ffi::WebKitDownload, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) +unsafe extern "C" fn failed_trampoline(this: *mut ffi::WebKitDownload, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &Error) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Download::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(error)) } -unsafe extern "C" fn finished_trampoline

(this: *mut ffi::WebKitDownload, f: glib_ffi::gpointer) +unsafe extern "C" fn finished_trampoline(this: *mut ffi::WebKitDownload, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Download::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn received_data_trampoline

(this: *mut ffi::WebKitDownload, data_length: u64, f: glib_ffi::gpointer) +unsafe extern "C" fn received_data_trampoline(this: *mut ffi::WebKitDownload, data_length: u64, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, u64) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Download::from_glib_borrow(this).unsafe_cast(), data_length) } #[cfg(any(feature = "v2_6", feature = "dox"))] -unsafe extern "C" fn notify_allow_overwrite_trampoline

(this: *mut ffi::WebKitDownload, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_allow_overwrite_trampoline(this: *mut ffi::WebKitDownload, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Download::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_destination_trampoline

(this: *mut ffi::WebKitDownload, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_destination_trampoline(this: *mut ffi::WebKitDownload, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Download::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_estimated_progress_trampoline

(this: *mut ffi::WebKitDownload, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_estimated_progress_trampoline(this: *mut ffi::WebKitDownload, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Download::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_response_trampoline

(this: *mut ffi::WebKitDownload, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_response_trampoline(this: *mut ffi::WebKitDownload, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Download::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/editor_state.rs b/src/auto/editor_state.rs index 4683645a..2be344b5 100644 --- a/src/auto/editor_state.rs +++ b/src/auto/editor_state.rs @@ -98,17 +98,17 @@ impl> EditorStateExt for O { #[cfg(any(feature = "v2_10", feature = "dox"))] fn connect_property_typing_attributes_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::typing-attributes\0".as_ptr() as *const _, - transmute(notify_typing_attributes_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_typing_attributes_trampoline:: as usize)), Box_::into_raw(f)) } } } #[cfg(any(feature = "v2_10", feature = "dox"))] -unsafe extern "C" fn notify_typing_attributes_trampoline

(this: *mut ffi::WebKitEditorState, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_typing_attributes_trampoline(this: *mut ffi::WebKitEditorState, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&EditorState::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/favicon_database.rs b/src/auto/favicon_database.rs index a8294d09..1d0f360e 100644 --- a/src/auto/favicon_database.rs +++ b/src/auto/favicon_database.rs @@ -36,7 +36,7 @@ pub const NONE_FAVICON_DATABASE: Option<&FaviconDatabase> = None; pub trait FaviconDatabaseExt: 'static { fn clear(&self); - fn get_favicon<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, page_uri: &str, cancellable: Q, callback: R); + fn get_favicon, Q: FnOnce(Result) + Send + 'static>(&self, page_uri: &str, cancellable: Option<&P>, callback: Q); #[cfg(feature = "futures")] fn get_favicon_future(&self, page_uri: &str) -> Box_> where Self: Sized + Clone; @@ -53,17 +53,16 @@ impl> FaviconDatabaseExt for O { } } - fn get_favicon<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, page_uri: &str, cancellable: Q, callback: R) { - let cancellable = cancellable.into(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn get_favicon_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + fn get_favicon, Q: FnOnce(Result) + Send + 'static>(&self, page_uri: &str, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn get_favicon_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let ret = ffi::webkit_favicon_database_get_favicon_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; - let callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } - let callback = get_favicon_trampoline::; + let callback = get_favicon_trampoline::; unsafe { ffi::webkit_favicon_database_get_favicon(self.as_ref().to_glib_none().0, page_uri.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); } @@ -80,13 +79,13 @@ impl> FaviconDatabaseExt for O { let send = Fragile::new(send); let obj_clone = Fragile::new(obj.clone()); obj.get_favicon( - &page_uri, - Some(&cancellable), - move |res| { - let obj = obj_clone.into_inner(); - let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - let _ = send.into_inner().send(res); - }, + &page_uri, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, ); cancellable @@ -101,16 +100,16 @@ impl> FaviconDatabaseExt for O { fn connect_favicon_changed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"favicon-changed\0".as_ptr() as *const _, - transmute(favicon_changed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(favicon_changed_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn favicon_changed_trampoline

(this: *mut ffi::WebKitFaviconDatabase, page_uri: *mut libc::c_char, favicon_uri: *mut libc::c_char, f: glib_ffi::gpointer) +unsafe extern "C" fn favicon_changed_trampoline(this: *mut ffi::WebKitFaviconDatabase, page_uri: *mut libc::c_char, favicon_uri: *mut libc::c_char, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &str, &str) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FaviconDatabase::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(page_uri), &GString::from_glib_borrow(favicon_uri)) } diff --git a/src/auto/file_chooser_request.rs b/src/auto/file_chooser_request.rs index 74d86e64..fff5434b 100644 --- a/src/auto/file_chooser_request.rs +++ b/src/auto/file_chooser_request.rs @@ -99,58 +99,58 @@ impl> FileChooserRequestExt for O { fn connect_property_filter_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::filter\0".as_ptr() as *const _, - transmute(notify_filter_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_filter_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_mime_types_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::mime-types\0".as_ptr() as *const _, - transmute(notify_mime_types_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_mime_types_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_select_multiple_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::select-multiple\0".as_ptr() as *const _, - transmute(notify_select_multiple_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_select_multiple_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_selected_files_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::selected-files\0".as_ptr() as *const _, - transmute(notify_selected_files_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_selected_files_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn notify_filter_trampoline

(this: *mut ffi::WebKitFileChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_filter_trampoline(this: *mut ffi::WebKitFileChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FileChooserRequest::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_mime_types_trampoline

(this: *mut ffi::WebKitFileChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_mime_types_trampoline(this: *mut ffi::WebKitFileChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FileChooserRequest::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_select_multiple_trampoline

(this: *mut ffi::WebKitFileChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_select_multiple_trampoline(this: *mut ffi::WebKitFileChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FileChooserRequest::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_selected_files_trampoline

(this: *mut ffi::WebKitFileChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_selected_files_trampoline(this: *mut ffi::WebKitFileChooserRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FileChooserRequest::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/find_controller.rs b/src/auto/find_controller.rs index c174aea5..bafa4bfb 100644 --- a/src/auto/find_controller.rs +++ b/src/auto/find_controller.rs @@ -128,86 +128,86 @@ impl> FindControllerExt for O { fn connect_counted_matches(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"counted-matches\0".as_ptr() as *const _, - transmute(counted_matches_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(counted_matches_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_failed_to_find_text(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"failed-to-find-text\0".as_ptr() as *const _, - transmute(failed_to_find_text_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(failed_to_find_text_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_found_text(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"found-text\0".as_ptr() as *const _, - transmute(found_text_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(found_text_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_max_match_count_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::max-match-count\0".as_ptr() as *const _, - transmute(notify_max_match_count_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_max_match_count_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_options_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::options\0".as_ptr() as *const _, - transmute(notify_options_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_options_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_text_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::text\0".as_ptr() as *const _, - transmute(notify_text_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_text_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn counted_matches_trampoline

(this: *mut ffi::WebKitFindController, match_count: libc::c_uint, f: glib_ffi::gpointer) +unsafe extern "C" fn counted_matches_trampoline(this: *mut ffi::WebKitFindController, match_count: libc::c_uint, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, u32) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FindController::from_glib_borrow(this).unsafe_cast(), match_count) } -unsafe extern "C" fn failed_to_find_text_trampoline

(this: *mut ffi::WebKitFindController, f: glib_ffi::gpointer) +unsafe extern "C" fn failed_to_find_text_trampoline(this: *mut ffi::WebKitFindController, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FindController::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn found_text_trampoline

(this: *mut ffi::WebKitFindController, match_count: libc::c_uint, f: glib_ffi::gpointer) +unsafe extern "C" fn found_text_trampoline(this: *mut ffi::WebKitFindController, match_count: libc::c_uint, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, u32) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FindController::from_glib_borrow(this).unsafe_cast(), match_count) } -unsafe extern "C" fn notify_max_match_count_trampoline

(this: *mut ffi::WebKitFindController, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_max_match_count_trampoline(this: *mut ffi::WebKitFindController, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FindController::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_options_trampoline

(this: *mut ffi::WebKitFindController, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_options_trampoline(this: *mut ffi::WebKitFindController, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FindController::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_text_trampoline

(this: *mut ffi::WebKitFindController, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_text_trampoline(this: *mut ffi::WebKitFindController, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&FindController::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/javascript_result.rs b/src/auto/javascript_result.rs index de2bcf8e..13c0f0d2 100644 --- a/src/auto/javascript_result.rs +++ b/src/auto/javascript_result.rs @@ -18,15 +18,24 @@ glib_wrapper! { } impl JavascriptResult { - pub fn get_global_context(&self) -> Option { + #[cfg_attr(feature = "v2_22", deprecated)] + pub fn get_global_context(&self) -> Option { unsafe { - from_glib_full(ffi::webkit_javascript_result_get_global_context(self.to_glib_none().0)) + from_glib_none(ffi::webkit_javascript_result_get_global_context(self.to_glib_none().0)) } } - pub fn get_value(&self) -> Option { + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn get_js_value(&self) -> Option { unsafe { - from_glib_full(ffi::webkit_javascript_result_get_value(self.to_glib_none().0)) + from_glib_none(ffi::webkit_javascript_result_get_js_value(self.to_glib_none().0)) + } + } + + #[cfg_attr(feature = "v2_22", deprecated)] + pub fn get_value(&self) -> Option { + unsafe { + from_glib_none(ffi::webkit_javascript_result_get_value(self.to_glib_none().0)) } } } diff --git a/src/auto/navigation_policy_decision.rs b/src/auto/navigation_policy_decision.rs index 34c620aa..7f382584 100644 --- a/src/auto/navigation_policy_decision.rs +++ b/src/auto/navigation_policy_decision.rs @@ -105,88 +105,88 @@ impl> NavigationPolicyDecisionExt for O { fn connect_property_frame_name_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::frame-name\0".as_ptr() as *const _, - transmute(notify_frame_name_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_frame_name_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_modifiers_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::modifiers\0".as_ptr() as *const _, - transmute(notify_modifiers_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_modifiers_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_mouse_button_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::mouse-button\0".as_ptr() as *const _, - transmute(notify_mouse_button_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_mouse_button_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn connect_property_navigation_action_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::navigation-action\0".as_ptr() as *const _, - transmute(notify_navigation_action_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_navigation_action_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_navigation_type_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::navigation-type\0".as_ptr() as *const _, - transmute(notify_navigation_type_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_navigation_type_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_request_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::request\0".as_ptr() as *const _, - transmute(notify_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_request_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn notify_frame_name_trampoline

(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_frame_name_trampoline(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&NavigationPolicyDecision::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_modifiers_trampoline

(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_modifiers_trampoline(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&NavigationPolicyDecision::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_mouse_button_trampoline

(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_mouse_button_trampoline(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&NavigationPolicyDecision::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_6", feature = "dox"))] -unsafe extern "C" fn notify_navigation_action_trampoline

(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_navigation_action_trampoline(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&NavigationPolicyDecision::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_navigation_type_trampoline

(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_navigation_type_trampoline(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&NavigationPolicyDecision::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_request_trampoline

(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_request_trampoline(this: *mut ffi::WebKitNavigationPolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&NavigationPolicyDecision::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/notification.rs b/src/auto/notification.rs index 9aa6729d..0ea9423f 100644 --- a/src/auto/notification.rs +++ b/src/auto/notification.rs @@ -115,97 +115,97 @@ impl> NotificationExt for O { #[cfg(any(feature = "v2_12", feature = "dox"))] fn connect_clicked(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"clicked\0".as_ptr() as *const _, - transmute(clicked_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(clicked_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_closed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"closed\0".as_ptr() as *const _, - transmute(closed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(closed_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_property_body_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::body\0".as_ptr() as *const _, - transmute(notify_body_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_body_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_property_id_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::id\0".as_ptr() as *const _, - transmute(notify_id_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_id_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn connect_property_tag_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::tag\0".as_ptr() as *const _, - transmute(notify_tag_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_tag_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_property_title_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, - transmute(notify_title_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_title_trampoline:: as usize)), Box_::into_raw(f)) } } } #[cfg(any(feature = "v2_12", feature = "dox"))] -unsafe extern "C" fn clicked_trampoline

(this: *mut ffi::WebKitNotification, f: glib_ffi::gpointer) +unsafe extern "C" fn clicked_trampoline(this: *mut ffi::WebKitNotification, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Notification::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn closed_trampoline

(this: *mut ffi::WebKitNotification, f: glib_ffi::gpointer) +unsafe extern "C" fn closed_trampoline(this: *mut ffi::WebKitNotification, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Notification::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn notify_body_trampoline

(this: *mut ffi::WebKitNotification, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_body_trampoline(this: *mut ffi::WebKitNotification, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Notification::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn notify_id_trampoline

(this: *mut ffi::WebKitNotification, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_id_trampoline(this: *mut ffi::WebKitNotification, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Notification::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_16", feature = "dox"))] -unsafe extern "C" fn notify_tag_trampoline

(this: *mut ffi::WebKitNotification, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_tag_trampoline(this: *mut ffi::WebKitNotification, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Notification::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn notify_title_trampoline

(this: *mut ffi::WebKitNotification, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_title_trampoline(this: *mut ffi::WebKitNotification, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Notification::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/print_custom_widget.rs b/src/auto/print_custom_widget.rs index 5e055ba3..4326cbd3 100644 --- a/src/auto/print_custom_widget.rs +++ b/src/auto/print_custom_widget.rs @@ -77,33 +77,33 @@ impl> PrintCustomWidgetExt for O { #[cfg(any(feature = "v2_16", feature = "dox"))] fn connect_apply(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"apply\0".as_ptr() as *const _, - transmute(apply_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(apply_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn connect_update(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"update\0".as_ptr() as *const _, - transmute(update_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(update_trampoline:: as usize)), Box_::into_raw(f)) } } } #[cfg(any(feature = "v2_16", feature = "dox"))] -unsafe extern "C" fn apply_trampoline

(this: *mut ffi::WebKitPrintCustomWidget, f: glib_ffi::gpointer) +unsafe extern "C" fn apply_trampoline(this: *mut ffi::WebKitPrintCustomWidget, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&PrintCustomWidget::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_16", feature = "dox"))] -unsafe extern "C" fn update_trampoline

(this: *mut ffi::WebKitPrintCustomWidget, page_setup: *mut gtk_ffi::GtkPageSetup, print_settings: *mut gtk_ffi::GtkPrintSettings, f: glib_ffi::gpointer) +unsafe extern "C" fn update_trampoline(this: *mut ffi::WebKitPrintCustomWidget, page_setup: *mut gtk_ffi::GtkPageSetup, print_settings: *mut gtk_ffi::GtkPrintSettings, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, >k::PageSetup, >k::PrintSettings) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&PrintCustomWidget::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(page_setup), &from_glib_borrow(print_settings)) } diff --git a/src/auto/print_operation.rs b/src/auto/print_operation.rs index 90877589..306c1287 100644 --- a/src/auto/print_operation.rs +++ b/src/auto/print_operation.rs @@ -48,7 +48,7 @@ pub trait PrintOperationExt: 'static { fn print(&self); - fn run_dialog<'a, P: IsA + 'a, Q: Into>>(&self, parent: Q) -> PrintOperationResponse; + fn run_dialog>(&self, parent: Option<&P>) -> PrintOperationResponse; fn set_page_setup(&self, page_setup: >k::PageSetup); @@ -87,8 +87,7 @@ impl> PrintOperationExt for O { } } - fn run_dialog<'a, P: IsA + 'a, Q: Into>>(&self, parent: Q) -> PrintOperationResponse { - let parent = parent.into(); + fn run_dialog>(&self, parent: Option<&P>) -> PrintOperationResponse { unsafe { from_glib(ffi::webkit_print_operation_run_dialog(self.as_ref().to_glib_none().0, parent.map(|p| p.as_ref()).to_glib_none().0)) } @@ -117,73 +116,73 @@ impl> PrintOperationExt for O { #[cfg(any(feature = "v2_16", feature = "dox"))] fn connect_create_custom_widget PrintCustomWidget + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ PrintCustomWidget + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"create-custom-widget\0".as_ptr() as *const _, - transmute(create_custom_widget_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(create_custom_widget_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_failed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"failed\0".as_ptr() as *const _, - transmute(failed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(failed_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, - transmute(finished_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(finished_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_page_setup_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::page-setup\0".as_ptr() as *const _, - transmute(notify_page_setup_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_page_setup_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_print_settings_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::print-settings\0".as_ptr() as *const _, - transmute(notify_print_settings_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_print_settings_trampoline:: as usize)), Box_::into_raw(f)) } } } #[cfg(any(feature = "v2_16", feature = "dox"))] -unsafe extern "C" fn create_custom_widget_trampoline

(this: *mut ffi::WebKitPrintOperation, f: glib_ffi::gpointer) -> *mut ffi::WebKitPrintCustomWidget +unsafe extern "C" fn create_custom_widget_trampoline PrintCustomWidget + 'static>(this: *mut ffi::WebKitPrintOperation, f: glib_ffi::gpointer) -> *mut ffi::WebKitPrintCustomWidget where P: IsA { - let f: &&(Fn(&P) -> PrintCustomWidget + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&PrintOperation::from_glib_borrow(this).unsafe_cast()).to_glib_full() } -unsafe extern "C" fn failed_trampoline

(this: *mut ffi::WebKitPrintOperation, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) +unsafe extern "C" fn failed_trampoline(this: *mut ffi::WebKitPrintOperation, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &Error) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&PrintOperation::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(error)) } -unsafe extern "C" fn finished_trampoline

(this: *mut ffi::WebKitPrintOperation, f: glib_ffi::gpointer) +unsafe extern "C" fn finished_trampoline(this: *mut ffi::WebKitPrintOperation, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&PrintOperation::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_page_setup_trampoline

(this: *mut ffi::WebKitPrintOperation, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_page_setup_trampoline(this: *mut ffi::WebKitPrintOperation, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&PrintOperation::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_print_settings_trampoline

(this: *mut ffi::WebKitPrintOperation, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_print_settings_trampoline(this: *mut ffi::WebKitPrintOperation, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&PrintOperation::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/response_policy_decision.rs b/src/auto/response_policy_decision.rs index a3637835..c0d2a00c 100644 --- a/src/auto/response_policy_decision.rs +++ b/src/auto/response_policy_decision.rs @@ -61,30 +61,30 @@ impl> ResponsePolicyDecisionExt for O { fn connect_property_request_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::request\0".as_ptr() as *const _, - transmute(notify_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_request_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_response_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::response\0".as_ptr() as *const _, - transmute(notify_response_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_response_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn notify_request_trampoline

(this: *mut ffi::WebKitResponsePolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_request_trampoline(this: *mut ffi::WebKitResponsePolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&ResponsePolicyDecision::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_response_trampoline

(this: *mut ffi::WebKitResponsePolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_response_trampoline(this: *mut ffi::WebKitResponsePolicyDecision, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&ResponsePolicyDecision::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/settings.rs b/src/auto/settings.rs index 905f0efa..6e65768f 100644 --- a/src/auto/settings.rs +++ b/src/auto/settings.rs @@ -110,6 +110,9 @@ pub trait SettingsExt: 'static { fn get_enable_javascript(&self) -> bool; + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn get_enable_media_capabilities(&self) -> bool; + #[cfg(any(feature = "v2_4", feature = "dox"))] fn get_enable_media_stream(&self) -> bool; @@ -224,6 +227,9 @@ pub trait SettingsExt: 'static { fn set_enable_javascript(&self, enabled: bool); + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn set_enable_media_capabilities(&self, enabled: bool); + #[cfg(any(feature = "v2_4", feature = "dox"))] fn set_enable_media_stream(&self, enabled: bool); @@ -286,9 +292,9 @@ pub trait SettingsExt: 'static { fn set_serif_font_family(&self, serif_font_family: &str); - fn set_user_agent<'a, P: Into>>(&self, user_agent: P); + fn set_user_agent(&self, user_agent: Option<&str>); - fn set_user_agent_with_application_details<'a, 'b, P: Into>, Q: Into>>(&self, application_name: P, application_version: Q); + fn set_user_agent_with_application_details(&self, application_name: Option<&str>, application_version: Option<&str>); fn set_zoom_text_only(&self, zoom_text_only: bool); @@ -340,6 +346,9 @@ pub trait SettingsExt: 'static { fn connect_property_enable_javascript_notify(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn connect_property_enable_media_capabilities_notify(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v2_4", feature = "dox"))] fn connect_property_enable_media_stream_notify(&self, f: F) -> SignalHandlerId; @@ -544,6 +553,13 @@ impl> SettingsExt for O { } } + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn get_enable_media_capabilities(&self) -> bool { + unsafe { + from_glib(ffi::webkit_settings_get_enable_media_capabilities(self.as_ref().to_glib_none().0)) + } + } + #[cfg(any(feature = "v2_4", feature = "dox"))] fn get_enable_media_stream(&self) -> bool { unsafe { @@ -865,6 +881,13 @@ impl> SettingsExt for O { } } + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn set_enable_media_capabilities(&self, enabled: bool) { + unsafe { + ffi::webkit_settings_set_enable_media_capabilities(self.as_ref().to_glib_none().0, enabled.to_glib()); + } + } + #[cfg(any(feature = "v2_4", feature = "dox"))] fn set_enable_media_stream(&self, enabled: bool) { unsafe { @@ -1038,16 +1061,13 @@ impl> SettingsExt for O { } } - fn set_user_agent<'a, P: Into>>(&self, user_agent: P) { - let user_agent = user_agent.into(); + fn set_user_agent(&self, user_agent: Option<&str>) { unsafe { ffi::webkit_settings_set_user_agent(self.as_ref().to_glib_none().0, user_agent.to_glib_none().0); } } - fn set_user_agent_with_application_details<'a, 'b, P: Into>, Q: Into>>(&self, application_name: P, application_version: Q) { - let application_name = application_name.into(); - let application_version = application_version.into(); + fn set_user_agent_with_application_details(&self, application_name: Option<&str>, application_version: Option<&str>) { unsafe { ffi::webkit_settings_set_user_agent_with_application_details(self.as_ref().to_glib_none().0, application_name.to_glib_none().0, application_version.to_glib_none().0); } @@ -1062,747 +1082,763 @@ impl> SettingsExt for O { #[cfg(any(feature = "v2_10", feature = "dox"))] fn connect_property_allow_file_access_from_file_urls_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::allow-file-access-from-file-urls\0".as_ptr() as *const _, - transmute(notify_allow_file_access_from_file_urls_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_allow_file_access_from_file_urls_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_allow_modal_dialogs_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::allow-modal-dialogs\0".as_ptr() as *const _, - transmute(notify_allow_modal_dialogs_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_allow_modal_dialogs_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_14", feature = "dox"))] fn connect_property_allow_universal_access_from_file_urls_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::allow-universal-access-from-file-urls\0".as_ptr() as *const _, - transmute(notify_allow_universal_access_from_file_urls_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_allow_universal_access_from_file_urls_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_auto_load_images_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::auto-load-images\0".as_ptr() as *const _, - transmute(notify_auto_load_images_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_auto_load_images_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_cursive_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::cursive-font-family\0".as_ptr() as *const _, - transmute(notify_cursive_font_family_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_cursive_font_family_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_default_charset_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::default-charset\0".as_ptr() as *const _, - transmute(notify_default_charset_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_default_charset_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_default_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::default-font-family\0".as_ptr() as *const _, - transmute(notify_default_font_family_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_default_font_family_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_default_font_size_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::default-font-size\0".as_ptr() as *const _, - transmute(notify_default_font_size_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_default_font_size_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_default_monospace_font_size_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::default-monospace-font-size\0".as_ptr() as *const _, - transmute(notify_default_monospace_font_size_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_default_monospace_font_size_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_draw_compositing_indicators_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::draw-compositing-indicators\0".as_ptr() as *const _, - transmute(notify_draw_compositing_indicators_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_draw_compositing_indicators_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn connect_property_enable_accelerated_2d_canvas_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-accelerated-2d-canvas\0".as_ptr() as *const _, - transmute(notify_enable_accelerated_2d_canvas_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_accelerated_2d_canvas_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_caret_browsing_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-caret-browsing\0".as_ptr() as *const _, - transmute(notify_enable_caret_browsing_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_caret_browsing_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_developer_extras_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-developer-extras\0".as_ptr() as *const _, - transmute(notify_enable_developer_extras_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_developer_extras_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_dns_prefetching_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-dns-prefetching\0".as_ptr() as *const _, - transmute(notify_enable_dns_prefetching_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_dns_prefetching_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_20", feature = "dox"))] fn connect_property_enable_encrypted_media_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-encrypted-media\0".as_ptr() as *const _, - transmute(notify_enable_encrypted_media_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_encrypted_media_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_frame_flattening_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-frame-flattening\0".as_ptr() as *const _, - transmute(notify_enable_frame_flattening_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_frame_flattening_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_fullscreen_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-fullscreen\0".as_ptr() as *const _, - transmute(notify_enable_fullscreen_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_fullscreen_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_html5_database_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-html5-database\0".as_ptr() as *const _, - transmute(notify_enable_html5_database_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_html5_database_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_html5_local_storage_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-html5-local-storage\0".as_ptr() as *const _, - transmute(notify_enable_html5_local_storage_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_html5_local_storage_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_hyperlink_auditing_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-hyperlink-auditing\0".as_ptr() as *const _, - transmute(notify_enable_hyperlink_auditing_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_hyperlink_auditing_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_java_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-java\0".as_ptr() as *const _, - transmute(notify_enable_java_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_java_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_javascript_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-javascript\0".as_ptr() as *const _, - transmute(notify_enable_javascript_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_javascript_trampoline:: as usize)), Box_::into_raw(f)) + } + } + + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn connect_property_enable_media_capabilities_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::enable-media-capabilities\0".as_ptr() as *const _, + Some(transmute(notify_enable_media_capabilities_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn connect_property_enable_media_stream_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-media-stream\0".as_ptr() as *const _, - transmute(notify_enable_media_stream_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_media_stream_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn connect_property_enable_mediasource_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-mediasource\0".as_ptr() as *const _, - transmute(notify_enable_mediasource_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_mediasource_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_offline_web_application_cache_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-offline-web-application-cache\0".as_ptr() as *const _, - transmute(notify_enable_offline_web_application_cache_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_offline_web_application_cache_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_page_cache_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-page-cache\0".as_ptr() as *const _, - transmute(notify_enable_page_cache_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_page_cache_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_plugins_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-plugins\0".as_ptr() as *const _, - transmute(notify_enable_plugins_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_plugins_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_private_browsing_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-private-browsing\0".as_ptr() as *const _, - transmute(notify_enable_private_browsing_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_private_browsing_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_resizable_text_areas_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-resizable-text-areas\0".as_ptr() as *const _, - transmute(notify_enable_resizable_text_areas_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_resizable_text_areas_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_site_specific_quirks_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-site-specific-quirks\0".as_ptr() as *const _, - transmute(notify_enable_site_specific_quirks_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_site_specific_quirks_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_smooth_scrolling_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-smooth-scrolling\0".as_ptr() as *const _, - transmute(notify_enable_smooth_scrolling_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_smooth_scrolling_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn connect_property_enable_spatial_navigation_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-spatial-navigation\0".as_ptr() as *const _, - transmute(notify_enable_spatial_navigation_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_spatial_navigation_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_tabs_to_links_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-tabs-to-links\0".as_ptr() as *const _, - transmute(notify_enable_tabs_to_links_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_tabs_to_links_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_webaudio_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-webaudio\0".as_ptr() as *const _, - transmute(notify_enable_webaudio_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_webaudio_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_webgl_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-webgl\0".as_ptr() as *const _, - transmute(notify_enable_webgl_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_webgl_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn connect_property_enable_write_console_messages_to_stdout_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-write-console-messages-to-stdout\0".as_ptr() as *const _, - transmute(notify_enable_write_console_messages_to_stdout_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_write_console_messages_to_stdout_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_enable_xss_auditor_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::enable-xss-auditor\0".as_ptr() as *const _, - transmute(notify_enable_xss_auditor_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_enable_xss_auditor_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_fantasy_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::fantasy-font-family\0".as_ptr() as *const _, - transmute(notify_fantasy_font_family_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_fantasy_font_family_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn connect_property_hardware_acceleration_policy_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::hardware-acceleration-policy\0".as_ptr() as *const _, - transmute(notify_hardware_acceleration_policy_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_hardware_acceleration_policy_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_javascript_can_access_clipboard_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::javascript-can-access-clipboard\0".as_ptr() as *const _, - transmute(notify_javascript_can_access_clipboard_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_javascript_can_access_clipboard_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_javascript_can_open_windows_automatically_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::javascript-can-open-windows-automatically\0".as_ptr() as *const _, - transmute(notify_javascript_can_open_windows_automatically_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_javascript_can_open_windows_automatically_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_load_icons_ignoring_image_load_setting_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::load-icons-ignoring-image-load-setting\0".as_ptr() as *const _, - transmute(notify_load_icons_ignoring_image_load_setting_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_load_icons_ignoring_image_load_setting_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_media_playback_allows_inline_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::media-playback-allows-inline\0".as_ptr() as *const _, - transmute(notify_media_playback_allows_inline_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_media_playback_allows_inline_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_media_playback_requires_user_gesture_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::media-playback-requires-user-gesture\0".as_ptr() as *const _, - transmute(notify_media_playback_requires_user_gesture_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_media_playback_requires_user_gesture_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_minimum_font_size_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::minimum-font-size\0".as_ptr() as *const _, - transmute(notify_minimum_font_size_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_minimum_font_size_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_monospace_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::monospace-font-family\0".as_ptr() as *const _, - transmute(notify_monospace_font_family_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_monospace_font_family_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_pictograph_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::pictograph-font-family\0".as_ptr() as *const _, - transmute(notify_pictograph_font_family_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_pictograph_font_family_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_print_backgrounds_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::print-backgrounds\0".as_ptr() as *const _, - transmute(notify_print_backgrounds_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_print_backgrounds_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_sans_serif_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::sans-serif-font-family\0".as_ptr() as *const _, - transmute(notify_sans_serif_font_family_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_sans_serif_font_family_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_serif_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::serif-font-family\0".as_ptr() as *const _, - transmute(notify_serif_font_family_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_serif_font_family_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_user_agent_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::user-agent\0".as_ptr() as *const _, - transmute(notify_user_agent_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_user_agent_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_zoom_text_only_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::zoom-text-only\0".as_ptr() as *const _, - transmute(notify_zoom_text_only_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_zoom_text_only_trampoline:: as usize)), Box_::into_raw(f)) } } } #[cfg(any(feature = "v2_10", feature = "dox"))] -unsafe extern "C" fn notify_allow_file_access_from_file_urls_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_allow_file_access_from_file_urls_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_allow_modal_dialogs_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_allow_modal_dialogs_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_14", feature = "dox"))] -unsafe extern "C" fn notify_allow_universal_access_from_file_urls_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_allow_universal_access_from_file_urls_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_auto_load_images_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_auto_load_images_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_cursive_font_family_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_cursive_font_family_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_default_charset_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_default_charset_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_default_font_family_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_default_font_family_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_default_font_size_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_default_font_size_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_default_monospace_font_size_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_default_monospace_font_size_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_draw_compositing_indicators_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_draw_compositing_indicators_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_2", feature = "dox"))] -unsafe extern "C" fn notify_enable_accelerated_2d_canvas_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_accelerated_2d_canvas_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_caret_browsing_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_caret_browsing_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_developer_extras_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_developer_extras_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_dns_prefetching_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_dns_prefetching_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_20", feature = "dox"))] -unsafe extern "C" fn notify_enable_encrypted_media_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_encrypted_media_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &F = &*(f as *const F); + f(&Settings::from_glib_borrow(this).unsafe_cast()) +} + +unsafe extern "C" fn notify_enable_frame_flattening_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_frame_flattening_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_fullscreen_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_fullscreen_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_html5_database_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_html5_database_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_html5_local_storage_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_html5_local_storage_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_hyperlink_auditing_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_hyperlink_auditing_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_java_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_java_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_javascript_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_javascript_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +#[cfg(any(feature = "v2_22", feature = "dox"))] +unsafe extern "C" fn notify_enable_media_capabilities_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_4", feature = "dox"))] -unsafe extern "C" fn notify_enable_media_stream_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_media_stream_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_4", feature = "dox"))] -unsafe extern "C" fn notify_enable_mediasource_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_mediasource_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_offline_web_application_cache_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_offline_web_application_cache_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_page_cache_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_page_cache_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_plugins_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_plugins_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_private_browsing_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_private_browsing_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_resizable_text_areas_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_resizable_text_areas_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_site_specific_quirks_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_site_specific_quirks_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_smooth_scrolling_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_smooth_scrolling_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_4", feature = "dox"))] -unsafe extern "C" fn notify_enable_spatial_navigation_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_spatial_navigation_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_tabs_to_links_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_tabs_to_links_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_webaudio_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_webaudio_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_webgl_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_webgl_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_2", feature = "dox"))] -unsafe extern "C" fn notify_enable_write_console_messages_to_stdout_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_write_console_messages_to_stdout_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_enable_xss_auditor_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_enable_xss_auditor_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_fantasy_font_family_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_fantasy_font_family_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_16", feature = "dox"))] -unsafe extern "C" fn notify_hardware_acceleration_policy_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_hardware_acceleration_policy_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_javascript_can_access_clipboard_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_javascript_can_access_clipboard_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_javascript_can_open_windows_automatically_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_javascript_can_open_windows_automatically_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_load_icons_ignoring_image_load_setting_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_load_icons_ignoring_image_load_setting_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_media_playback_allows_inline_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_media_playback_allows_inline_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_media_playback_requires_user_gesture_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_media_playback_requires_user_gesture_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_minimum_font_size_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_minimum_font_size_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_monospace_font_family_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_monospace_font_family_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_pictograph_font_family_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_pictograph_font_family_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_print_backgrounds_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_print_backgrounds_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_sans_serif_font_family_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_sans_serif_font_family_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_serif_font_family_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_serif_font_family_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_user_agent_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_user_agent_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_zoom_text_only_trampoline

(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_zoom_text_only_trampoline(this: *mut ffi::WebKitSettings, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&Settings::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/uri_request.rs b/src/auto/uri_request.rs index d7cbd96e..4be23b62 100644 --- a/src/auto/uri_request.rs +++ b/src/auto/uri_request.rs @@ -72,16 +72,16 @@ impl> URIRequestExt for O { fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _, - transmute(notify_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_uri_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn notify_uri_trampoline

(this: *mut ffi::WebKitURIRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_uri_trampoline(this: *mut ffi::WebKitURIRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&URIRequest::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/uri_response.rs b/src/auto/uri_response.rs index f93f72d9..c6bdba6d 100644 --- a/src/auto/uri_response.rs +++ b/src/auto/uri_response.rs @@ -90,88 +90,88 @@ impl> URIResponseExt for O { fn connect_property_content_length_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::content-length\0".as_ptr() as *const _, - transmute(notify_content_length_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_content_length_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn connect_property_http_headers_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::http-headers\0".as_ptr() as *const _, - transmute(notify_http_headers_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_http_headers_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_mime_type_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::mime-type\0".as_ptr() as *const _, - transmute(notify_mime_type_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_mime_type_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_status_code_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::status-code\0".as_ptr() as *const _, - transmute(notify_status_code_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_status_code_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_suggested_filename_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::suggested-filename\0".as_ptr() as *const _, - transmute(notify_suggested_filename_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_suggested_filename_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _, - transmute(notify_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_uri_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn notify_content_length_trampoline

(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_content_length_trampoline(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&URIResponse::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_6", feature = "dox"))] -unsafe extern "C" fn notify_http_headers_trampoline

(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_http_headers_trampoline(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&URIResponse::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_mime_type_trampoline

(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_mime_type_trampoline(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&URIResponse::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_status_code_trampoline

(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_status_code_trampoline(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&URIResponse::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_suggested_filename_trampoline

(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_suggested_filename_trampoline(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&URIResponse::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_uri_trampoline

(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_uri_trampoline(this: *mut ffi::WebKitURIResponse, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&URIResponse::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/uri_scheme_request.rs b/src/auto/uri_scheme_request.rs index 7d716cff..aeb0dd9b 100644 --- a/src/auto/uri_scheme_request.rs +++ b/src/auto/uri_scheme_request.rs @@ -22,7 +22,7 @@ glib_wrapper! { pub const NONE_URI_SCHEME_REQUEST: Option<&URISchemeRequest> = None; pub trait URISchemeRequestExt: 'static { - //fn finish<'a, P: Into>>(&self, stream: /*Ignored*/&gio::InputStream, stream_length: i64, mime_type: P); + //fn finish(&self, stream: /*Ignored*/&gio::InputStream, stream_length: i64, mime_type: Option<&str>); #[cfg(any(feature = "v2_2", feature = "dox"))] fn finish_error(&self, error: &mut Error); @@ -37,7 +37,7 @@ pub trait URISchemeRequestExt: 'static { } impl> URISchemeRequestExt for O { - //fn finish<'a, P: Into>>(&self, stream: /*Ignored*/&gio::InputStream, stream_length: i64, mime_type: P) { + //fn finish(&self, stream: /*Ignored*/&gio::InputStream, stream_length: i64, mime_type: Option<&str>) { // unsafe { TODO: call ffi::webkit_uri_scheme_request_finish() } //} diff --git a/src/auto/user_content_manager.rs b/src/auto/user_content_manager.rs index 5cff8071..bc2fcc1b 100644 --- a/src/auto/user_content_manager.rs +++ b/src/auto/user_content_manager.rs @@ -62,6 +62,9 @@ pub trait UserContentManagerExt: 'static { #[cfg(any(feature = "v2_8", feature = "dox"))] fn register_script_message_handler(&self, name: &str) -> bool; + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn register_script_message_handler_in_world(&self, name: &str, world_name: &str) -> bool; + #[cfg(any(feature = "v2_6", feature = "dox"))] fn remove_all_scripts(&self); @@ -71,6 +74,9 @@ pub trait UserContentManagerExt: 'static { #[cfg(any(feature = "v2_8", feature = "dox"))] fn unregister_script_message_handler(&self, name: &str); + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn unregister_script_message_handler_in_world(&self, name: &str, world_name: &str); + #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_script_message_received(&self, f: F) -> SignalHandlerId; } @@ -97,6 +103,13 @@ impl> UserContentManagerExt for O { } } + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn register_script_message_handler_in_world(&self, name: &str, world_name: &str) -> bool { + unsafe { + from_glib(ffi::webkit_user_content_manager_register_script_message_handler_in_world(self.as_ref().to_glib_none().0, name.to_glib_none().0, world_name.to_glib_none().0)) + } + } + #[cfg(any(feature = "v2_6", feature = "dox"))] fn remove_all_scripts(&self) { unsafe { @@ -118,20 +131,27 @@ impl> UserContentManagerExt for O { } } + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn unregister_script_message_handler_in_world(&self, name: &str, world_name: &str) { + unsafe { + ffi::webkit_user_content_manager_unregister_script_message_handler_in_world(self.as_ref().to_glib_none().0, name.to_glib_none().0, world_name.to_glib_none().0); + } + } + #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_script_message_received(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"script-message-received\0".as_ptr() as *const _, - transmute(script_message_received_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(script_message_received_trampoline:: as usize)), Box_::into_raw(f)) } } } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn script_message_received_trampoline

(this: *mut ffi::WebKitUserContentManager, js_result: *mut ffi::WebKitJavascriptResult, f: glib_ffi::gpointer) +unsafe extern "C" fn script_message_received_trampoline(this: *mut ffi::WebKitUserContentManager, js_result: *mut ffi::WebKitJavascriptResult, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &JavascriptResult) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&UserContentManager::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(js_result)) } diff --git a/src/auto/user_media_permission_request.rs b/src/auto/user_media_permission_request.rs index 17fd39bd..116f0ec7 100644 --- a/src/auto/user_media_permission_request.rs +++ b/src/auto/user_media_permission_request.rs @@ -56,30 +56,30 @@ impl> UserMediaPermissionRequestExt for O { fn connect_property_is_for_audio_device_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::is-for-audio-device\0".as_ptr() as *const _, - transmute(notify_is_for_audio_device_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_is_for_audio_device_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_is_for_video_device_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::is-for-video-device\0".as_ptr() as *const _, - transmute(notify_is_for_video_device_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_is_for_video_device_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn notify_is_for_audio_device_trampoline

(this: *mut ffi::WebKitUserMediaPermissionRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_is_for_audio_device_trampoline(this: *mut ffi::WebKitUserMediaPermissionRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&UserMediaPermissionRequest::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_is_for_video_device_trampoline

(this: *mut ffi::WebKitUserMediaPermissionRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_is_for_video_device_trampoline(this: *mut ffi::WebKitUserMediaPermissionRequest, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&UserMediaPermissionRequest::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/user_script.rs b/src/auto/user_script.rs index de328292..87869aef 100644 --- a/src/auto/user_script.rs +++ b/src/auto/user_script.rs @@ -31,4 +31,12 @@ impl UserScript { from_glib_full(ffi::webkit_user_script_new(source.to_glib_none().0, injected_frames.to_glib(), injection_time.to_glib(), whitelist.to_glib_none().0, blacklist.to_glib_none().0)) } } + + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn new_for_world(source: &str, injected_frames: UserContentInjectedFrames, injection_time: UserScriptInjectionTime, world_name: &str, whitelist: &[&str], blacklist: &[&str]) -> UserScript { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::webkit_user_script_new_for_world(source.to_glib_none().0, injected_frames.to_glib(), injection_time.to_glib(), world_name.to_glib_none().0, whitelist.to_glib_none().0, blacklist.to_glib_none().0)) + } + } } diff --git a/src/auto/user_style_sheet.rs b/src/auto/user_style_sheet.rs index eb154b95..6807b159 100644 --- a/src/auto/user_style_sheet.rs +++ b/src/auto/user_style_sheet.rs @@ -31,4 +31,12 @@ impl UserStyleSheet { from_glib_full(ffi::webkit_user_style_sheet_new(source.to_glib_none().0, injected_frames.to_glib(), level.to_glib(), whitelist.to_glib_none().0, blacklist.to_glib_none().0)) } } + + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn new_for_world(source: &str, injected_frames: UserContentInjectedFrames, level: UserStyleLevel, world_name: &str, whitelist: &[&str], blacklist: &[&str]) -> UserStyleSheet { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::webkit_user_style_sheet_new_for_world(source.to_glib_none().0, injected_frames.to_glib(), level.to_glib(), world_name.to_glib_none().0, whitelist.to_glib_none().0, blacklist.to_glib_none().0)) + } + } } diff --git a/src/auto/web_context.rs b/src/auto/web_context.rs index 9d262323..8fa57578 100644 --- a/src/auto/web_context.rs +++ b/src/auto/web_context.rs @@ -107,7 +107,7 @@ pub trait WebContextExt: 'static { fn get_favicon_database_directory(&self) -> Option; - fn get_plugins<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Q, callback: R); + fn get_plugins, Q: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q); #[cfg(feature = "futures")] fn get_plugins_future(&self) -> Box_), Error = (Self, Error)>> where Self: Sized + Clone; @@ -152,7 +152,7 @@ pub trait WebContextExt: 'static { #[cfg_attr(feature = "v2_10", deprecated)] fn set_disk_cache_directory(&self, directory: &str); - fn set_favicon_database_directory<'a, P: Into>>(&self, path: P); + fn set_favicon_database_directory(&self, path: Option<&str>); fn set_preferred_languages(&self, languages: &[&str]); @@ -233,17 +233,16 @@ impl> WebContextExt for O { } } - fn get_plugins<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Q, callback: R) { - let cancellable = cancellable.into(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn get_plugins_trampoline, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + fn get_plugins, Q: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn get_plugins_trampoline, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let ret = ffi::webkit_web_context_get_plugins_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(FromGlibPtrContainer::from_glib_full(ret)) } else { Err(from_glib_full(error)) }; - let callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } - let callback = get_plugins_trampoline::; + let callback = get_plugins_trampoline::; unsafe { ffi::webkit_web_context_get_plugins(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); } @@ -259,12 +258,12 @@ impl> WebContextExt for O { let send = Fragile::new(send); let obj_clone = Fragile::new(obj.clone()); obj.get_plugins( - Some(&cancellable), - move |res| { - let obj = obj_clone.into_inner(); - let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - let _ = send.into_inner().send(res); - }, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, ); cancellable @@ -344,22 +343,18 @@ impl> WebContextExt for O { } fn register_uri_scheme(&self, scheme: &str, callback: P) { - let callback_data: Box_> = Box::new(callback.into()); + let callback_data: Box_

= Box::new(callback); unsafe extern "C" fn callback_func(request: *mut ffi::WebKitURISchemeRequest, user_data: glib_ffi::gpointer) { let request = from_glib_borrow(request); - let callback: &Box_> = &*(user_data as *mut _); - if let Some(ref callback) = **callback { - callback(&request) - } else { - panic!("cannot get closure...") - }; - } - let callback = if callback_data.is_some() { Some(callback_func::

as _) } else { None }; + let callback: &P = &*(user_data as *mut _); + (*callback)(&request); + } + let callback = Some(callback_func::

as _); unsafe extern "C" fn user_data_destroy_func_func(data: glib_ffi::gpointer) { - let _callback: Box_> = Box_::from_raw(data as *mut _); + let _callback: Box_

= Box_::from_raw(data as *mut _); } let destroy_call4 = Some(user_data_destroy_func_func::

as _); - let super_callback0: Box_> = callback_data; + let super_callback0: Box_

= callback_data; unsafe { ffi::webkit_web_context_register_uri_scheme(self.as_ref().to_glib_none().0, scheme.to_glib_none().0, callback, Box::into_raw(super_callback0) as *mut _, destroy_call4); } @@ -390,8 +385,7 @@ impl> WebContextExt for O { } } - fn set_favicon_database_directory<'a, P: Into>>(&self, path: P) { - let path = path.into(); + fn set_favicon_database_directory(&self, path: Option<&str>) { unsafe { ffi::webkit_web_context_set_favicon_database_directory(self.as_ref().to_glib_none().0, path.to_glib_none().0); } @@ -464,48 +458,48 @@ impl> WebContextExt for O { fn connect_download_started(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"download-started\0".as_ptr() as *const _, - transmute(download_started_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(download_started_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn connect_initialize_notification_permissions(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"initialize-notification-permissions\0".as_ptr() as *const _, - transmute(initialize_notification_permissions_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(initialize_notification_permissions_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn connect_initialize_web_extensions(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"initialize-web-extensions\0".as_ptr() as *const _, - transmute(initialize_web_extensions_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(initialize_web_extensions_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn download_started_trampoline

(this: *mut ffi::WebKitWebContext, download: *mut ffi::WebKitDownload, f: glib_ffi::gpointer) +unsafe extern "C" fn download_started_trampoline(this: *mut ffi::WebKitWebContext, download: *mut ffi::WebKitDownload, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &Download) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebContext::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(download)) } #[cfg(any(feature = "v2_16", feature = "dox"))] -unsafe extern "C" fn initialize_notification_permissions_trampoline

(this: *mut ffi::WebKitWebContext, f: glib_ffi::gpointer) +unsafe extern "C" fn initialize_notification_permissions_trampoline(this: *mut ffi::WebKitWebContext, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebContext::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_4", feature = "dox"))] -unsafe extern "C" fn initialize_web_extensions_trampoline

(this: *mut ffi::WebKitWebContext, f: glib_ffi::gpointer) +unsafe extern "C" fn initialize_web_extensions_trampoline(this: *mut ffi::WebKitWebContext, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebContext::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/web_inspector.rs b/src/auto/web_inspector.rs index c5b95d6d..2bb571b3 100644 --- a/src/auto/web_inspector.rs +++ b/src/auto/web_inspector.rs @@ -121,116 +121,116 @@ impl> WebInspectorExt for O { fn connect_attach bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"attach\0".as_ptr() as *const _, - transmute(attach_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(attach_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_bring_to_front bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"bring-to-front\0".as_ptr() as *const _, - transmute(bring_to_front_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(bring_to_front_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_closed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"closed\0".as_ptr() as *const _, - transmute(closed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(closed_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_detach bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"detach\0".as_ptr() as *const _, - transmute(detach_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(detach_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_open_window bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"open-window\0".as_ptr() as *const _, - transmute(open_window_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(open_window_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_attached_height_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::attached-height\0".as_ptr() as *const _, - transmute(notify_attached_height_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_attached_height_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_property_can_attach_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::can-attach\0".as_ptr() as *const _, - transmute(notify_can_attach_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_can_attach_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_inspected_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::inspected-uri\0".as_ptr() as *const _, - transmute(notify_inspected_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_inspected_uri_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn attach_trampoline

(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn attach_trampoline bool + 'static>(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebInspector::from_glib_borrow(this).unsafe_cast()).to_glib() } -unsafe extern "C" fn bring_to_front_trampoline

(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn bring_to_front_trampoline bool + 'static>(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebInspector::from_glib_borrow(this).unsafe_cast()).to_glib() } -unsafe extern "C" fn closed_trampoline

(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) +unsafe extern "C" fn closed_trampoline(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebInspector::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn detach_trampoline

(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn detach_trampoline bool + 'static>(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebInspector::from_glib_borrow(this).unsafe_cast()).to_glib() } -unsafe extern "C" fn open_window_trampoline

(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn open_window_trampoline bool + 'static>(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebInspector::from_glib_borrow(this).unsafe_cast()).to_glib() } -unsafe extern "C" fn notify_attached_height_trampoline

(this: *mut ffi::WebKitWebInspector, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_attached_height_trampoline(this: *mut ffi::WebKitWebInspector, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebInspector::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn notify_can_attach_trampoline

(this: *mut ffi::WebKitWebInspector, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_can_attach_trampoline(this: *mut ffi::WebKitWebInspector, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebInspector::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_inspected_uri_trampoline

(this: *mut ffi::WebKitWebInspector, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_inspected_uri_trampoline(this: *mut ffi::WebKitWebInspector, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebInspector::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/web_resource.rs b/src/auto/web_resource.rs index 65e69c84..feb81972 100644 --- a/src/auto/web_resource.rs +++ b/src/auto/web_resource.rs @@ -35,7 +35,7 @@ glib_wrapper! { pub const NONE_WEB_RESOURCE: Option<&WebResource> = None; pub trait WebResourceExt: 'static { - fn get_data<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(Vec, usize), Error>) + Send + 'static>(&self, cancellable: Q, callback: R); + fn get_data, Q: FnOnce(Result<(Vec, usize), Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q); #[cfg(feature = "futures")] fn get_data_future(&self) -> Box_, usize)), Error = (Self, Error)>> where Self: Sized + Clone; @@ -61,18 +61,17 @@ pub trait WebResourceExt: 'static { } impl> WebResourceExt for O { - fn get_data<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(Vec, usize), Error>) + Send + 'static>(&self, cancellable: Q, callback: R) { - let cancellable = cancellable.into(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn get_data_trampoline, usize), Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + fn get_data, Q: FnOnce(Result<(Vec, usize), Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn get_data_trampoline, usize), Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let mut length = mem::uninitialized(); let ret = ffi::webkit_web_resource_get_data_finish(_source_object as *mut _, res, &mut length, &mut error); let result = if error.is_null() { Ok((FromGlibContainer::from_glib_full_num(ret, length as usize), length)) } else { Err(from_glib_full(error)) }; - let callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } - let callback = get_data_trampoline::; + let callback = get_data_trampoline::; unsafe { ffi::webkit_web_resource_get_data(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); } @@ -88,12 +87,12 @@ impl> WebResourceExt for O { let send = Fragile::new(send); let obj_clone = Fragile::new(obj.clone()); obj.get_data( - Some(&cancellable), - move |res| { - let obj = obj_clone.into_inner(); - let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - let _ = send.into_inner().send(res); - }, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, ); cancellable @@ -114,102 +113,102 @@ impl> WebResourceExt for O { fn connect_failed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"failed\0".as_ptr() as *const _, - transmute(failed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(failed_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_failed_with_tls_errors(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"failed-with-tls-errors\0".as_ptr() as *const _, - transmute(failed_with_tls_errors_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(failed_with_tls_errors_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, - transmute(finished_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(finished_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_received_data(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"received-data\0".as_ptr() as *const _, - transmute(received_data_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(received_data_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_sent_request(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"sent-request\0".as_ptr() as *const _, - transmute(sent_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(sent_request_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_response_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::response\0".as_ptr() as *const _, - transmute(notify_response_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_response_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _, - transmute(notify_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_uri_trampoline:: as usize)), Box_::into_raw(f)) } } } -unsafe extern "C" fn failed_trampoline

(this: *mut ffi::WebKitWebResource, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) +unsafe extern "C" fn failed_trampoline(this: *mut ffi::WebKitWebResource, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &Error) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebResource::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(error)) } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn failed_with_tls_errors_trampoline

(this: *mut ffi::WebKitWebResource, certificate: *mut gio_ffi::GTlsCertificate, errors: gio_ffi::GTlsCertificateFlags, f: glib_ffi::gpointer) +unsafe extern "C" fn failed_with_tls_errors_trampoline(this: *mut ffi::WebKitWebResource, certificate: *mut gio_ffi::GTlsCertificate, errors: gio_ffi::GTlsCertificateFlags, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &gio::TlsCertificate, gio::TlsCertificateFlags) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebResource::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(certificate), from_glib(errors)) } -unsafe extern "C" fn finished_trampoline

(this: *mut ffi::WebKitWebResource, f: glib_ffi::gpointer) +unsafe extern "C" fn finished_trampoline(this: *mut ffi::WebKitWebResource, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebResource::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn received_data_trampoline

(this: *mut ffi::WebKitWebResource, data_length: u64, f: glib_ffi::gpointer) +unsafe extern "C" fn received_data_trampoline(this: *mut ffi::WebKitWebResource, data_length: u64, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, u64) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebResource::from_glib_borrow(this).unsafe_cast(), data_length) } -unsafe extern "C" fn sent_request_trampoline

(this: *mut ffi::WebKitWebResource, request: *mut ffi::WebKitURIRequest, redirected_response: *mut ffi::WebKitURIResponse, f: glib_ffi::gpointer) +unsafe extern "C" fn sent_request_trampoline(this: *mut ffi::WebKitWebResource, request: *mut ffi::WebKitURIRequest, redirected_response: *mut ffi::WebKitURIResponse, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &URIRequest, &URIResponse) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebResource::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(request), &from_glib_borrow(redirected_response)) } -unsafe extern "C" fn notify_response_trampoline

(this: *mut ffi::WebKitWebResource, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_response_trampoline(this: *mut ffi::WebKitWebResource, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebResource::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_uri_trampoline

(this: *mut ffi::WebKitWebResource, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_uri_trampoline(this: *mut ffi::WebKitWebResource, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebResource::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/web_view.rs b/src/auto/web_view.rs index cc9cb5e8..c17ac10e 100644 --- a/src/auto/web_view.rs +++ b/src/auto/web_view.rs @@ -132,7 +132,7 @@ impl Default for WebView { pub const NONE_WEB_VIEW: Option<&WebView> = None; pub trait WebViewExt: 'static { - fn can_execute_editing_command<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, command: &str, cancellable: Q, callback: R); + fn can_execute_editing_command, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, command: &str, cancellable: Option<&P>, callback: Q); #[cfg(feature = "futures")] fn can_execute_editing_command_future(&self, command: &str) -> Box_> where Self: Sized + Clone; @@ -170,7 +170,8 @@ pub trait WebViewExt: 'static { fn get_inspector(&self) -> Option; - fn get_javascript_global_context(&self) -> Option; + #[cfg_attr(feature = "v2_22", deprecated)] + fn get_javascript_global_context(&self) -> Option; fn get_main_resource(&self) -> Option; @@ -181,7 +182,7 @@ pub trait WebViewExt: 'static { fn get_settings(&self) -> Option; - fn get_snapshot<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, region: SnapshotRegion, options: SnapshotOptions, cancellable: Q, callback: R); + fn get_snapshot, Q: FnOnce(Result) + Send + 'static>(&self, region: SnapshotRegion, options: SnapshotOptions, cancellable: Option<&P>, callback: Q); #[cfg(feature = "futures")] fn get_snapshot_future(&self, region: SnapshotRegion, options: SnapshotOptions) -> Box_> where Self: Sized + Clone; @@ -221,12 +222,12 @@ pub trait WebViewExt: 'static { #[cfg(any(feature = "v2_8", feature = "dox"))] fn is_playing_audio(&self) -> bool; - fn load_alternate_html<'a, P: Into>>(&self, content: &str, content_uri: &str, base_uri: P); + fn load_alternate_html(&self, content: &str, content_uri: &str, base_uri: Option<&str>); #[cfg(any(feature = "v2_6", feature = "dox"))] - fn load_bytes<'a, 'b, 'c, P: Into>, Q: Into>, R: Into>>(&self, bytes: &glib::Bytes, mime_type: P, encoding: Q, base_uri: R); + fn load_bytes(&self, bytes: &glib::Bytes, mime_type: Option<&str>, encoding: Option<&str>, base_uri: Option<&str>); - fn load_html<'a, P: Into>>(&self, content: &str, base_uri: P); + fn load_html(&self, content: &str, base_uri: Option<&str>); fn load_plain_text(&self, plain_text: &str); @@ -241,22 +242,29 @@ pub trait WebViewExt: 'static { #[cfg(any(feature = "v2_12", feature = "dox"))] fn restore_session_state(&self, state: &WebViewSessionState); - fn run_javascript<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, script: &str, cancellable: Q, callback: R); + fn run_javascript, Q: FnOnce(Result) + Send + 'static>(&self, script: &str, cancellable: Option<&P>, callback: Q); #[cfg(feature = "futures")] fn run_javascript_future(&self, script: &str) -> Box_> where Self: Sized + Clone; - fn run_javascript_from_gresource<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, resource: &str, cancellable: Q, callback: R); + fn run_javascript_from_gresource, Q: FnOnce(Result) + Send + 'static>(&self, resource: &str, cancellable: Option<&P>, callback: Q); #[cfg(feature = "futures")] fn run_javascript_from_gresource_future(&self, resource: &str) -> Box_> where Self: Sized + Clone; - //fn save<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, save_mode: SaveMode, cancellable: Q, callback: R); + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn run_javascript_in_world, Q: FnOnce(Result) + Send + 'static>(&self, script: &str, world_name: &str, cancellable: Option<&P>, callback: Q); + + #[cfg(feature = "futures")] + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn run_javascript_in_world_future(&self, script: &str, world_name: &str) -> Box_> where Self: Sized + Clone; + + //fn save, Q: FnOnce(Result) + Send + 'static>(&self, save_mode: SaveMode, cancellable: Option<&P>, callback: Q); //#[cfg(feature = "futures")] //fn save_future(&self, save_mode: SaveMode) -> Box_> where Self: Sized + Clone; - //fn save_to_file<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, file: /*Ignored*/&gio::File, save_mode: SaveMode, cancellable: Q, callback: R); + //fn save_to_file, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, file: /*Ignored*/&gio::File, save_mode: SaveMode, cancellable: Option<&P>, callback: Q); //#[cfg(feature = "futures")] //fn save_to_file_future(&self, file: /*Ignored*/&gio::File, save_mode: SaveMode) -> Box_> where Self: Sized + Clone; @@ -264,7 +272,7 @@ pub trait WebViewExt: 'static { #[cfg(any(feature = "v2_8", feature = "dox"))] fn set_background_color(&self, rgba: &gdk::RGBA); - fn set_custom_charset<'a, P: Into>>(&self, charset: P); + fn set_custom_charset(&self, charset: Option<&str>); #[cfg(any(feature = "v2_8", feature = "dox"))] fn set_editable(&self, editable: bool); @@ -377,17 +385,16 @@ pub trait WebViewExt: 'static { } impl> WebViewExt for O { - fn can_execute_editing_command<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, command: &str, cancellable: Q, callback: R) { - let cancellable = cancellable.into(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn can_execute_editing_command_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + fn can_execute_editing_command, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, command: &str, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn can_execute_editing_command_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let _ = ffi::webkit_web_view_can_execute_editing_command_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }; - let callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } - let callback = can_execute_editing_command_trampoline::; + let callback = can_execute_editing_command_trampoline::; unsafe { ffi::webkit_web_view_can_execute_editing_command(self.as_ref().to_glib_none().0, command.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); } @@ -404,13 +411,13 @@ impl> WebViewExt for O { let send = Fragile::new(send); let obj_clone = Fragile::new(obj.clone()); obj.can_execute_editing_command( - &command, - Some(&cancellable), - move |res| { - let obj = obj_clone.into_inner(); - let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - let _ = send.into_inner().send(res); - }, + &command, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, ); cancellable @@ -512,9 +519,9 @@ impl> WebViewExt for O { } } - fn get_javascript_global_context(&self) -> Option { + fn get_javascript_global_context(&self) -> Option { unsafe { - from_glib_full(ffi::webkit_web_view_get_javascript_global_context(self.as_ref().to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_javascript_global_context(self.as_ref().to_glib_none().0)) } } @@ -543,17 +550,16 @@ impl> WebViewExt for O { } } - fn get_snapshot<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, region: SnapshotRegion, options: SnapshotOptions, cancellable: Q, callback: R) { - let cancellable = cancellable.into(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn get_snapshot_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + fn get_snapshot, Q: FnOnce(Result) + Send + 'static>(&self, region: SnapshotRegion, options: SnapshotOptions, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn get_snapshot_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let ret = ffi::webkit_web_view_get_snapshot_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; - let callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } - let callback = get_snapshot_trampoline::; + let callback = get_snapshot_trampoline::; unsafe { ffi::webkit_web_view_get_snapshot(self.as_ref().to_glib_none().0, region.to_glib(), options.to_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); } @@ -569,14 +575,14 @@ impl> WebViewExt for O { let send = Fragile::new(send); let obj_clone = Fragile::new(obj.clone()); obj.get_snapshot( - region, - options, - Some(&cancellable), - move |res| { - let obj = obj_clone.into_inner(); - let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - let _ = send.into_inner().send(res); - }, + region, + options, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, ); cancellable @@ -681,25 +687,20 @@ impl> WebViewExt for O { } } - fn load_alternate_html<'a, P: Into>>(&self, content: &str, content_uri: &str, base_uri: P) { - let base_uri = base_uri.into(); + fn load_alternate_html(&self, content: &str, content_uri: &str, base_uri: Option<&str>) { unsafe { ffi::webkit_web_view_load_alternate_html(self.as_ref().to_glib_none().0, content.to_glib_none().0, content_uri.to_glib_none().0, base_uri.to_glib_none().0); } } #[cfg(any(feature = "v2_6", feature = "dox"))] - fn load_bytes<'a, 'b, 'c, P: Into>, Q: Into>, R: Into>>(&self, bytes: &glib::Bytes, mime_type: P, encoding: Q, base_uri: R) { - let mime_type = mime_type.into(); - let encoding = encoding.into(); - let base_uri = base_uri.into(); + fn load_bytes(&self, bytes: &glib::Bytes, mime_type: Option<&str>, encoding: Option<&str>, base_uri: Option<&str>) { unsafe { ffi::webkit_web_view_load_bytes(self.as_ref().to_glib_none().0, bytes.to_glib_none().0, mime_type.to_glib_none().0, encoding.to_glib_none().0, base_uri.to_glib_none().0); } } - fn load_html<'a, P: Into>>(&self, content: &str, base_uri: P) { - let base_uri = base_uri.into(); + fn load_html(&self, content: &str, base_uri: Option<&str>) { unsafe { ffi::webkit_web_view_load_html(self.as_ref().to_glib_none().0, content.to_glib_none().0, base_uri.to_glib_none().0); } @@ -742,17 +743,16 @@ impl> WebViewExt for O { } } - fn run_javascript<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, script: &str, cancellable: Q, callback: R) { - let cancellable = cancellable.into(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn run_javascript_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + fn run_javascript, Q: FnOnce(Result) + Send + 'static>(&self, script: &str, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn run_javascript_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let ret = ffi::webkit_web_view_run_javascript_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; - let callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } - let callback = run_javascript_trampoline::; + let callback = run_javascript_trampoline::; unsafe { ffi::webkit_web_view_run_javascript(self.as_ref().to_glib_none().0, script.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); } @@ -769,30 +769,29 @@ impl> WebViewExt for O { let send = Fragile::new(send); let obj_clone = Fragile::new(obj.clone()); obj.run_javascript( - &script, - Some(&cancellable), - move |res| { - let obj = obj_clone.into_inner(); - let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - let _ = send.into_inner().send(res); - }, + &script, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, ); cancellable }) } - fn run_javascript_from_gresource<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, resource: &str, cancellable: Q, callback: R) { - let cancellable = cancellable.into(); - let user_data: Box> = Box::new(Box::new(callback)); - unsafe extern "C" fn run_javascript_from_gresource_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + fn run_javascript_from_gresource, Q: FnOnce(Result) + Send + 'static>(&self, resource: &str, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn run_javascript_from_gresource_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { let mut error = ptr::null_mut(); let ret = ffi::webkit_web_view_run_javascript_from_gresource_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; - let callback: Box> = Box::from_raw(user_data as *mut _); + let callback: Box = Box::from_raw(user_data as *mut _); callback(result); } - let callback = run_javascript_from_gresource_trampoline::; + let callback = run_javascript_from_gresource_trampoline::; unsafe { ffi::webkit_web_view_run_javascript_from_gresource(self.as_ref().to_glib_none().0, resource.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); } @@ -809,20 +808,63 @@ impl> WebViewExt for O { let send = Fragile::new(send); let obj_clone = Fragile::new(obj.clone()); obj.run_javascript_from_gresource( - &resource, - Some(&cancellable), - move |res| { - let obj = obj_clone.into_inner(); - let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - let _ = send.into_inner().send(res); - }, + &resource, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, + ); + + cancellable + }) + } + + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn run_javascript_in_world, Q: FnOnce(Result) + Send + 'static>(&self, script: &str, world_name: &str, cancellable: Option<&P>, callback: Q) { + let user_data: Box = Box::new(callback); + unsafe extern "C" fn run_javascript_in_world_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) { + let mut error = ptr::null_mut(); + let ret = ffi::webkit_web_view_run_javascript_in_world_finish(_source_object as *mut _, res, &mut error); + let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; + let callback: Box = Box::from_raw(user_data as *mut _); + callback(result); + } + let callback = run_javascript_in_world_trampoline::; + unsafe { + ffi::webkit_web_view_run_javascript_in_world(self.as_ref().to_glib_none().0, script.to_glib_none().0, world_name.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _); + } + } + + #[cfg(feature = "futures")] + #[cfg(any(feature = "v2_22", feature = "dox"))] + fn run_javascript_in_world_future(&self, script: &str, world_name: &str) -> Box_> where Self: Sized + Clone { + use gio::GioFuture; + use fragile::Fragile; + + let script = String::from(script); + let world_name = String::from(world_name); + GioFuture::new(self, move |obj, send| { + let cancellable = gio::Cancellable::new(); + let send = Fragile::new(send); + let obj_clone = Fragile::new(obj.clone()); + obj.run_javascript_in_world( + &script, + &world_name, + Some(&cancellable), + move |res| { + let obj = obj_clone.into_inner(); + let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + let _ = send.into_inner().send(res); + }, ); cancellable }) } - //fn save<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, save_mode: SaveMode, cancellable: Q, callback: R) { + //fn save, Q: FnOnce(Result) + Send + 'static>(&self, save_mode: SaveMode, cancellable: Option<&P>, callback: Q) { // unsafe { TODO: call ffi::webkit_web_view_save() } //} @@ -836,20 +878,20 @@ impl> WebViewExt for O { // let send = Fragile::new(send); // let obj_clone = Fragile::new(obj.clone()); // obj.save( - // save_mode, - // Some(&cancellable), - // move |res| { - // let obj = obj_clone.into_inner(); - // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - // let _ = send.into_inner().send(res); - // }, + // save_mode, + // Some(&cancellable), + // move |res| { + // let obj = obj_clone.into_inner(); + // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + // let _ = send.into_inner().send(res); + // }, // ); // cancellable //}) //} - //fn save_to_file<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, file: /*Ignored*/&gio::File, save_mode: SaveMode, cancellable: Q, callback: R) { + //fn save_to_file, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, file: /*Ignored*/&gio::File, save_mode: SaveMode, cancellable: Option<&P>, callback: Q) { // unsafe { TODO: call ffi::webkit_web_view_save_to_file() } //} @@ -864,14 +906,14 @@ impl> WebViewExt for O { // let send = Fragile::new(send); // let obj_clone = Fragile::new(obj.clone()); // obj.save_to_file( - // &file, - // save_mode, - // Some(&cancellable), - // move |res| { - // let obj = obj_clone.into_inner(); - // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - // let _ = send.into_inner().send(res); - // }, + // &file, + // save_mode, + // Some(&cancellable), + // move |res| { + // let obj = obj_clone.into_inner(); + // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + // let _ = send.into_inner().send(res); + // }, // ); // cancellable @@ -885,8 +927,7 @@ impl> WebViewExt for O { } } - fn set_custom_charset<'a, P: Into>>(&self, charset: P) { - let charset = charset.into(); + fn set_custom_charset(&self, charset: Option<&str>) { unsafe { ffi::webkit_web_view_set_custom_charset(self.as_ref().to_glib_none().0, charset.to_glib_none().0); } @@ -979,181 +1020,181 @@ impl> WebViewExt for O { #[cfg(any(feature = "v2_2", feature = "dox"))] fn connect_authenticate bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"authenticate\0".as_ptr() as *const _, - transmute(authenticate_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(authenticate_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_close(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"close\0".as_ptr() as *const _, - transmute(close_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(close_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_context_menu bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"context-menu\0".as_ptr() as *const _, - transmute(context_menu_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(context_menu_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_context_menu_dismissed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"context-menu-dismissed\0".as_ptr() as *const _, - transmute(context_menu_dismissed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(context_menu_dismissed_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn connect_create Option + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ Option + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"create\0".as_ptr() as *const _, - transmute(create_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(create_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_decide_policy bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"decide-policy\0".as_ptr() as *const _, - transmute(decide_policy_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(decide_policy_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_enter_fullscreen bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"enter-fullscreen\0".as_ptr() as *const _, - transmute(enter_fullscreen_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(enter_fullscreen_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_insecure_content_detected(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"insecure-content-detected\0".as_ptr() as *const _, - transmute(insecure_content_detected_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(insecure_content_detected_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_leave_fullscreen bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"leave-fullscreen\0".as_ptr() as *const _, - transmute(leave_fullscreen_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(leave_fullscreen_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_load_changed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"load-changed\0".as_ptr() as *const _, - transmute(load_changed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(load_changed_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_load_failed bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"load-failed\0".as_ptr() as *const _, - transmute(load_failed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(load_failed_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn connect_load_failed_with_tls_errors bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"load-failed-with-tls-errors\0".as_ptr() as *const _, - transmute(load_failed_with_tls_errors_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(load_failed_with_tls_errors_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_mouse_target_changed(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"mouse-target-changed\0".as_ptr() as *const _, - transmute(mouse_target_changed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(mouse_target_changed_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_permission_request bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"permission-request\0".as_ptr() as *const _, - transmute(permission_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(permission_request_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_print bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"print\0".as_ptr() as *const _, - transmute(print_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(print_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_ready_to_show(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"ready-to-show\0".as_ptr() as *const _, - transmute(ready_to_show_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(ready_to_show_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_resource_load_started(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"resource-load-started\0".as_ptr() as *const _, - transmute(resource_load_started_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(resource_load_started_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_run_as_modal(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"run-as-modal\0".as_ptr() as *const _, - transmute(run_as_modal_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(run_as_modal_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_run_color_chooser bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"run-color-chooser\0".as_ptr() as *const _, - transmute(run_color_chooser_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(run_color_chooser_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_run_file_chooser bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"run-file-chooser\0".as_ptr() as *const _, - transmute(run_file_chooser_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(run_file_chooser_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_script_dialog bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"script-dialog\0".as_ptr() as *const _, - transmute(script_dialog_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(script_dialog_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_show_notification bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"show-notification\0".as_ptr() as *const _, - transmute(show_notification_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(show_notification_trampoline:: as usize)), Box_::into_raw(f)) } } @@ -1164,17 +1205,17 @@ impl> WebViewExt for O { fn connect_submit_form(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"submit-form\0".as_ptr() as *const _, - transmute(submit_form_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(submit_form_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_web_process_crashed bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"web-process-crashed\0".as_ptr() as *const _, - transmute(web_process_crashed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(web_process_crashed_trampoline:: as usize)), Box_::into_raw(f)) } } @@ -1186,282 +1227,282 @@ impl> WebViewExt for O { #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_property_editable_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::editable\0".as_ptr() as *const _, - transmute(notify_editable_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_editable_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_estimated_load_progress_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::estimated-load-progress\0".as_ptr() as *const _, - transmute(notify_estimated_load_progress_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_estimated_load_progress_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_favicon_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::favicon\0".as_ptr() as *const _, - transmute(notify_favicon_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_favicon_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_is_loading_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::is-loading\0".as_ptr() as *const _, - transmute(notify_is_loading_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_is_loading_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn connect_property_is_playing_audio_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::is-playing-audio\0".as_ptr() as *const _, - transmute(notify_is_playing_audio_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_is_playing_audio_trampoline:: as usize)), Box_::into_raw(f)) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn connect_property_settings_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::settings\0".as_ptr() as *const _, - transmute(notify_settings_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_settings_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_title_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, - transmute(notify_title_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_title_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _, - transmute(notify_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_uri_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe { - let f: Box_> = Box_::new(Box_::new(f)); + let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::zoom-level\0".as_ptr() as *const _, - transmute(notify_zoom_level_trampoline:: as usize), Box_::into_raw(f) as *mut _) + Some(transmute(notify_zoom_level_trampoline:: as usize)), Box_::into_raw(f)) } } } #[cfg(any(feature = "v2_2", feature = "dox"))] -unsafe extern "C" fn authenticate_trampoline

(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitAuthenticationRequest, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn authenticate_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitAuthenticationRequest, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &AuthenticationRequest) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(request)).to_glib() } -unsafe extern "C" fn close_trampoline

(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) +unsafe extern "C" fn close_trampoline(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn context_menu_trampoline

(this: *mut ffi::WebKitWebView, context_menu: *mut ffi::WebKitContextMenu, event: *mut gdk_ffi::GdkEvent, hit_test_result: *mut ffi::WebKitHitTestResult, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn context_menu_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, context_menu: *mut ffi::WebKitContextMenu, event: *mut gdk_ffi::GdkEvent, hit_test_result: *mut ffi::WebKitHitTestResult, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &ContextMenu, &gdk::Event, &HitTestResult) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(context_menu), &from_glib_none(event), &from_glib_borrow(hit_test_result)).to_glib() } -unsafe extern "C" fn context_menu_dismissed_trampoline

(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) +unsafe extern "C" fn context_menu_dismissed_trampoline(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_6", feature = "dox"))] -unsafe extern "C" fn create_trampoline

(this: *mut ffi::WebKitWebView, navigation_action: *mut ffi::WebKitNavigationAction, f: glib_ffi::gpointer) -> *mut gtk_ffi::GtkWidget +unsafe extern "C" fn create_trampoline Option + 'static>(this: *mut ffi::WebKitWebView, navigation_action: *mut ffi::WebKitNavigationAction, f: glib_ffi::gpointer) -> *mut gtk_ffi::GtkWidget where P: IsA { - let f: &&(Fn(&P, &NavigationAction) -> Option + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(navigation_action)).to_glib_full() } -unsafe extern "C" fn decide_policy_trampoline

(this: *mut ffi::WebKitWebView, decision: *mut ffi::WebKitPolicyDecision, decision_type: ffi::WebKitPolicyDecisionType, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn decide_policy_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, decision: *mut ffi::WebKitPolicyDecision, decision_type: ffi::WebKitPolicyDecisionType, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &PolicyDecision, PolicyDecisionType) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(decision), from_glib(decision_type)).to_glib() } -unsafe extern "C" fn enter_fullscreen_trampoline

(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn enter_fullscreen_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()).to_glib() } -unsafe extern "C" fn insecure_content_detected_trampoline

(this: *mut ffi::WebKitWebView, event: ffi::WebKitInsecureContentEvent, f: glib_ffi::gpointer) +unsafe extern "C" fn insecure_content_detected_trampoline(this: *mut ffi::WebKitWebView, event: ffi::WebKitInsecureContentEvent, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, InsecureContentEvent) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), from_glib(event)) } -unsafe extern "C" fn leave_fullscreen_trampoline

(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn leave_fullscreen_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()).to_glib() } -unsafe extern "C" fn load_changed_trampoline

(this: *mut ffi::WebKitWebView, load_event: ffi::WebKitLoadEvent, f: glib_ffi::gpointer) +unsafe extern "C" fn load_changed_trampoline(this: *mut ffi::WebKitWebView, load_event: ffi::WebKitLoadEvent, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, LoadEvent) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), from_glib(load_event)) } -unsafe extern "C" fn load_failed_trampoline

(this: *mut ffi::WebKitWebView, load_event: ffi::WebKitLoadEvent, failing_uri: *mut libc::c_char, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn load_failed_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, load_event: ffi::WebKitLoadEvent, failing_uri: *mut libc::c_char, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, LoadEvent, &str, &Error) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), from_glib(load_event), &GString::from_glib_borrow(failing_uri), &from_glib_borrow(error)).to_glib() } #[cfg(any(feature = "v2_6", feature = "dox"))] -unsafe extern "C" fn load_failed_with_tls_errors_trampoline

(this: *mut ffi::WebKitWebView, failing_uri: *mut libc::c_char, certificate: *mut gio_ffi::GTlsCertificate, errors: gio_ffi::GTlsCertificateFlags, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn load_failed_with_tls_errors_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, failing_uri: *mut libc::c_char, certificate: *mut gio_ffi::GTlsCertificate, errors: gio_ffi::GTlsCertificateFlags, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &str, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(failing_uri), &from_glib_borrow(certificate), from_glib(errors)).to_glib() } -unsafe extern "C" fn mouse_target_changed_trampoline

(this: *mut ffi::WebKitWebView, hit_test_result: *mut ffi::WebKitHitTestResult, modifiers: libc::c_uint, f: glib_ffi::gpointer) +unsafe extern "C" fn mouse_target_changed_trampoline(this: *mut ffi::WebKitWebView, hit_test_result: *mut ffi::WebKitHitTestResult, modifiers: libc::c_uint, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &HitTestResult, u32) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(hit_test_result), modifiers) } -unsafe extern "C" fn permission_request_trampoline

(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitPermissionRequest, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn permission_request_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitPermissionRequest, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &PermissionRequest) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(request)).to_glib() } -unsafe extern "C" fn print_trampoline

(this: *mut ffi::WebKitWebView, print_operation: *mut ffi::WebKitPrintOperation, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn print_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, print_operation: *mut ffi::WebKitPrintOperation, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &PrintOperation) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(print_operation)).to_glib() } -unsafe extern "C" fn ready_to_show_trampoline

(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) +unsafe extern "C" fn ready_to_show_trampoline(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn resource_load_started_trampoline

(this: *mut ffi::WebKitWebView, resource: *mut ffi::WebKitWebResource, request: *mut ffi::WebKitURIRequest, f: glib_ffi::gpointer) +unsafe extern "C" fn resource_load_started_trampoline(this: *mut ffi::WebKitWebView, resource: *mut ffi::WebKitWebResource, request: *mut ffi::WebKitURIRequest, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &WebResource, &URIRequest) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(resource), &from_glib_borrow(request)) } -unsafe extern "C" fn run_as_modal_trampoline

(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) +unsafe extern "C" fn run_as_modal_trampoline(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn run_color_chooser_trampoline

(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitColorChooserRequest, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn run_color_chooser_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitColorChooserRequest, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &ColorChooserRequest) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(request)).to_glib() } -unsafe extern "C" fn run_file_chooser_trampoline

(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitFileChooserRequest, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn run_file_chooser_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitFileChooserRequest, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &FileChooserRequest) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(request)).to_glib() } -unsafe extern "C" fn script_dialog_trampoline

(this: *mut ffi::WebKitWebView, dialog: *mut ffi::WebKitScriptDialog, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn script_dialog_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, dialog: *mut ffi::WebKitScriptDialog, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &ScriptDialog) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(dialog)).to_glib() } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn show_notification_trampoline

(this: *mut ffi::WebKitWebView, notification: *mut ffi::WebKitNotification, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn show_notification_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, notification: *mut ffi::WebKitNotification, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P, &Notification) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(notification)).to_glib() } -unsafe extern "C" fn submit_form_trampoline

(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitFormSubmissionRequest, f: glib_ffi::gpointer) +unsafe extern "C" fn submit_form_trampoline(this: *mut ffi::WebKitWebView, request: *mut ffi::WebKitFormSubmissionRequest, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P, &FormSubmissionRequest) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(request)) } -unsafe extern "C" fn web_process_crashed_trampoline

(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) -> glib_ffi::gboolean +unsafe extern "C" fn web_process_crashed_trampoline bool + 'static>(this: *mut ffi::WebKitWebView, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { - let f: &&(Fn(&P) -> bool + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()).to_glib() } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn notify_editable_trampoline

(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_editable_trampoline(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_estimated_load_progress_trampoline

(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_estimated_load_progress_trampoline(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_favicon_trampoline

(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_favicon_trampoline(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_is_loading_trampoline

(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_is_loading_trampoline(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_8", feature = "dox"))] -unsafe extern "C" fn notify_is_playing_audio_trampoline

(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_is_playing_audio_trampoline(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } #[cfg(any(feature = "v2_6", feature = "dox"))] -unsafe extern "C" fn notify_settings_trampoline

(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_settings_trampoline(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_title_trampoline

(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_title_trampoline(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_uri_trampoline

(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_uri_trampoline(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } -unsafe extern "C" fn notify_zoom_level_trampoline

(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +unsafe extern "C" fn notify_zoom_level_trampoline(this: *mut ffi::WebKitWebView, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { - let f: &&(Fn(&P) + 'static) = transmute(f); + let f: &F = &*(f as *const F); f(&WebView::from_glib_borrow(this).unsafe_cast()) } diff --git a/src/auto/website_data_manager.rs b/src/auto/website_data_manager.rs index 051dab00..87daa0ef 100644 --- a/src/auto/website_data_manager.rs +++ b/src/auto/website_data_manager.rs @@ -44,14 +44,14 @@ pub const NONE_WEBSITE_DATA_MANAGER: Option<&WebsiteDataManager> = None; pub trait WebsiteDataManagerExt: 'static { //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn clear<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan, cancellable: Q, callback: R); + //fn clear, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan, cancellable: Option<&P>, callback: Q); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_16", feature = "dox"))] //fn clear_future(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan) -> Box_> where Self: Sized + Clone; //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn fetch<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Q, callback: R); + //fn fetch, Q: FnOnce(Result, Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Option<&P>, callback: Q); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_16", feature = "dox"))] @@ -85,7 +85,7 @@ pub trait WebsiteDataManagerExt: 'static { fn is_ephemeral(&self) -> bool; //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn remove<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Q, callback: R); + //fn remove, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Option<&P>, callback: Q); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_16", feature = "dox"))] @@ -97,7 +97,7 @@ pub trait WebsiteDataManagerExt: 'static { impl> WebsiteDataManagerExt for O { //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn clear<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan, cancellable: Q, callback: R) { + //fn clear, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan, cancellable: Option<&P>, callback: Q) { // unsafe { TODO: call ffi::webkit_website_data_manager_clear() } //} @@ -112,14 +112,14 @@ impl> WebsiteDataManagerExt for O { // let send = Fragile::new(send); // let obj_clone = Fragile::new(obj.clone()); // obj.clear( - // types, - // timespan, - // Some(&cancellable), - // move |res| { - // let obj = obj_clone.into_inner(); - // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - // let _ = send.into_inner().send(res); - // }, + // types, + // timespan, + // Some(&cancellable), + // move |res| { + // let obj = obj_clone.into_inner(); + // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + // let _ = send.into_inner().send(res); + // }, // ); // cancellable @@ -127,7 +127,7 @@ impl> WebsiteDataManagerExt for O { //} //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn fetch<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Q, callback: R) { + //fn fetch, Q: FnOnce(Result, Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Option<&P>, callback: Q) { // unsafe { TODO: call ffi::webkit_website_data_manager_fetch() } //} @@ -142,13 +142,13 @@ impl> WebsiteDataManagerExt for O { // let send = Fragile::new(send); // let obj_clone = Fragile::new(obj.clone()); // obj.fetch( - // types, - // Some(&cancellable), - // move |res| { - // let obj = obj_clone.into_inner(); - // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - // let _ = send.into_inner().send(res); - // }, + // types, + // Some(&cancellable), + // move |res| { + // let obj = obj_clone.into_inner(); + // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + // let _ = send.into_inner().send(res); + // }, // ); // cancellable @@ -219,7 +219,7 @@ impl> WebsiteDataManagerExt for O { } //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn remove<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Q, callback: R) { + //fn remove, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Option<&P>, callback: Q) { // unsafe { TODO: call ffi::webkit_website_data_manager_remove() } //} @@ -234,13 +234,13 @@ impl> WebsiteDataManagerExt for O { // let send = Fragile::new(send); // let obj_clone = Fragile::new(obj.clone()); // obj.remove( - // types, - // Some(&cancellable), - // move |res| { - // let obj = obj_clone.into_inner(); - // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); - // let _ = send.into_inner().send(res); - // }, + // types, + // Some(&cancellable), + // move |res| { + // let obj = obj_clone.into_inner(); + // let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v)); + // let _ = send.into_inner().send(res); + // }, // ); // cancellable diff --git a/src/web_view.rs b/src/web_view.rs index a4ce27d1..8a07b645 100644 --- a/src/web_view.rs +++ b/src/web_view.rs @@ -24,7 +24,6 @@ use std::ffi::CString; use std::ptr; use ffi; -use glib::signal::connect; use glib::StaticType; use glib::translate::{FromGlibPtrNone, ToGlib, ToGlibPtr, from_glib_full}; use glib::object::Cast; diff --git a/webkit2gtk-sys/Cargo.toml b/webkit2gtk-sys/Cargo.toml index a1c3269e..e9dce6be 100644 --- a/webkit2gtk-sys/Cargo.toml +++ b/webkit2gtk-sys/Cargo.toml @@ -49,6 +49,7 @@ v2_14 = ["v2_12"] v2_16 = ["v2_14"] v2_18 = ["v2_16"] v2_20 = ["v2_18"] +v2_22 = ["v2_20"] v2_6 = [] v2_8 = ["v2_6"] diff --git a/webkit2gtk-sys/build.rs b/webkit2gtk-sys/build.rs index 3d97e3cc..3251f331 100644 --- a/webkit2gtk-sys/build.rs +++ b/webkit2gtk-sys/build.rs @@ -20,7 +20,9 @@ fn main() { fn find() -> Result<(), Error> { let package_name = "webkit2gtk-4.0"; let shared_libs = ["webkit2gtk-4.0", "javascriptcoregtk-4.0"]; - let version = if cfg!(feature = "v2_20") { + let version = if cfg!(feature = "v2_22") { + "2.22" + } else if cfg!(feature = "v2_20") { "2.20" } else if cfg!(feature = "v2_18") { "2.18" diff --git a/webkit2gtk-sys/src/lib.rs b/webkit2gtk-sys/src/lib.rs index 82eed2eb..34d30ce2 100644 --- a/webkit2gtk-sys/src/lib.rs +++ b/webkit2gtk-sys/src/lib.rs @@ -231,8 +231,8 @@ pub const WEBKIT_EDITING_COMMAND_REDO: *const c_char = b"Redo\0" as *const u8 as pub const WEBKIT_EDITING_COMMAND_SELECT_ALL: *const c_char = b"SelectAll\0" as *const u8 as *const c_char; pub const WEBKIT_EDITING_COMMAND_UNDO: *const c_char = b"Undo\0" as *const u8 as *const c_char; pub const WEBKIT_MAJOR_VERSION: c_int = 2; -pub const WEBKIT_MICRO_VERSION: c_int = 2; -pub const WEBKIT_MINOR_VERSION: c_int = 20; +pub const WEBKIT_MICRO_VERSION: c_int = 5; +pub const WEBKIT_MINOR_VERSION: c_int = 22; // Flags pub type WebKitEditorTypingAttributes = c_uint; @@ -2613,6 +2613,8 @@ extern "C" { //========================================================================= pub fn webkit_javascript_result_get_type() -> GType; pub fn webkit_javascript_result_get_global_context(js_result: *mut WebKitJavascriptResult) -> java_script_core::JSGlobalContextRef; + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn webkit_javascript_result_get_js_value(js_result: *mut WebKitJavascriptResult) -> *mut java_script_core::JSCValue; pub fn webkit_javascript_result_get_value(js_result: *mut WebKitJavascriptResult) -> java_script_core::JSValueRef; pub fn webkit_javascript_result_ref(js_result: *mut WebKitJavascriptResult) -> *mut WebKitJavascriptResult; pub fn webkit_javascript_result_unref(js_result: *mut WebKitJavascriptResult); @@ -2622,7 +2624,7 @@ extern "C" { //========================================================================= pub fn webkit_mime_info_get_type() -> GType; pub fn webkit_mime_info_get_description(info: *mut WebKitMimeInfo) -> *const c_char; - pub fn webkit_mime_info_get_extensions(info: *mut WebKitMimeInfo) -> *mut *mut c_char; + pub fn webkit_mime_info_get_extensions(info: *mut WebKitMimeInfo) -> *const *const c_char; pub fn webkit_mime_info_get_mime_type(info: *mut WebKitMimeInfo) -> *const c_char; pub fn webkit_mime_info_ref(info: *mut WebKitMimeInfo) -> *mut WebKitMimeInfo; pub fn webkit_mime_info_unref(info: *mut WebKitMimeInfo); @@ -2653,7 +2655,7 @@ extern "C" { //========================================================================= pub fn webkit_network_proxy_settings_get_type() -> GType; #[cfg(any(feature = "v2_16", feature = "dox"))] - pub fn webkit_network_proxy_settings_new(default_proxy_uri: *const c_char, ignore_hosts: *mut *mut c_char) -> *mut WebKitNetworkProxySettings; + pub fn webkit_network_proxy_settings_new(default_proxy_uri: *const c_char, ignore_hosts: *const *const c_char) -> *mut WebKitNetworkProxySettings; #[cfg(any(feature = "v2_16", feature = "dox"))] pub fn webkit_network_proxy_settings_add_proxy_for_scheme(proxy_settings: *mut WebKitNetworkProxySettings, scheme: *const c_char, proxy_uri: *const c_char); #[cfg(any(feature = "v2_16", feature = "dox"))] @@ -2720,7 +2722,9 @@ extern "C" { //========================================================================= pub fn webkit_user_script_get_type() -> GType; #[cfg(any(feature = "v2_6", feature = "dox"))] - pub fn webkit_user_script_new(source: *const c_char, injected_frames: WebKitUserContentInjectedFrames, injection_time: WebKitUserScriptInjectionTime, whitelist: *mut *mut c_char, blacklist: *mut *mut c_char) -> *mut WebKitUserScript; + pub fn webkit_user_script_new(source: *const c_char, injected_frames: WebKitUserContentInjectedFrames, injection_time: WebKitUserScriptInjectionTime, whitelist: *const *const c_char, blacklist: *const *const c_char) -> *mut WebKitUserScript; + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn webkit_user_script_new_for_world(source: *const c_char, injected_frames: WebKitUserContentInjectedFrames, injection_time: WebKitUserScriptInjectionTime, world_name: *const c_char, whitelist: *const *const c_char, blacklist: *const *const c_char) -> *mut WebKitUserScript; #[cfg(any(feature = "v2_6", feature = "dox"))] pub fn webkit_user_script_ref(user_script: *mut WebKitUserScript) -> *mut WebKitUserScript; #[cfg(any(feature = "v2_6", feature = "dox"))] @@ -2731,7 +2735,9 @@ extern "C" { //========================================================================= pub fn webkit_user_style_sheet_get_type() -> GType; #[cfg(any(feature = "v2_6", feature = "dox"))] - pub fn webkit_user_style_sheet_new(source: *const c_char, injected_frames: WebKitUserContentInjectedFrames, level: WebKitUserStyleLevel, whitelist: *mut *mut c_char, blacklist: *mut *mut c_char) -> *mut WebKitUserStyleSheet; + pub fn webkit_user_style_sheet_new(source: *const c_char, injected_frames: WebKitUserContentInjectedFrames, level: WebKitUserStyleLevel, whitelist: *const *const c_char, blacklist: *const *const c_char) -> *mut WebKitUserStyleSheet; + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn webkit_user_style_sheet_new_for_world(source: *const c_char, injected_frames: WebKitUserContentInjectedFrames, level: WebKitUserStyleLevel, world_name: *const c_char, whitelist: *const *const c_char, blacklist: *const *const c_char) -> *mut WebKitUserStyleSheet; #[cfg(any(feature = "v2_6", feature = "dox"))] pub fn webkit_user_style_sheet_ref(user_style_sheet: *mut WebKitUserStyleSheet) -> *mut WebKitUserStyleSheet; #[cfg(any(feature = "v2_6", feature = "dox"))] @@ -2943,11 +2949,11 @@ extern "C" { //========================================================================= pub fn webkit_file_chooser_request_get_type() -> GType; pub fn webkit_file_chooser_request_cancel(request: *mut WebKitFileChooserRequest); - pub fn webkit_file_chooser_request_get_mime_types(request: *mut WebKitFileChooserRequest) -> *mut *mut c_char; + pub fn webkit_file_chooser_request_get_mime_types(request: *mut WebKitFileChooserRequest) -> *const *const c_char; pub fn webkit_file_chooser_request_get_mime_types_filter(request: *mut WebKitFileChooserRequest) -> *mut gtk::GtkFileFilter; pub fn webkit_file_chooser_request_get_select_multiple(request: *mut WebKitFileChooserRequest) -> gboolean; - pub fn webkit_file_chooser_request_get_selected_files(request: *mut WebKitFileChooserRequest) -> *mut *mut c_char; - pub fn webkit_file_chooser_request_select_files(request: *mut WebKitFileChooserRequest, files: *mut *mut c_char); + pub fn webkit_file_chooser_request_get_selected_files(request: *mut WebKitFileChooserRequest) -> *const *const c_char; + pub fn webkit_file_chooser_request_select_files(request: *mut WebKitFileChooserRequest, files: *const *const c_char); //========================================================================= // WebKitFindController @@ -3151,6 +3157,8 @@ extern "C" { pub fn webkit_settings_get_enable_hyperlink_auditing(settings: *mut WebKitSettings) -> gboolean; pub fn webkit_settings_get_enable_java(settings: *mut WebKitSettings) -> gboolean; pub fn webkit_settings_get_enable_javascript(settings: *mut WebKitSettings) -> gboolean; + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn webkit_settings_get_enable_media_capabilities(settings: *mut WebKitSettings) -> gboolean; pub fn webkit_settings_get_enable_media_stream(settings: *mut WebKitSettings) -> gboolean; pub fn webkit_settings_get_enable_mediasource(settings: *mut WebKitSettings) -> gboolean; pub fn webkit_settings_get_enable_offline_web_application_cache(settings: *mut WebKitSettings) -> gboolean; @@ -3207,6 +3215,8 @@ extern "C" { pub fn webkit_settings_set_enable_hyperlink_auditing(settings: *mut WebKitSettings, enabled: gboolean); pub fn webkit_settings_set_enable_java(settings: *mut WebKitSettings, enabled: gboolean); pub fn webkit_settings_set_enable_javascript(settings: *mut WebKitSettings, enabled: gboolean); + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn webkit_settings_set_enable_media_capabilities(settings: *mut WebKitSettings, enabled: gboolean); pub fn webkit_settings_set_enable_media_stream(settings: *mut WebKitSettings, enabled: gboolean); pub fn webkit_settings_set_enable_mediasource(settings: *mut WebKitSettings, enabled: gboolean); pub fn webkit_settings_set_enable_offline_web_application_cache(settings: *mut WebKitSettings, enabled: gboolean); @@ -3286,12 +3296,16 @@ extern "C" { pub fn webkit_user_content_manager_add_style_sheet(manager: *mut WebKitUserContentManager, stylesheet: *mut WebKitUserStyleSheet); #[cfg(any(feature = "v2_8", feature = "dox"))] pub fn webkit_user_content_manager_register_script_message_handler(manager: *mut WebKitUserContentManager, name: *const c_char) -> gboolean; + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn webkit_user_content_manager_register_script_message_handler_in_world(manager: *mut WebKitUserContentManager, name: *const c_char, world_name: *const c_char) -> gboolean; #[cfg(any(feature = "v2_6", feature = "dox"))] pub fn webkit_user_content_manager_remove_all_scripts(manager: *mut WebKitUserContentManager); #[cfg(any(feature = "v2_6", feature = "dox"))] pub fn webkit_user_content_manager_remove_all_style_sheets(manager: *mut WebKitUserContentManager); #[cfg(any(feature = "v2_8", feature = "dox"))] pub fn webkit_user_content_manager_unregister_script_message_handler(manager: *mut WebKitUserContentManager, name: *const c_char); + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn webkit_user_content_manager_unregister_script_message_handler_in_world(manager: *mut WebKitUserContentManager, name: *const c_char, world_name: *const c_char); //========================================================================= // WebKitUserMediaPermissionRequest @@ -3322,7 +3336,7 @@ extern "C" { pub fn webkit_web_context_get_process_model(context: *mut WebKitWebContext) -> WebKitProcessModel; pub fn webkit_web_context_get_security_manager(context: *mut WebKitWebContext) -> *mut WebKitSecurityManager; pub fn webkit_web_context_get_spell_checking_enabled(context: *mut WebKitWebContext) -> gboolean; - pub fn webkit_web_context_get_spell_checking_languages(context: *mut WebKitWebContext) -> *mut *mut c_char; + pub fn webkit_web_context_get_spell_checking_languages(context: *mut WebKitWebContext) -> *const *const c_char; pub fn webkit_web_context_get_tls_errors_policy(context: *mut WebKitWebContext) -> WebKitTLSErrorsPolicy; #[cfg(any(feature = "v2_10", feature = "dox"))] pub fn webkit_web_context_get_web_process_count_limit(context: *mut WebKitWebContext) -> c_uint; @@ -3344,10 +3358,10 @@ extern "C" { pub fn webkit_web_context_set_favicon_database_directory(context: *mut WebKitWebContext, path: *const c_char); #[cfg(any(feature = "v2_16", feature = "dox"))] pub fn webkit_web_context_set_network_proxy_settings(context: *mut WebKitWebContext, proxy_mode: WebKitNetworkProxyMode, proxy_settings: *mut WebKitNetworkProxySettings); - pub fn webkit_web_context_set_preferred_languages(context: *mut WebKitWebContext, languages: *mut *mut c_char); + pub fn webkit_web_context_set_preferred_languages(context: *mut WebKitWebContext, languages: *const *const c_char); pub fn webkit_web_context_set_process_model(context: *mut WebKitWebContext, process_model: WebKitProcessModel); pub fn webkit_web_context_set_spell_checking_enabled(context: *mut WebKitWebContext, enabled: gboolean); - pub fn webkit_web_context_set_spell_checking_languages(context: *mut WebKitWebContext, languages: *mut *mut c_char); + pub fn webkit_web_context_set_spell_checking_languages(context: *mut WebKitWebContext, languages: *const *const c_char); pub fn webkit_web_context_set_tls_errors_policy(context: *mut WebKitWebContext, policy: WebKitTLSErrorsPolicy); pub fn webkit_web_context_set_web_extensions_directory(context: *mut WebKitWebContext, directory: *const c_char); pub fn webkit_web_context_set_web_extensions_initialization_user_data(context: *mut WebKitWebContext, user_data: *mut glib::GVariant); @@ -3452,6 +3466,10 @@ extern "C" { pub fn webkit_web_view_run_javascript_finish(web_view: *mut WebKitWebView, result: *mut gio::GAsyncResult, error: *mut *mut glib::GError) -> *mut WebKitJavascriptResult; pub fn webkit_web_view_run_javascript_from_gresource(web_view: *mut WebKitWebView, resource: *const c_char, cancellable: *mut gio::GCancellable, callback: gio::GAsyncReadyCallback, user_data: gpointer); pub fn webkit_web_view_run_javascript_from_gresource_finish(web_view: *mut WebKitWebView, result: *mut gio::GAsyncResult, error: *mut *mut glib::GError) -> *mut WebKitJavascriptResult; + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn webkit_web_view_run_javascript_in_world(web_view: *mut WebKitWebView, script: *const c_char, world_name: *const c_char, cancellable: *mut gio::GCancellable, callback: gio::GAsyncReadyCallback, user_data: gpointer); + #[cfg(any(feature = "v2_22", feature = "dox"))] + pub fn webkit_web_view_run_javascript_in_world_finish(web_view: *mut WebKitWebView, result: *mut gio::GAsyncResult, error: *mut *mut glib::GError) -> *mut WebKitJavascriptResult; pub fn webkit_web_view_save(web_view: *mut WebKitWebView, save_mode: WebKitSaveMode, cancellable: *mut gio::GCancellable, callback: gio::GAsyncReadyCallback, user_data: gpointer); pub fn webkit_web_view_save_finish(web_view: *mut WebKitWebView, result: *mut gio::GAsyncResult, error: *mut *mut glib::GError) -> *mut gio::GInputStream; pub fn webkit_web_view_save_to_file(web_view: *mut WebKitWebView, file: *mut gio::GFile, save_mode: WebKitSaveMode, cancellable: *mut gio::GCancellable, callback: gio::GAsyncReadyCallback, user_data: gpointer); diff --git a/webkit2gtk-sys/tests/abi.rs b/webkit2gtk-sys/tests/abi.rs index 5944245e..e049c579 100644 --- a/webkit2gtk-sys/tests/abi.rs +++ b/webkit2gtk-sys/tests/abi.rs @@ -465,8 +465,8 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[ ("(gint) WEBKIT_LOAD_REDIRECTED", "1"), ("(gint) WEBKIT_LOAD_STARTED", "0"), ("WEBKIT_MAJOR_VERSION", "2"), - ("WEBKIT_MICRO_VERSION", "2"), - ("WEBKIT_MINOR_VERSION", "20"), + ("WEBKIT_MICRO_VERSION", "5"), + ("WEBKIT_MINOR_VERSION", "22"), ("(gint) WEBKIT_NAVIGATION_TYPE_BACK_FORWARD", "2"), ("(gint) WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED", "4"), ("(gint) WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED", "1"),