From 9ad94f5e891e092b1d1b99da734ac239f7701f15 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Thu, 17 Jan 2019 10:03:23 +0100 Subject: [PATCH] regenerate --- examples/main.rs | 8 +- gir | 2 +- gir-files | 2 +- src/auto/authentication_request.rs | 56 +- src/auto/back_forward_list.rs | 35 +- src/auto/back_forward_list_item.rs | 36 +- src/auto/color_chooser_request.rs | 44 +- src/auto/context_menu.rs | 63 +-- src/auto/context_menu_item.rs | 34 +- src/auto/cookie_manager.rs | 96 ++-- src/auto/credential.rs | 11 +- src/auto/download.rs | 86 ++-- src/auto/editor_state.rs | 40 +- src/auto/enums.rs | 373 ++++++++++++++ src/auto/favicon_database.rs | 53 +- src/auto/file_chooser_request.rs | 61 ++- src/auto/find_controller.rs | 77 +-- src/auto/form_submission_request.rs | 19 +- src/auto/geolocation_permission_request.rs | 15 +- src/auto/hit_test_result.rs | 62 ++- ...issing_media_plugins_permission_request.rs | 25 +- src/auto/javascript_result.rs | 4 - src/auto/mime_info.rs | 11 +- src/auto/mod.rs | 78 +-- src/auto/navigation_action.rs | 5 +- src/auto/navigation_policy_decision.rs | 64 +-- src/auto/network_proxy_settings.rs | 5 +- src/auto/notification.rs | 74 +-- src/auto/notification_permission_request.rs | 15 +- src/auto/permission_request.rs | 21 +- src/auto/plugin.rs | 38 +- src/auto/policy_decision.rs | 23 +- src/auto/print_custom_widget.rs | 44 +- src/auto/print_operation.rs | 69 +-- src/auto/response_policy_decision.rs | 37 +- src/auto/security_manager.rs | 41 +- src/auto/security_origin.rs | 13 +- src/auto/settings.rs | 481 +++++++++--------- src/auto/uri_request.rs | 42 +- src/auto/uri_response.rs | 70 +-- src/auto/uri_scheme_request.rs | 40 +- src/auto/user_content_manager.rs | 40 +- src/auto/user_media_permission_request.rs | 34 +- src/auto/user_script.rs | 7 +- src/auto/user_style_sheet.rs | 7 +- src/auto/versions.txt | 4 +- src/auto/web_context.rs | 140 ++--- src/auto/web_inspector.rs | 78 +-- src/auto/web_resource.rs | 79 +-- src/auto/web_view.rs | 412 ++++++++------- src/auto/web_view_base.rs | 19 +- src/auto/web_view_session_state.rs | 5 +- src/auto/website_data_manager.rs | 94 ++-- src/auto/window_properties.rs | 33 +- src/web_view.rs | 11 +- 55 files changed, 1956 insertions(+), 1380 deletions(-) diff --git a/examples/main.rs b/examples/main.rs index 3bfe3f39..0ea645fd 100644 --- a/examples/main.rs +++ b/examples/main.rs @@ -26,7 +26,7 @@ extern crate webkit2gtk; #[cfg(feature = "v2_4")] use glib::ToVariant; use gtk::{ContainerExt, Inhibit, WidgetExt, Window, WindowType}; -use webkit2gtk::{SettingsExt, WebContext, WebContextExt, WebView, WebViewExt, WebViewExtManual}; +use webkit2gtk::{SettingsExt, WebContext, WebContextExt, WebView, WebViewExt}; #[cfg(feature = "v2_6")] use webkit2gtk::UserContentManager; @@ -53,8 +53,10 @@ fn main() { window.show_all(); - webview.run_javascript("alert('Hello');"); - webview.run_javascript_with_callback("42", |result| { + webview.run_javascript("alert('Hello');", None::<&gio::Cancellable>, |_result|{}); + + let cancellable = gio::Cancellable::new(); + webview.run_javascript("42", Some(&cancellable), |result| { match result { Ok(result) => { let context = result.get_global_context().unwrap(); diff --git a/gir b/gir index c385982d..2f0a3173 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit c385982dbed5fdbdf1ae6f95c885a475cafc93f6 +Subproject commit 2f0a3173b8cdf0e4b0f94fce5da033bfb137772a diff --git a/gir-files b/gir-files index a08aa4c2..62f3bf00 160000 --- a/gir-files +++ b/gir-files @@ -1 +1 @@ -Subproject commit a08aa4c2cb6cd82e4cbdddc0e87461298a6abf87 +Subproject commit 62f3bf007943b3464400678cfeea572cc556273a diff --git a/src/auto/authentication_request.rs b/src/auto/authentication_request.rs index 15db2cf0..072ee205 100644 --- a/src/auto/authentication_request.rs +++ b/src/auto/authentication_request.rs @@ -7,33 +7,35 @@ use AuthenticationScheme; #[cfg(any(feature = "v2_2", feature = "dox"))] use Credential; use ffi; -use glib; #[cfg(any(feature = "v2_2", feature = "dox"))] -use glib::object::Downcast; +use glib::GString; +#[cfg(any(feature = "v2_2", feature = "dox"))] +use glib::object::Cast; use glib::object::IsA; #[cfg(any(feature = "v2_2", feature = "dox"))] use glib::signal::SignalHandlerId; #[cfg(any(feature = "v2_2", feature = "dox"))] -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; +#[cfg(any(feature = "v2_2", feature = "dox"))] use glib_ffi; -use gobject_ffi; #[cfg(any(feature = "v2_2", feature = "dox"))] use std::boxed::Box as Box_; -use std::mem; +use std::fmt; #[cfg(any(feature = "v2_2", feature = "dox"))] use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct AuthenticationRequest(Object); + pub struct AuthenticationRequest(Object); match fn { get_type => || ffi::webkit_authentication_request_get_type(), } } -pub trait AuthenticationRequestExt { +pub const NONE_AUTHENTICATION_REQUEST: Option<&AuthenticationRequest> = None; + +pub trait AuthenticationRequestExt: 'static { #[cfg(any(feature = "v2_2", feature = "dox"))] fn can_save_credentials(&self) -> bool; @@ -41,7 +43,7 @@ pub trait AuthenticationRequestExt { fn cancel(&self); #[cfg(any(feature = "v2_2", feature = "dox"))] - fn get_host(&self) -> Option; + fn get_host(&self) -> Option; #[cfg(any(feature = "v2_2", feature = "dox"))] fn get_port(&self) -> u32; @@ -50,7 +52,7 @@ pub trait AuthenticationRequestExt { fn get_proposed_credential(&self) -> Option; #[cfg(any(feature = "v2_2", feature = "dox"))] - fn get_realm(&self) -> Option; + fn get_realm(&self) -> Option; #[cfg(any(feature = "v2_2", feature = "dox"))] fn get_scheme(&self) -> AuthenticationScheme; @@ -65,67 +67,67 @@ pub trait AuthenticationRequestExt { fn connect_cancelled(&self, f: F) -> SignalHandlerId; } -impl + IsA> AuthenticationRequestExt for O { +impl> AuthenticationRequestExt for O { #[cfg(any(feature = "v2_2", feature = "dox"))] fn can_save_credentials(&self) -> bool { unsafe { - from_glib(ffi::webkit_authentication_request_can_save_credentials(self.to_glib_none().0)) + from_glib(ffi::webkit_authentication_request_can_save_credentials(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn cancel(&self) { unsafe { - ffi::webkit_authentication_request_cancel(self.to_glib_none().0); + ffi::webkit_authentication_request_cancel(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_2", feature = "dox"))] - fn get_host(&self) -> Option { + fn get_host(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_authentication_request_get_host(self.to_glib_none().0)) + from_glib_none(ffi::webkit_authentication_request_get_host(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn get_port(&self) -> u32 { unsafe { - ffi::webkit_authentication_request_get_port(self.to_glib_none().0) + ffi::webkit_authentication_request_get_port(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn get_proposed_credential(&self) -> Option { unsafe { - from_glib_full(ffi::webkit_authentication_request_get_proposed_credential(self.to_glib_none().0)) + from_glib_full(ffi::webkit_authentication_request_get_proposed_credential(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] - fn get_realm(&self) -> Option { + fn get_realm(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_authentication_request_get_realm(self.to_glib_none().0)) + from_glib_none(ffi::webkit_authentication_request_get_realm(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn get_scheme(&self) -> AuthenticationScheme { unsafe { - from_glib(ffi::webkit_authentication_request_get_scheme(self.to_glib_none().0)) + from_glib(ffi::webkit_authentication_request_get_scheme(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn is_for_proxy(&self) -> bool { unsafe { - from_glib(ffi::webkit_authentication_request_is_for_proxy(self.to_glib_none().0)) + from_glib(ffi::webkit_authentication_request_is_for_proxy(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn is_retry(&self) -> bool { unsafe { - from_glib(ffi::webkit_authentication_request_is_retry(self.to_glib_none().0)) + from_glib(ffi::webkit_authentication_request_is_retry(self.as_ref().to_glib_none().0)) } } @@ -133,7 +135,7 @@ impl + IsA> AuthenticationRe fn connect_cancelled(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "cancelled", + 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 _) } } @@ -143,5 +145,11 @@ impl + IsA> AuthenticationRe unsafe extern "C" fn cancelled_trampoline

(this: *mut ffi::WebKitAuthenticationRequest, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&AuthenticationRequest::from_glib_borrow(this).downcast_unchecked()) + f(&AuthenticationRequest::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for AuthenticationRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "AuthenticationRequest") + } } diff --git a/src/auto/back_forward_list.rs b/src/auto/back_forward_list.rs index 8aea25ae..29d4721f 100644 --- a/src/auto/back_forward_list.rs +++ b/src/auto/back_forward_list.rs @@ -6,20 +6,19 @@ use BackForwardListItem; use ffi; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct BackForwardList(Object); + pub struct BackForwardList(Object); match fn { get_type => || ffi::webkit_back_forward_list_get_type(), } } -pub trait BackForwardListExt { +pub const NONE_BACK_FORWARD_LIST: Option<&BackForwardList> = None; + +pub trait BackForwardListExt: 'static { fn get_back_item(&self) -> Option; fn get_back_list(&self) -> Vec; @@ -44,55 +43,55 @@ pub trait BackForwardListExt { impl> BackForwardListExt for O { fn get_back_item(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_back_forward_list_get_back_item(self.to_glib_none().0)) + from_glib_none(ffi::webkit_back_forward_list_get_back_item(self.as_ref().to_glib_none().0)) } } fn get_back_list(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_back_list(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_back_list(self.as_ref().to_glib_none().0)) } } fn get_back_list_with_limit(&self, limit: u32) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_back_list_with_limit(self.to_glib_none().0, limit)) + FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_back_list_with_limit(self.as_ref().to_glib_none().0, limit)) } } fn get_current_item(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_back_forward_list_get_current_item(self.to_glib_none().0)) + from_glib_none(ffi::webkit_back_forward_list_get_current_item(self.as_ref().to_glib_none().0)) } } fn get_forward_item(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_back_forward_list_get_forward_item(self.to_glib_none().0)) + from_glib_none(ffi::webkit_back_forward_list_get_forward_item(self.as_ref().to_glib_none().0)) } } fn get_forward_list(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_forward_list(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_forward_list(self.as_ref().to_glib_none().0)) } } fn get_forward_list_with_limit(&self, limit: u32) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_forward_list_with_limit(self.to_glib_none().0, limit)) + FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_forward_list_with_limit(self.as_ref().to_glib_none().0, limit)) } } fn get_length(&self) -> u32 { unsafe { - ffi::webkit_back_forward_list_get_length(self.to_glib_none().0) + ffi::webkit_back_forward_list_get_length(self.as_ref().to_glib_none().0) } } fn get_nth_item(&self, index: i32) -> Option { unsafe { - from_glib_none(ffi::webkit_back_forward_list_get_nth_item(self.to_glib_none().0, index)) + from_glib_none(ffi::webkit_back_forward_list_get_nth_item(self.as_ref().to_glib_none().0, index)) } } @@ -100,3 +99,9 @@ impl> BackForwardListExt for O { // Unimplemented items_removed: *.Pointer //} } + +impl fmt::Display for BackForwardList { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "BackForwardList") + } +} diff --git a/src/auto/back_forward_list_item.rs b/src/auto/back_forward_list_item.rs index ef33f27c..e54ee85b 100644 --- a/src/auto/back_forward_list_item.rs +++ b/src/auto/back_forward_list_item.rs @@ -3,45 +3,51 @@ // DO NOT EDIT use ffi; +use glib::GString; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct BackForwardListItem(Object); + pub struct BackForwardListItem(Object); match fn { get_type => || ffi::webkit_back_forward_list_item_get_type(), } } -pub trait BackForwardListItemExt { - fn get_original_uri(&self) -> Option; +pub const NONE_BACK_FORWARD_LIST_ITEM: Option<&BackForwardListItem> = None; - fn get_title(&self) -> Option; +pub trait BackForwardListItemExt: 'static { + fn get_original_uri(&self) -> Option; - fn get_uri(&self) -> Option; + fn get_title(&self) -> Option; + + fn get_uri(&self) -> Option; } impl> BackForwardListItemExt for O { - fn get_original_uri(&self) -> Option { + fn get_original_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_back_forward_list_item_get_original_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_back_forward_list_item_get_original_uri(self.as_ref().to_glib_none().0)) } } - fn get_title(&self) -> Option { + fn get_title(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_back_forward_list_item_get_title(self.to_glib_none().0)) + from_glib_none(ffi::webkit_back_forward_list_item_get_title(self.as_ref().to_glib_none().0)) } } - fn get_uri(&self) -> Option { + fn get_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_back_forward_list_item_get_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_back_forward_list_item_get_uri(self.as_ref().to_glib_none().0)) } } } + +impl fmt::Display for BackForwardListItem { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "BackForwardListItem") + } +} diff --git a/src/auto/color_chooser_request.rs b/src/auto/color_chooser_request.rs index 96f8d694..96a9f5e2 100644 --- a/src/auto/color_chooser_request.rs +++ b/src/auto/color_chooser_request.rs @@ -4,30 +4,30 @@ use ffi; use gdk; -use glib; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct ColorChooserRequest(Object); + pub struct ColorChooserRequest(Object); match fn { get_type => || ffi::webkit_color_chooser_request_get_type(), } } -pub trait ColorChooserRequestExt { +pub const NONE_COLOR_CHOOSER_REQUEST: Option<&ColorChooserRequest> = None; + +pub trait ColorChooserRequestExt: 'static { #[cfg(any(feature = "v2_8", feature = "dox"))] fn cancel(&self); @@ -53,18 +53,18 @@ pub trait ColorChooserRequestExt { fn connect_property_rgba_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> ColorChooserRequestExt for O { +impl> ColorChooserRequestExt for O { #[cfg(any(feature = "v2_8", feature = "dox"))] fn cancel(&self) { unsafe { - ffi::webkit_color_chooser_request_cancel(self.to_glib_none().0); + ffi::webkit_color_chooser_request_cancel(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn finish(&self) { unsafe { - ffi::webkit_color_chooser_request_finish(self.to_glib_none().0); + ffi::webkit_color_chooser_request_finish(self.as_ref().to_glib_none().0); } } @@ -72,7 +72,7 @@ impl + IsA> ColorChooserReques fn get_element_rectangle(&self) -> gdk::Rectangle { unsafe { let mut rect = gdk::Rectangle::uninitialized(); - ffi::webkit_color_chooser_request_get_element_rectangle(self.to_glib_none().0, rect.to_glib_none_mut().0); + ffi::webkit_color_chooser_request_get_element_rectangle(self.as_ref().to_glib_none().0, rect.to_glib_none_mut().0); rect } } @@ -81,7 +81,7 @@ impl + IsA> ColorChooserReques fn get_rgba(&self) -> gdk::RGBA { unsafe { let mut rgba = gdk::RGBA::uninitialized(); - ffi::webkit_color_chooser_request_get_rgba(self.to_glib_none().0, rgba.to_glib_none_mut().0); + ffi::webkit_color_chooser_request_get_rgba(self.as_ref().to_glib_none().0, rgba.to_glib_none_mut().0); rgba } } @@ -89,21 +89,21 @@ impl + IsA> ColorChooserReques #[cfg(any(feature = "v2_8", feature = "dox"))] fn set_rgba(&self, rgba: &gdk::RGBA) { unsafe { - ffi::webkit_color_chooser_request_set_rgba(self.to_glib_none().0, rgba.to_glib_none().0); + ffi::webkit_color_chooser_request_set_rgba(self.as_ref().to_glib_none().0, rgba.to_glib_none().0); } } fn get_property_rgba(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "rgba".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"rgba\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } fn set_property_rgba(&self, rgba: Option<&gdk::RGBA>) { unsafe { - gobject_ffi::g_object_set_property(self.to_glib_none().0, "rgba".to_glib_none().0, Value::from(rgba).to_glib_none().0); + gobject_ffi::g_object_set_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"rgba\0".as_ptr() as *const _, Value::from(rgba).to_glib_none().0); } } @@ -111,7 +111,7 @@ impl + IsA> ColorChooserReques fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "finished", + 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 _) } } @@ -119,7 +119,7 @@ impl + IsA> ColorChooserReques fn connect_property_rgba_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::rgba", + 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 _) } } @@ -129,11 +129,17 @@ impl + IsA> ColorChooserReques unsafe extern "C" fn finished_trampoline

(this: *mut ffi::WebKitColorChooserRequest, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&ColorChooserRequest::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&ColorChooserRequest::from_glib_borrow(this).downcast_unchecked()) + f(&ColorChooserRequest::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for ColorChooserRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ColorChooserRequest") + } } diff --git a/src/auto/context_menu.rs b/src/auto/context_menu.rs index 873f0f97..df90dd3a 100644 --- a/src/auto/context_menu.rs +++ b/src/auto/context_menu.rs @@ -8,13 +8,10 @@ use ffi; use glib; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct ContextMenu(Object); + pub struct ContextMenu(Object); match fn { get_type => || ffi::webkit_context_menu_get_type(), @@ -43,8 +40,10 @@ impl Default for ContextMenu { } } -pub trait ContextMenuExt { - fn append(&self, item: &ContextMenuItem); +pub const NONE_CONTEXT_MENU: Option<&ContextMenu> = None; + +pub trait ContextMenuExt: 'static { + fn append>(&self, item: &P); fn first(&self) -> Option; @@ -57,15 +56,15 @@ pub trait ContextMenuExt { #[cfg(any(feature = "v2_8", feature = "dox"))] fn get_user_data(&self) -> Option; - fn insert(&self, item: &ContextMenuItem, position: i32); + fn insert>(&self, item: &P, position: i32); fn last(&self) -> Option; - fn move_item(&self, item: &ContextMenuItem, position: i32); + fn move_item>(&self, item: &P, position: i32); - fn prepend(&self, item: &ContextMenuItem); + fn prepend>(&self, item: &P); - fn remove(&self, item: &ContextMenuItem); + fn remove>(&self, item: &P); fn remove_all(&self); @@ -74,83 +73,89 @@ pub trait ContextMenuExt { } impl> ContextMenuExt for O { - fn append(&self, item: &ContextMenuItem) { + fn append>(&self, item: &P) { unsafe { - ffi::webkit_context_menu_append(self.to_glib_none().0, item.to_glib_none().0); + ffi::webkit_context_menu_append(self.as_ref().to_glib_none().0, item.as_ref().to_glib_none().0); } } fn first(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_context_menu_first(self.to_glib_none().0)) + from_glib_none(ffi::webkit_context_menu_first(self.as_ref().to_glib_none().0)) } } fn get_item_at_position(&self, position: u32) -> Option { unsafe { - from_glib_none(ffi::webkit_context_menu_get_item_at_position(self.to_glib_none().0, position)) + from_glib_none(ffi::webkit_context_menu_get_item_at_position(self.as_ref().to_glib_none().0, position)) } } fn get_items(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::webkit_context_menu_get_items(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::webkit_context_menu_get_items(self.as_ref().to_glib_none().0)) } } fn get_n_items(&self) -> u32 { unsafe { - ffi::webkit_context_menu_get_n_items(self.to_glib_none().0) + ffi::webkit_context_menu_get_n_items(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn get_user_data(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_context_menu_get_user_data(self.to_glib_none().0)) + from_glib_none(ffi::webkit_context_menu_get_user_data(self.as_ref().to_glib_none().0)) } } - fn insert(&self, item: &ContextMenuItem, position: i32) { + fn insert>(&self, item: &P, position: i32) { unsafe { - ffi::webkit_context_menu_insert(self.to_glib_none().0, item.to_glib_none().0, position); + ffi::webkit_context_menu_insert(self.as_ref().to_glib_none().0, item.as_ref().to_glib_none().0, position); } } fn last(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_context_menu_last(self.to_glib_none().0)) + from_glib_none(ffi::webkit_context_menu_last(self.as_ref().to_glib_none().0)) } } - fn move_item(&self, item: &ContextMenuItem, position: i32) { + fn move_item>(&self, item: &P, position: i32) { unsafe { - ffi::webkit_context_menu_move_item(self.to_glib_none().0, item.to_glib_none().0, position); + ffi::webkit_context_menu_move_item(self.as_ref().to_glib_none().0, item.as_ref().to_glib_none().0, position); } } - fn prepend(&self, item: &ContextMenuItem) { + fn prepend>(&self, item: &P) { unsafe { - ffi::webkit_context_menu_prepend(self.to_glib_none().0, item.to_glib_none().0); + ffi::webkit_context_menu_prepend(self.as_ref().to_glib_none().0, item.as_ref().to_glib_none().0); } } - fn remove(&self, item: &ContextMenuItem) { + fn remove>(&self, item: &P) { unsafe { - ffi::webkit_context_menu_remove(self.to_glib_none().0, item.to_glib_none().0); + ffi::webkit_context_menu_remove(self.as_ref().to_glib_none().0, item.as_ref().to_glib_none().0); } } fn remove_all(&self) { unsafe { - ffi::webkit_context_menu_remove_all(self.to_glib_none().0); + ffi::webkit_context_menu_remove_all(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn set_user_data(&self, user_data: &glib::Variant) { unsafe { - ffi::webkit_context_menu_set_user_data(self.to_glib_none().0, user_data.to_glib_none().0); + ffi::webkit_context_menu_set_user_data(self.as_ref().to_glib_none().0, user_data.to_glib_none().0); } } } + +impl fmt::Display for ContextMenu { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ContextMenu") + } +} diff --git a/src/auto/context_menu_item.rs b/src/auto/context_menu_item.rs index 1a04ef7a..a8ddeb93 100644 --- a/src/auto/context_menu_item.rs +++ b/src/auto/context_menu_item.rs @@ -7,13 +7,10 @@ use ContextMenuAction; use ffi; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct ContextMenuItem(Object); + pub struct ContextMenuItem(Object); match fn { get_type => || ffi::webkit_context_menu_item_get_type(), @@ -52,15 +49,17 @@ impl ContextMenuItem { } } - pub fn new_with_submenu(label: &str, submenu: &ContextMenu) -> ContextMenuItem { + pub fn new_with_submenu>(label: &str, submenu: &P) -> ContextMenuItem { skip_assert_initialized!(); unsafe { - from_glib_none(ffi::webkit_context_menu_item_new_with_submenu(label.to_glib_none().0, submenu.to_glib_none().0)) + from_glib_none(ffi::webkit_context_menu_item_new_with_submenu(label.to_glib_none().0, submenu.as_ref().to_glib_none().0)) } } } -pub trait ContextMenuItemExt { +pub const NONE_CONTEXT_MENU_ITEM: Option<&ContextMenuItem> = None; + +pub trait ContextMenuItemExt: 'static { //#[cfg_attr(feature = "v2_18", deprecated)] //fn get_action(&self) -> /*Ignored*/Option; @@ -73,7 +72,7 @@ pub trait ContextMenuItemExt { fn is_separator(&self) -> bool; - fn set_submenu<'a, P: Into>>(&self, submenu: P); + fn set_submenu<'a, P: IsA + 'a, Q: Into>>(&self, submenu: Q); } impl> ContextMenuItemExt for O { @@ -88,27 +87,32 @@ impl> ContextMenuItemExt for O { fn get_stock_action(&self) -> ContextMenuAction { unsafe { - from_glib(ffi::webkit_context_menu_item_get_stock_action(self.to_glib_none().0)) + from_glib(ffi::webkit_context_menu_item_get_stock_action(self.as_ref().to_glib_none().0)) } } fn get_submenu(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_context_menu_item_get_submenu(self.to_glib_none().0)) + from_glib_none(ffi::webkit_context_menu_item_get_submenu(self.as_ref().to_glib_none().0)) } } fn is_separator(&self) -> bool { unsafe { - from_glib(ffi::webkit_context_menu_item_is_separator(self.to_glib_none().0)) + from_glib(ffi::webkit_context_menu_item_is_separator(self.as_ref().to_glib_none().0)) } } - fn set_submenu<'a, P: Into>>(&self, submenu: P) { + fn set_submenu<'a, P: IsA + 'a, Q: Into>>(&self, submenu: Q) { let submenu = submenu.into(); - let submenu = submenu.to_glib_none(); unsafe { - ffi::webkit_context_menu_item_set_submenu(self.to_glib_none().0, submenu.0); + ffi::webkit_context_menu_item_set_submenu(self.as_ref().to_glib_none().0, submenu.map(|p| p.as_ref()).to_glib_none().0); } } } + +impl fmt::Display for ContextMenuItem { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ContextMenuItem") + } +} diff --git a/src/auto/cookie_manager.rs b/src/auto/cookie_manager.rs index f0810175..0ff2d207 100644 --- a/src/auto/cookie_manager.rs +++ b/src/auto/cookie_manager.rs @@ -10,66 +10,68 @@ use ffi; use futures_core; use gio; use gio_ffi; -use glib; -use glib::object::Downcast; +use glib::GString; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct CookieManager(Object); + pub struct CookieManager(Object); match fn { get_type => || ffi::webkit_cookie_manager_get_type(), } } -pub trait CookieManagerExt: Sized { +pub const NONE_COOKIE_MANAGER: Option<&CookieManager> = None; + +pub trait CookieManagerExt: 'static { //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn add_cookie<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: P, callback: Q); + //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); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn add_cookie_future(&self, cookie: /*Ignored*/&mut soup::Cookie) -> Box_>; + //fn add_cookie_future(&self, cookie: /*Ignored*/&mut soup::Cookie) -> Box_> where Self: Sized + Clone; #[cfg_attr(feature = "v2_16", deprecated)] fn delete_all_cookies(&self); //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn delete_cookie<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: P, callback: Q); + //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); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn delete_cookie_future(&self, cookie: /*Ignored*/&mut soup::Cookie) -> Box_>; + //fn delete_cookie_future(&self, cookie: /*Ignored*/&mut soup::Cookie) -> Box_> where Self: Sized + Clone; #[cfg_attr(feature = "v2_16", deprecated)] fn delete_cookies_for_domain(&self, domain: &str); - fn get_accept_policy<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, cancellable: P, callback: Q); + fn get_accept_policy<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, cancellable: Q, callback: R); #[cfg(feature = "futures")] - fn get_accept_policy_future(&self) -> Box_>; + fn get_accept_policy_future(&self) -> Box_> where Self: Sized + Clone; //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn get_cookies<'a, P: Into>, Q: FnOnce(Result, Error>) + Send + 'static>(&self, uri: &str, cancellable: P, callback: Q); + //fn get_cookies<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, uri: &str, cancellable: Q, callback: R); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn get_cookies_future(&self, uri: &str) -> Box_), Error = (Self, Error)>>; + //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: Into>, Q: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: P, callback: Q); + fn get_domains_with_cookies<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Q, callback: R); #[cfg_attr(feature = "v2_16", deprecated)] #[cfg(feature = "futures")] - fn get_domains_with_cookies_future(&self) -> Box_), Error = (Self, Error)>>; + fn get_domains_with_cookies_future(&self) -> Box_), Error = (Self, Error)>> where Self: Sized + Clone; fn set_accept_policy(&self, policy: CookieAcceptPolicy); @@ -78,15 +80,15 @@ pub trait CookieManagerExt: Sized { fn connect_changed(&self, f: F) -> SignalHandlerId; } -impl + IsA + Clone + 'static> CookieManagerExt for O { +impl> CookieManagerExt for O { //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn add_cookie<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: P, callback: Q) { + //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) { // unsafe { TODO: call ffi::webkit_cookie_manager_add_cookie() } //} //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn add_cookie_future(&self, cookie: /*Ignored*/&mut soup::Cookie) -> Box_> { + //fn add_cookie_future(&self, cookie: /*Ignored*/&mut soup::Cookie) -> Box_> where Self: Sized + Clone { //use gio::GioFuture; //use fragile::Fragile; @@ -111,18 +113,18 @@ impl + IsA + Clone + 'static> Cookie fn delete_all_cookies(&self) { unsafe { - ffi::webkit_cookie_manager_delete_all_cookies(self.to_glib_none().0); + ffi::webkit_cookie_manager_delete_all_cookies(self.as_ref().to_glib_none().0); } } //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn delete_cookie<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: P, callback: Q) { + //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) { // unsafe { TODO: call ffi::webkit_cookie_manager_delete_cookie() } //} //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn delete_cookie_future(&self, cookie: /*Ignored*/&mut soup::Cookie) -> Box_> { + //fn delete_cookie_future(&self, cookie: /*Ignored*/&mut soup::Cookie) -> Box_> where Self: Sized + Clone { //use gio::GioFuture; //use fragile::Fragile; @@ -147,30 +149,29 @@ impl + IsA + Clone + 'static> Cookie fn delete_cookies_for_domain(&self, domain: &str) { unsafe { - ffi::webkit_cookie_manager_delete_cookies_for_domain(self.to_glib_none().0, domain.to_glib_none().0); + ffi::webkit_cookie_manager_delete_cookies_for_domain(self.as_ref().to_glib_none().0, domain.to_glib_none().0); } } - fn get_accept_policy<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, cancellable: P, callback: Q) { + 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 cancellable = cancellable.to_glib_none(); - 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) + 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) { 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.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + 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 _); } } #[cfg(feature = "futures")] - fn get_accept_policy_future(&self) -> Box_> { + fn get_accept_policy_future(&self) -> Box_> where Self: Sized + Clone { use gio::GioFuture; use fragile::Fragile; @@ -192,13 +193,13 @@ impl + IsA + Clone + 'static> Cookie } //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn get_cookies<'a, P: Into>, Q: FnOnce(Result, Error>) + Send + 'static>(&self, uri: &str, cancellable: P, callback: Q) { + //fn get_cookies<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, uri: &str, cancellable: Q, callback: R) { // unsafe { TODO: call ffi::webkit_cookie_manager_get_cookies() } //} //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_20", feature = "dox"))] - //fn get_cookies_future(&self, uri: &str) -> Box_), Error = (Self, Error)>> { + //fn get_cookies_future(&self, uri: &str) -> Box_), Error = (Self, Error)>> where Self: Sized + Clone { //use gio::GioFuture; //use fragile::Fragile; @@ -221,26 +222,25 @@ impl + IsA + Clone + 'static> Cookie //}) //} - fn get_domains_with_cookies<'a, P: Into>, Q: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: P, callback: Q) { + 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 cancellable = cancellable.to_glib_none(); - 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) + 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) { 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.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + 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 _); } } #[cfg(feature = "futures")] - fn get_domains_with_cookies_future(&self) -> Box_), Error = (Self, Error)>> { + fn get_domains_with_cookies_future(&self) -> Box_), Error = (Self, Error)>> where Self: Sized + Clone { use gio::GioFuture; use fragile::Fragile; @@ -263,20 +263,20 @@ impl + IsA + Clone + 'static> Cookie fn set_accept_policy(&self, policy: CookieAcceptPolicy) { unsafe { - ffi::webkit_cookie_manager_set_accept_policy(self.to_glib_none().0, policy.to_glib()); + ffi::webkit_cookie_manager_set_accept_policy(self.as_ref().to_glib_none().0, policy.to_glib()); } } fn set_persistent_storage(&self, filename: &str, storage: CookiePersistentStorage) { unsafe { - ffi::webkit_cookie_manager_set_persistent_storage(self.to_glib_none().0, filename.to_glib_none().0, storage.to_glib()); + ffi::webkit_cookie_manager_set_persistent_storage(self.as_ref().to_glib_none().0, filename.to_glib_none().0, storage.to_glib()); } } fn connect_changed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "changed", + 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 _) } } @@ -285,5 +285,11 @@ impl + IsA + Clone + 'static> Cookie unsafe extern "C" fn changed_trampoline

(this: *mut ffi::WebKitCookieManager, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&CookieManager::from_glib_borrow(this).downcast_unchecked()) + f(&CookieManager::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for CookieManager { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "CookieManager") + } } diff --git a/src/auto/credential.rs b/src/auto/credential.rs index cb2dc837..e1ad38a7 100644 --- a/src/auto/credential.rs +++ b/src/auto/credential.rs @@ -5,11 +5,10 @@ #[cfg(any(feature = "v2_2", feature = "dox"))] use CredentialPersistence; use ffi; +#[cfg(any(feature = "v2_2", feature = "dox"))] +use glib::GString; +#[cfg(any(feature = "v2_2", feature = "dox"))] use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -32,7 +31,7 @@ impl Credential { } #[cfg(any(feature = "v2_2", feature = "dox"))] - pub fn get_password(&mut self) -> Option { + pub fn get_password(&mut self) -> Option { unsafe { from_glib_none(ffi::webkit_credential_get_password(self.to_glib_none_mut().0)) } @@ -46,7 +45,7 @@ impl Credential { } #[cfg(any(feature = "v2_2", feature = "dox"))] - pub fn get_username(&mut self) -> Option { + pub fn get_username(&mut self) -> Option { unsafe { from_glib_none(ffi::webkit_credential_get_username(self.to_glib_none_mut().0)) } diff --git a/src/auto/download.rs b/src/auto/download.rs index 2bcd77aa..adc9e676 100644 --- a/src/auto/download.rs +++ b/src/auto/download.rs @@ -7,35 +7,35 @@ use URIRequest; use URIResponse; use WebView; use ffi; -use glib; -use glib::object::Downcast; +use glib::GString; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; -use gobject_ffi; use libc; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct Download(Object); + pub struct Download(Object); match fn { get_type => || ffi::webkit_download_get_type(), } } -pub trait DownloadExt { +pub const NONE_DOWNLOAD: Option<&Download> = None; + +pub trait DownloadExt: 'static { fn cancel(&self); #[cfg(any(feature = "v2_6", feature = "dox"))] fn get_allow_overwrite(&self) -> bool; - fn get_destination(&self) -> Option; + fn get_destination(&self) -> Option; fn get_elapsed_time(&self) -> f64; @@ -74,79 +74,79 @@ pub trait DownloadExt { fn connect_property_response_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> DownloadExt for O { +impl> DownloadExt for O { fn cancel(&self) { unsafe { - ffi::webkit_download_cancel(self.to_glib_none().0); + ffi::webkit_download_cancel(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn get_allow_overwrite(&self) -> bool { unsafe { - from_glib(ffi::webkit_download_get_allow_overwrite(self.to_glib_none().0)) + from_glib(ffi::webkit_download_get_allow_overwrite(self.as_ref().to_glib_none().0)) } } - fn get_destination(&self) -> Option { + fn get_destination(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_download_get_destination(self.to_glib_none().0)) + from_glib_none(ffi::webkit_download_get_destination(self.as_ref().to_glib_none().0)) } } fn get_elapsed_time(&self) -> f64 { unsafe { - ffi::webkit_download_get_elapsed_time(self.to_glib_none().0) + ffi::webkit_download_get_elapsed_time(self.as_ref().to_glib_none().0) } } fn get_estimated_progress(&self) -> f64 { unsafe { - ffi::webkit_download_get_estimated_progress(self.to_glib_none().0) + ffi::webkit_download_get_estimated_progress(self.as_ref().to_glib_none().0) } } fn get_received_data_length(&self) -> u64 { unsafe { - ffi::webkit_download_get_received_data_length(self.to_glib_none().0) + ffi::webkit_download_get_received_data_length(self.as_ref().to_glib_none().0) } } fn get_request(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_download_get_request(self.to_glib_none().0)) + from_glib_none(ffi::webkit_download_get_request(self.as_ref().to_glib_none().0)) } } fn get_response(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_download_get_response(self.to_glib_none().0)) + from_glib_none(ffi::webkit_download_get_response(self.as_ref().to_glib_none().0)) } } fn get_web_view(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_download_get_web_view(self.to_glib_none().0)) + from_glib_none(ffi::webkit_download_get_web_view(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn set_allow_overwrite(&self, allowed: bool) { unsafe { - ffi::webkit_download_set_allow_overwrite(self.to_glib_none().0, allowed.to_glib()); + ffi::webkit_download_set_allow_overwrite(self.as_ref().to_glib_none().0, allowed.to_glib()); } } fn set_destination(&self, uri: &str) { unsafe { - ffi::webkit_download_set_destination(self.to_glib_none().0, uri.to_glib_none().0); + ffi::webkit_download_set_destination(self.as_ref().to_glib_none().0, uri.to_glib_none().0); } } fn connect_created_destination(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "created-destination", + 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 _) } } @@ -154,7 +154,7 @@ impl + IsA> DownloadExt for O { fn connect_decide_destination bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "decide-destination", + 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 _) } } @@ -162,7 +162,7 @@ impl + IsA> DownloadExt for O { fn connect_failed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "failed", + 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 _) } } @@ -170,7 +170,7 @@ impl + IsA> DownloadExt for O { fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "finished", + 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 _) } } @@ -178,7 +178,7 @@ impl + IsA> DownloadExt for O { fn connect_received_data(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "received-data", + 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 _) } } @@ -187,7 +187,7 @@ impl + IsA> DownloadExt for O { fn connect_property_allow_overwrite_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::allow-overwrite", + 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 _) } } @@ -195,7 +195,7 @@ impl + IsA> DownloadExt for O { fn connect_property_destination_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::destination", + 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 _) } } @@ -203,7 +203,7 @@ impl + IsA> DownloadExt for O { fn connect_property_estimated_progress_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::estimated-progress", + 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 _) } } @@ -211,7 +211,7 @@ impl + IsA> DownloadExt for O { fn connect_property_response_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::response", + 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 _) } } @@ -220,54 +220,60 @@ impl + IsA> DownloadExt for O { 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); - f(&Download::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(destination)) + 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 where P: IsA { let f: &&(Fn(&P, &str) -> bool + 'static) = transmute(f); - f(&Download::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(suggested_filename)).to_glib() + 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) where P: IsA { let f: &&(Fn(&P, &Error) + 'static) = transmute(f); - f(&Download::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(error)) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Download::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P, u64) + 'static) = transmute(f); - f(&Download::from_glib_borrow(this).downcast_unchecked(), data_length) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Download::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Download::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Download::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Download::from_glib_borrow(this).downcast_unchecked()) + f(&Download::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for Download { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Download") + } } diff --git a/src/auto/editor_state.rs b/src/auto/editor_state.rs index 3c1a96c6..4683645a 100644 --- a/src/auto/editor_state.rs +++ b/src/auto/editor_state.rs @@ -3,33 +3,33 @@ // DO NOT EDIT use ffi; -use glib; #[cfg(any(feature = "v2_10", feature = "dox"))] -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; #[cfg(any(feature = "v2_10", feature = "dox"))] use glib::signal::SignalHandlerId; #[cfg(any(feature = "v2_10", feature = "dox"))] -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; +#[cfg(any(feature = "v2_10", feature = "dox"))] use glib_ffi; -use gobject_ffi; #[cfg(any(feature = "v2_10", feature = "dox"))] use std::boxed::Box as Box_; -use std::mem; +use std::fmt; #[cfg(any(feature = "v2_10", feature = "dox"))] use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct EditorState(Object); + pub struct EditorState(Object); match fn { get_type => || ffi::webkit_editor_state_get_type(), } } -pub trait EditorStateExt { +pub const NONE_EDITOR_STATE: Option<&EditorState> = None; + +pub trait EditorStateExt: 'static { #[cfg(any(feature = "v2_10", feature = "dox"))] fn get_typing_attributes(&self) -> u32; @@ -52,46 +52,46 @@ pub trait EditorStateExt { fn connect_property_typing_attributes_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> EditorStateExt for O { +impl> EditorStateExt for O { #[cfg(any(feature = "v2_10", feature = "dox"))] fn get_typing_attributes(&self) -> u32 { unsafe { - ffi::webkit_editor_state_get_typing_attributes(self.to_glib_none().0) + ffi::webkit_editor_state_get_typing_attributes(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v2_20", feature = "dox"))] fn is_copy_available(&self) -> bool { unsafe { - from_glib(ffi::webkit_editor_state_is_copy_available(self.to_glib_none().0)) + from_glib(ffi::webkit_editor_state_is_copy_available(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_20", feature = "dox"))] fn is_cut_available(&self) -> bool { unsafe { - from_glib(ffi::webkit_editor_state_is_cut_available(self.to_glib_none().0)) + from_glib(ffi::webkit_editor_state_is_cut_available(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_20", feature = "dox"))] fn is_paste_available(&self) -> bool { unsafe { - from_glib(ffi::webkit_editor_state_is_paste_available(self.to_glib_none().0)) + from_glib(ffi::webkit_editor_state_is_paste_available(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_20", feature = "dox"))] fn is_redo_available(&self) -> bool { unsafe { - from_glib(ffi::webkit_editor_state_is_redo_available(self.to_glib_none().0)) + from_glib(ffi::webkit_editor_state_is_redo_available(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_20", feature = "dox"))] fn is_undo_available(&self) -> bool { unsafe { - from_glib(ffi::webkit_editor_state_is_undo_available(self.to_glib_none().0)) + from_glib(ffi::webkit_editor_state_is_undo_available(self.as_ref().to_glib_none().0)) } } @@ -99,7 +99,7 @@ impl + IsA> EditorStateExt for O { fn connect_property_typing_attributes_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::typing-attributes", + 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 _) } } @@ -109,5 +109,11 @@ impl + IsA> EditorStateExt for O { 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); - f(&EditorState::from_glib_borrow(this).downcast_unchecked()) + f(&EditorState::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for EditorState { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "EditorState") + } } diff --git a/src/auto/enums.rs b/src/auto/enums.rs index b7bf66c8..b3804cb5 100644 --- a/src/auto/enums.rs +++ b/src/auto/enums.rs @@ -13,6 +13,7 @@ use glib::value::FromValueOptional; use glib::value::SetValue; use glib::value::Value; use gobject_ffi; +use std::fmt; #[cfg(any(feature = "v2_2", feature = "dox"))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] @@ -31,6 +32,24 @@ pub enum AuthenticationScheme { __Unknown(i32), } +#[cfg(any(feature = "v2_2", feature = "dox"))] +impl fmt::Display for AuthenticationScheme { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "AuthenticationScheme::{}", match *self { + AuthenticationScheme::Default => "Default", + AuthenticationScheme::HttpBasic => "HttpBasic", + AuthenticationScheme::HttpDigest => "HttpDigest", + AuthenticationScheme::HtmlForm => "HtmlForm", + AuthenticationScheme::Ntlm => "Ntlm", + AuthenticationScheme::Negotiate => "Negotiate", + AuthenticationScheme::ClientCertificateRequested => "ClientCertificateRequested", + AuthenticationScheme::ServerTrustEvaluationRequested => "ServerTrustEvaluationRequested", + AuthenticationScheme::Unknown => "Unknown", + _ => "Unknown", + }) + } +} + #[cfg(any(feature = "v2_2", feature = "dox"))] #[doc(hidden)] impl ToGlib for AuthenticationScheme { @@ -110,6 +129,17 @@ pub enum CacheModel { __Unknown(i32), } +impl fmt::Display for CacheModel { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "CacheModel::{}", match *self { + CacheModel::DocumentViewer => "DocumentViewer", + CacheModel::WebBrowser => "WebBrowser", + CacheModel::DocumentBrowser => "DocumentBrowser", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for CacheModel { type GlibType = ffi::WebKitCacheModel; @@ -213,6 +243,59 @@ pub enum ContextMenuAction { __Unknown(i32), } +impl fmt::Display for ContextMenuAction { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ContextMenuAction::{}", match *self { + ContextMenuAction::NoAction => "NoAction", + ContextMenuAction::OpenLink => "OpenLink", + ContextMenuAction::OpenLinkInNewWindow => "OpenLinkInNewWindow", + ContextMenuAction::DownloadLinkToDisk => "DownloadLinkToDisk", + ContextMenuAction::CopyLinkToClipboard => "CopyLinkToClipboard", + ContextMenuAction::OpenImageInNewWindow => "OpenImageInNewWindow", + ContextMenuAction::DownloadImageToDisk => "DownloadImageToDisk", + ContextMenuAction::CopyImageToClipboard => "CopyImageToClipboard", + ContextMenuAction::CopyImageUrlToClipboard => "CopyImageUrlToClipboard", + ContextMenuAction::OpenFrameInNewWindow => "OpenFrameInNewWindow", + ContextMenuAction::GoBack => "GoBack", + ContextMenuAction::GoForward => "GoForward", + ContextMenuAction::Stop => "Stop", + ContextMenuAction::Reload => "Reload", + ContextMenuAction::Copy => "Copy", + ContextMenuAction::Cut => "Cut", + ContextMenuAction::Paste => "Paste", + ContextMenuAction::Delete => "Delete", + ContextMenuAction::SelectAll => "SelectAll", + ContextMenuAction::InputMethods => "InputMethods", + ContextMenuAction::Unicode => "Unicode", + ContextMenuAction::SpellingGuess => "SpellingGuess", + ContextMenuAction::NoGuessesFound => "NoGuessesFound", + ContextMenuAction::IgnoreSpelling => "IgnoreSpelling", + ContextMenuAction::LearnSpelling => "LearnSpelling", + ContextMenuAction::IgnoreGrammar => "IgnoreGrammar", + ContextMenuAction::FontMenu => "FontMenu", + ContextMenuAction::Bold => "Bold", + ContextMenuAction::Italic => "Italic", + ContextMenuAction::Underline => "Underline", + ContextMenuAction::Outline => "Outline", + ContextMenuAction::InspectElement => "InspectElement", + ContextMenuAction::OpenVideoInNewWindow => "OpenVideoInNewWindow", + ContextMenuAction::OpenAudioInNewWindow => "OpenAudioInNewWindow", + ContextMenuAction::CopyVideoLinkToClipboard => "CopyVideoLinkToClipboard", + ContextMenuAction::CopyAudioLinkToClipboard => "CopyAudioLinkToClipboard", + ContextMenuAction::ToggleMediaControls => "ToggleMediaControls", + ContextMenuAction::ToggleMediaLoop => "ToggleMediaLoop", + ContextMenuAction::EnterVideoFullscreen => "EnterVideoFullscreen", + ContextMenuAction::MediaPlay => "MediaPlay", + ContextMenuAction::MediaPause => "MediaPause", + ContextMenuAction::MediaMute => "MediaMute", + ContextMenuAction::DownloadVideoToDisk => "DownloadVideoToDisk", + ContextMenuAction::DownloadAudioToDisk => "DownloadAudioToDisk", + ContextMenuAction::Custom => "Custom", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for ContextMenuAction { type GlibType = ffi::WebKitContextMenuAction; @@ -358,6 +441,17 @@ pub enum CookieAcceptPolicy { __Unknown(i32), } +impl fmt::Display for CookieAcceptPolicy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "CookieAcceptPolicy::{}", match *self { + CookieAcceptPolicy::Always => "Always", + CookieAcceptPolicy::Never => "Never", + CookieAcceptPolicy::NoThirdParty => "NoThirdParty", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for CookieAcceptPolicy { type GlibType = ffi::WebKitCookieAcceptPolicy; @@ -418,6 +512,16 @@ pub enum CookiePersistentStorage { __Unknown(i32), } +impl fmt::Display for CookiePersistentStorage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "CookiePersistentStorage::{}", match *self { + CookiePersistentStorage::Text => "Text", + CookiePersistentStorage::Sqlite => "Sqlite", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for CookiePersistentStorage { type GlibType = ffi::WebKitCookiePersistentStorage; @@ -478,6 +582,18 @@ pub enum CredentialPersistence { __Unknown(i32), } +#[cfg(any(feature = "v2_2", feature = "dox"))] +impl fmt::Display for CredentialPersistence { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "CredentialPersistence::{}", match *self { + CredentialPersistence::None => "None", + CredentialPersistence::ForSession => "ForSession", + CredentialPersistence::Permanent => "Permanent", + _ => "Unknown", + }) + } +} + #[cfg(any(feature = "v2_2", feature = "dox"))] #[doc(hidden)] impl ToGlib for CredentialPersistence { @@ -545,6 +661,17 @@ pub enum DownloadError { __Unknown(i32), } +impl fmt::Display for DownloadError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "DownloadError::{}", match *self { + DownloadError::Network => "Network", + DownloadError::CancelledByUser => "CancelledByUser", + DownloadError::Destination => "Destination", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for DownloadError { type GlibType = ffi::WebKitDownloadError; @@ -627,6 +754,17 @@ pub enum FaviconDatabaseError { __Unknown(i32), } +impl fmt::Display for FaviconDatabaseError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "FaviconDatabaseError::{}", match *self { + FaviconDatabaseError::NotInitialized => "NotInitialized", + FaviconDatabaseError::FaviconNotFound => "FaviconNotFound", + FaviconDatabaseError::FaviconUnknown => "FaviconUnknown", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for FaviconDatabaseError { type GlibType = ffi::WebKitFaviconDatabaseError; @@ -710,6 +848,18 @@ pub enum HardwareAccelerationPolicy { __Unknown(i32), } +#[cfg(any(feature = "v2_16", feature = "dox"))] +impl fmt::Display for HardwareAccelerationPolicy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "HardwareAccelerationPolicy::{}", match *self { + HardwareAccelerationPolicy::OnDemand => "OnDemand", + HardwareAccelerationPolicy::Always => "Always", + HardwareAccelerationPolicy::Never => "Never", + _ => "Unknown", + }) + } +} + #[cfg(any(feature = "v2_16", feature = "dox"))] #[doc(hidden)] impl ToGlib for HardwareAccelerationPolicy { @@ -776,6 +926,16 @@ pub enum InsecureContentEvent { __Unknown(i32), } +impl fmt::Display for InsecureContentEvent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "InsecureContentEvent::{}", match *self { + InsecureContentEvent::Run => "Run", + InsecureContentEvent::Displayed => "Displayed", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for InsecureContentEvent { type GlibType = ffi::WebKitInsecureContentEvent; @@ -833,6 +993,15 @@ pub enum JavascriptError { __Unknown(i32), } +impl fmt::Display for JavascriptError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "JavascriptError::{}", match *self { + JavascriptError::Failed => "Failed", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for JavascriptError { type GlibType = ffi::WebKitJavascriptError; @@ -910,6 +1079,18 @@ pub enum LoadEvent { __Unknown(i32), } +impl fmt::Display for LoadEvent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "LoadEvent::{}", match *self { + LoadEvent::Started => "Started", + LoadEvent::Redirected => "Redirected", + LoadEvent::Committed => "Committed", + LoadEvent::Finished => "Finished", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for LoadEvent { type GlibType = ffi::WebKitLoadEvent; @@ -976,6 +1157,20 @@ pub enum NavigationType { __Unknown(i32), } +impl fmt::Display for NavigationType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "NavigationType::{}", match *self { + NavigationType::LinkClicked => "LinkClicked", + NavigationType::FormSubmitted => "FormSubmitted", + NavigationType::BackForward => "BackForward", + NavigationType::Reload => "Reload", + NavigationType::FormResubmitted => "FormResubmitted", + NavigationType::Other => "Other", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for NavigationType { type GlibType = ffi::WebKitNavigationType; @@ -1045,6 +1240,19 @@ pub enum NetworkError { __Unknown(i32), } +impl fmt::Display for NetworkError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "NetworkError::{}", match *self { + NetworkError::Failed => "Failed", + NetworkError::Transport => "Transport", + NetworkError::UnknownProtocol => "UnknownProtocol", + NetworkError::Cancelled => "Cancelled", + NetworkError::FileDoesNotExist => "FileDoesNotExist", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for NetworkError { type GlibType = ffi::WebKitNetworkError; @@ -1134,6 +1342,18 @@ pub enum NetworkProxyMode { __Unknown(i32), } +#[cfg(any(feature = "v2_16", feature = "dox"))] +impl fmt::Display for NetworkProxyMode { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "NetworkProxyMode::{}", match *self { + NetworkProxyMode::Default => "Default", + NetworkProxyMode::NoProxy => "NoProxy", + NetworkProxyMode::Custom => "Custom", + _ => "Unknown", + }) + } +} + #[cfg(any(feature = "v2_16", feature = "dox"))] #[doc(hidden)] impl ToGlib for NetworkProxyMode { @@ -1204,6 +1424,20 @@ pub enum PluginError { __Unknown(i32), } +impl fmt::Display for PluginError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "PluginError::{}", match *self { + PluginError::Failed => "Failed", + PluginError::CannotFindPlugin => "CannotFindPlugin", + PluginError::CannotLoadPlugin => "CannotLoadPlugin", + PluginError::JavaUnavailable => "JavaUnavailable", + PluginError::ConnectionCancelled => "ConnectionCancelled", + PluginError::WillHandleLoad => "WillHandleLoad", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for PluginError { type GlibType = ffi::WebKitPluginError; @@ -1295,6 +1529,17 @@ pub enum PolicyDecisionType { __Unknown(i32), } +impl fmt::Display for PolicyDecisionType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "PolicyDecisionType::{}", match *self { + PolicyDecisionType::NavigationAction => "NavigationAction", + PolicyDecisionType::NewWindowAction => "NewWindowAction", + PolicyDecisionType::Response => "Response", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for PolicyDecisionType { type GlibType = ffi::WebKitPolicyDecisionType; @@ -1358,6 +1603,19 @@ pub enum PolicyError { __Unknown(i32), } +impl fmt::Display for PolicyError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "PolicyError::{}", match *self { + PolicyError::Failed => "Failed", + PolicyError::CannotShowMimeType => "CannotShowMimeType", + PolicyError::CannotShowUri => "CannotShowUri", + PolicyError::FrameLoadInterruptedByPolicyChange => "FrameLoadInterruptedByPolicyChange", + PolicyError::CannotUseRestrictedPort => "CannotUseRestrictedPort", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for PolicyError { type GlibType = ffi::WebKitPolicyError; @@ -1446,6 +1704,17 @@ pub enum PrintError { __Unknown(i32), } +impl fmt::Display for PrintError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "PrintError::{}", match *self { + PrintError::General => "General", + PrintError::PrinterNotFound => "PrinterNotFound", + PrintError::InvalidPageRange => "InvalidPageRange", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for PrintError { type GlibType = ffi::WebKitPrintError; @@ -1527,6 +1796,16 @@ pub enum PrintOperationResponse { __Unknown(i32), } +impl fmt::Display for PrintOperationResponse { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "PrintOperationResponse::{}", match *self { + PrintOperationResponse::Print => "Print", + PrintOperationResponse::Cancel => "Cancel", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for PrintOperationResponse { type GlibType = ffi::WebKitPrintOperationResponse; @@ -1586,6 +1865,17 @@ pub enum ProcessModel { __Unknown(i32), } +#[cfg(any(feature = "v2_4", feature = "dox"))] +impl fmt::Display for ProcessModel { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ProcessModel::{}", match *self { + ProcessModel::SharedSecondaryProcess => "SharedSecondaryProcess", + ProcessModel::MultipleSecondaryProcesses => "MultipleSecondaryProcesses", + _ => "Unknown", + }) + } +} + #[cfg(any(feature = "v2_4", feature = "dox"))] #[doc(hidden)] impl ToGlib for ProcessModel { @@ -1649,6 +1939,15 @@ pub enum SaveMode { __Unknown(i32), } +impl fmt::Display for SaveMode { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "SaveMode::{}", match *self { + SaveMode::Mhtml => "Mhtml", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for SaveMode { type GlibType = ffi::WebKitSaveMode; @@ -1707,6 +2006,18 @@ pub enum ScriptDialogType { __Unknown(i32), } +impl fmt::Display for ScriptDialogType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ScriptDialogType::{}", match *self { + ScriptDialogType::Alert => "Alert", + ScriptDialogType::Confirm => "Confirm", + ScriptDialogType::Prompt => "Prompt", + ScriptDialogType::BeforeUnloadConfirm => "BeforeUnloadConfirm", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for ScriptDialogType { type GlibType = ffi::WebKitScriptDialogType; @@ -1768,6 +2079,15 @@ pub enum SnapshotError { __Unknown(i32), } +impl fmt::Display for SnapshotError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "SnapshotError::{}", match *self { + SnapshotError::Create => "Create", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for SnapshotError { type GlibType = ffi::WebKitSnapshotError; @@ -1843,6 +2163,16 @@ pub enum SnapshotRegion { __Unknown(i32), } +impl fmt::Display for SnapshotRegion { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "SnapshotRegion::{}", match *self { + SnapshotRegion::Visible => "Visible", + SnapshotRegion::FullDocument => "FullDocument", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for SnapshotRegion { type GlibType = ffi::WebKitSnapshotRegion; @@ -1901,6 +2231,16 @@ pub enum TLSErrorsPolicy { __Unknown(i32), } +impl fmt::Display for TLSErrorsPolicy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "TLSErrorsPolicy::{}", match *self { + TLSErrorsPolicy::Ignore => "Ignore", + TLSErrorsPolicy::Fail => "Fail", + _ => "Unknown", + }) + } +} + #[doc(hidden)] impl ToGlib for TLSErrorsPolicy { type GlibType = ffi::WebKitTLSErrorsPolicy; @@ -1960,6 +2300,17 @@ pub enum UserContentInjectedFrames { __Unknown(i32), } +#[cfg(any(feature = "v2_6", feature = "dox"))] +impl fmt::Display for UserContentInjectedFrames { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "UserContentInjectedFrames::{}", match *self { + UserContentInjectedFrames::AllFrames => "AllFrames", + UserContentInjectedFrames::TopFrame => "TopFrame", + _ => "Unknown", + }) + } +} + #[cfg(any(feature = "v2_6", feature = "dox"))] #[doc(hidden)] impl ToGlib for UserContentInjectedFrames { @@ -2025,6 +2376,17 @@ pub enum UserScriptInjectionTime { __Unknown(i32), } +#[cfg(any(feature = "v2_6", feature = "dox"))] +impl fmt::Display for UserScriptInjectionTime { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "UserScriptInjectionTime::{}", match *self { + UserScriptInjectionTime::Start => "Start", + UserScriptInjectionTime::End => "End", + _ => "Unknown", + }) + } +} + #[cfg(any(feature = "v2_6", feature = "dox"))] #[doc(hidden)] impl ToGlib for UserScriptInjectionTime { @@ -2090,6 +2452,17 @@ pub enum UserStyleLevel { __Unknown(i32), } +#[cfg(any(feature = "v2_6", feature = "dox"))] +impl fmt::Display for UserStyleLevel { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "UserStyleLevel::{}", match *self { + UserStyleLevel::User => "User", + UserStyleLevel::Author => "Author", + _ => "Unknown", + }) + } +} + #[cfg(any(feature = "v2_6", feature = "dox"))] #[doc(hidden)] impl ToGlib for UserStyleLevel { diff --git a/src/auto/favicon_database.rs b/src/auto/favicon_database.rs index 88be473f..cfdb549a 100644 --- a/src/auto/favicon_database.rs +++ b/src/auto/favicon_database.rs @@ -9,68 +9,69 @@ use ffi; use futures_core; use gio; use gio_ffi; -use glib; -use glib::object::Downcast; +use glib::GString; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use libc; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct FaviconDatabase(Object); + pub struct FaviconDatabase(Object); match fn { get_type => || ffi::webkit_favicon_database_get_type(), } } -pub trait FaviconDatabaseExt: Sized { +pub const NONE_FAVICON_DATABASE: Option<&FaviconDatabase> = None; + +pub trait FaviconDatabaseExt: 'static { fn clear(&self); - fn get_favicon<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, page_uri: &str, cancellable: P, callback: Q); + fn get_favicon<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, page_uri: &str, cancellable: Q, callback: R); #[cfg(feature = "futures")] - fn get_favicon_future(&self, page_uri: &str) -> Box_>; + fn get_favicon_future(&self, page_uri: &str) -> Box_> where Self: Sized + Clone; - fn get_favicon_uri(&self, page_uri: &str) -> Option; + fn get_favicon_uri(&self, page_uri: &str) -> Option; fn connect_favicon_changed(&self, f: F) -> SignalHandlerId; } -impl + IsA + Clone + 'static> FaviconDatabaseExt for O { +impl> FaviconDatabaseExt for O { fn clear(&self) { unsafe { - ffi::webkit_favicon_database_clear(self.to_glib_none().0); + ffi::webkit_favicon_database_clear(self.as_ref().to_glib_none().0); } } - fn get_favicon<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, page_uri: &str, cancellable: P, callback: Q) { + 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 cancellable = cancellable.to_glib_none(); - 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) + 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) { 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.to_glib_none().0, page_uri.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + 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 _); } } #[cfg(feature = "futures")] - fn get_favicon_future(&self, page_uri: &str) -> Box_> { + fn get_favicon_future(&self, page_uri: &str) -> Box_> where Self: Sized + Clone { use gio::GioFuture; use fragile::Fragile; @@ -93,16 +94,16 @@ impl + IsA + Clone + 'static> Favi }) } - fn get_favicon_uri(&self, page_uri: &str) -> Option { + fn get_favicon_uri(&self, page_uri: &str) -> Option { unsafe { - from_glib_full(ffi::webkit_favicon_database_get_favicon_uri(self.to_glib_none().0, page_uri.to_glib_none().0)) + from_glib_full(ffi::webkit_favicon_database_get_favicon_uri(self.as_ref().to_glib_none().0, page_uri.to_glib_none().0)) } } fn connect_favicon_changed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "favicon-changed", + 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 _) } } @@ -111,5 +112,11 @@ impl + IsA + Clone + 'static> Favi 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); - f(&FaviconDatabase::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(page_uri), &String::from_glib_none(favicon_uri)) + f(&FaviconDatabase::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(page_uri), &GString::from_glib_borrow(favicon_uri)) +} + +impl fmt::Display for FaviconDatabase { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "FaviconDatabase") + } } diff --git a/src/auto/file_chooser_request.rs b/src/auto/file_chooser_request.rs index c648f9c9..74d86e64 100644 --- a/src/auto/file_chooser_request.rs +++ b/src/auto/file_chooser_request.rs @@ -3,40 +3,41 @@ // DO NOT EDIT use ffi; -use glib; +use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gtk; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct FileChooserRequest(Object); + pub struct FileChooserRequest(Object); match fn { get_type => || ffi::webkit_file_chooser_request_get_type(), } } -pub trait FileChooserRequestExt { +pub const NONE_FILE_CHOOSER_REQUEST: Option<&FileChooserRequest> = None; + +pub trait FileChooserRequestExt: 'static { fn cancel(&self); - fn get_mime_types(&self) -> Vec; + fn get_mime_types(&self) -> Vec; fn get_mime_types_filter(&self) -> Option; fn get_select_multiple(&self) -> bool; - fn get_selected_files(&self) -> Vec; + fn get_selected_files(&self) -> Vec; fn select_files(&self, files: &[&str]); @@ -51,47 +52,47 @@ pub trait FileChooserRequestExt { fn connect_property_selected_files_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> FileChooserRequestExt for O { +impl> FileChooserRequestExt for O { fn cancel(&self) { unsafe { - ffi::webkit_file_chooser_request_cancel(self.to_glib_none().0); + ffi::webkit_file_chooser_request_cancel(self.as_ref().to_glib_none().0); } } - fn get_mime_types(&self) -> Vec { + fn get_mime_types(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::webkit_file_chooser_request_get_mime_types(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::webkit_file_chooser_request_get_mime_types(self.as_ref().to_glib_none().0)) } } fn get_mime_types_filter(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_file_chooser_request_get_mime_types_filter(self.to_glib_none().0)) + from_glib_none(ffi::webkit_file_chooser_request_get_mime_types_filter(self.as_ref().to_glib_none().0)) } } fn get_select_multiple(&self) -> bool { unsafe { - from_glib(ffi::webkit_file_chooser_request_get_select_multiple(self.to_glib_none().0)) + from_glib(ffi::webkit_file_chooser_request_get_select_multiple(self.as_ref().to_glib_none().0)) } } - fn get_selected_files(&self) -> Vec { + fn get_selected_files(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::webkit_file_chooser_request_get_selected_files(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::webkit_file_chooser_request_get_selected_files(self.as_ref().to_glib_none().0)) } } fn select_files(&self, files: &[&str]) { unsafe { - ffi::webkit_file_chooser_request_select_files(self.to_glib_none().0, files.to_glib_none().0); + ffi::webkit_file_chooser_request_select_files(self.as_ref().to_glib_none().0, files.to_glib_none().0); } } fn get_property_filter(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "filter".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"filter\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -99,7 +100,7 @@ impl + IsA> FileChooserRequestE fn connect_property_filter_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::filter", + 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 _) } } @@ -107,7 +108,7 @@ impl + IsA> FileChooserRequestE fn connect_property_mime_types_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::mime-types", + 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 _) } } @@ -115,7 +116,7 @@ impl + IsA> FileChooserRequestE fn connect_property_select_multiple_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::select-multiple", + 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 _) } } @@ -123,7 +124,7 @@ impl + IsA> FileChooserRequestE fn connect_property_selected_files_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::selected-files", + 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 _) } } @@ -132,23 +133,29 @@ impl + IsA> FileChooserRequestE 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); - f(&FileChooserRequest::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&FileChooserRequest::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&FileChooserRequest::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&FileChooserRequest::from_glib_borrow(this).downcast_unchecked()) + f(&FileChooserRequest::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for FileChooserRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "FileChooserRequest") + } } diff --git a/src/auto/find_controller.rs b/src/auto/find_controller.rs index 1dee8913..c174aea5 100644 --- a/src/auto/find_controller.rs +++ b/src/auto/find_controller.rs @@ -4,38 +4,39 @@ use WebView; use ffi; -use glib; +use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use libc; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct FindController(Object); + pub struct FindController(Object); match fn { get_type => || ffi::webkit_find_controller_get_type(), } } -pub trait FindControllerExt { +pub const NONE_FIND_CONTROLLER: Option<&FindController> = None; + +pub trait FindControllerExt: 'static { fn count_matches(&self, search_text: &str, find_options: u32, max_match_count: u32); fn get_max_match_count(&self) -> u32; fn get_options(&self) -> u32; - fn get_search_text(&self) -> Option; + fn get_search_text(&self) -> Option; fn get_web_view(&self) -> Option; @@ -47,7 +48,7 @@ pub trait FindControllerExt { fn search_previous(&self); - fn get_property_text(&self) -> Option; + fn get_property_text(&self) -> Option; fn connect_counted_matches(&self, f: F) -> SignalHandlerId; @@ -62,65 +63,65 @@ pub trait FindControllerExt { fn connect_property_text_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> FindControllerExt for O { +impl> FindControllerExt for O { fn count_matches(&self, search_text: &str, find_options: u32, max_match_count: u32) { unsafe { - ffi::webkit_find_controller_count_matches(self.to_glib_none().0, search_text.to_glib_none().0, find_options, max_match_count); + ffi::webkit_find_controller_count_matches(self.as_ref().to_glib_none().0, search_text.to_glib_none().0, find_options, max_match_count); } } fn get_max_match_count(&self) -> u32 { unsafe { - ffi::webkit_find_controller_get_max_match_count(self.to_glib_none().0) + ffi::webkit_find_controller_get_max_match_count(self.as_ref().to_glib_none().0) } } fn get_options(&self) -> u32 { unsafe { - ffi::webkit_find_controller_get_options(self.to_glib_none().0) + ffi::webkit_find_controller_get_options(self.as_ref().to_glib_none().0) } } - fn get_search_text(&self) -> Option { + fn get_search_text(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_find_controller_get_search_text(self.to_glib_none().0)) + from_glib_none(ffi::webkit_find_controller_get_search_text(self.as_ref().to_glib_none().0)) } } fn get_web_view(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_find_controller_get_web_view(self.to_glib_none().0)) + from_glib_none(ffi::webkit_find_controller_get_web_view(self.as_ref().to_glib_none().0)) } } fn search(&self, search_text: &str, find_options: u32, max_match_count: u32) { unsafe { - ffi::webkit_find_controller_search(self.to_glib_none().0, search_text.to_glib_none().0, find_options, max_match_count); + ffi::webkit_find_controller_search(self.as_ref().to_glib_none().0, search_text.to_glib_none().0, find_options, max_match_count); } } fn search_finish(&self) { unsafe { - ffi::webkit_find_controller_search_finish(self.to_glib_none().0); + ffi::webkit_find_controller_search_finish(self.as_ref().to_glib_none().0); } } fn search_next(&self) { unsafe { - ffi::webkit_find_controller_search_next(self.to_glib_none().0); + ffi::webkit_find_controller_search_next(self.as_ref().to_glib_none().0); } } fn search_previous(&self) { unsafe { - ffi::webkit_find_controller_search_previous(self.to_glib_none().0); + ffi::webkit_find_controller_search_previous(self.as_ref().to_glib_none().0); } } - fn get_property_text(&self) -> Option { + fn get_property_text(&self) -> Option { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "text".to_glib_none().0, value.to_glib_none_mut().0); + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"text\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -128,7 +129,7 @@ impl + IsA> FindControllerExt for O fn connect_counted_matches(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "counted-matches", + 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 _) } } @@ -136,7 +137,7 @@ impl + IsA> FindControllerExt for O fn connect_failed_to_find_text(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "failed-to-find-text", + 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 _) } } @@ -144,7 +145,7 @@ impl + IsA> FindControllerExt for O fn connect_found_text(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "found-text", + 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 _) } } @@ -152,7 +153,7 @@ impl + IsA> FindControllerExt for O fn connect_property_max_match_count_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::max-match-count", + 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 _) } } @@ -160,7 +161,7 @@ impl + IsA> FindControllerExt for O fn connect_property_options_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::options", + 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 _) } } @@ -168,7 +169,7 @@ impl + IsA> FindControllerExt for O fn connect_property_text_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::text", + 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 _) } } @@ -177,35 +178,41 @@ impl + IsA> FindControllerExt for O 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); - f(&FindController::from_glib_borrow(this).downcast_unchecked(), match_count) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&FindController::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P, u32) + 'static) = transmute(f); - f(&FindController::from_glib_borrow(this).downcast_unchecked(), match_count) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&FindController::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&FindController::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&FindController::from_glib_borrow(this).downcast_unchecked()) + f(&FindController::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for FindController { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "FindController") + } } diff --git a/src/auto/form_submission_request.rs b/src/auto/form_submission_request.rs index c8ed113a..ce46b374 100644 --- a/src/auto/form_submission_request.rs +++ b/src/auto/form_submission_request.rs @@ -5,20 +5,19 @@ use ffi; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct FormSubmissionRequest(Object); + pub struct FormSubmissionRequest(Object); match fn { get_type => || ffi::webkit_form_submission_request_get_type(), } } -pub trait FormSubmissionRequestExt { +pub const NONE_FORM_SUBMISSION_REQUEST: Option<&FormSubmissionRequest> = None; + +pub trait FormSubmissionRequestExt: 'static { //#[cfg_attr(feature = "v2_20", deprecated)] //fn get_text_fields(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }; @@ -40,7 +39,13 @@ impl> FormSubmissionRequestExt for O { fn submit(&self) { unsafe { - ffi::webkit_form_submission_request_submit(self.to_glib_none().0); + ffi::webkit_form_submission_request_submit(self.as_ref().to_glib_none().0); } } } + +impl fmt::Display for FormSubmissionRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "FormSubmissionRequest") + } +} diff --git a/src/auto/geolocation_permission_request.rs b/src/auto/geolocation_permission_request.rs index 0ac918c6..d219bcf2 100644 --- a/src/auto/geolocation_permission_request.rs +++ b/src/auto/geolocation_permission_request.rs @@ -5,13 +5,10 @@ use PermissionRequest; use ffi; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct GeolocationPermissionRequest(Object): PermissionRequest; + pub struct GeolocationPermissionRequest(Object) @implements PermissionRequest; match fn { get_type => || ffi::webkit_geolocation_permission_request_get_type(), @@ -19,3 +16,11 @@ glib_wrapper! { } impl GeolocationPermissionRequest {} + +pub const NONE_GEOLOCATION_PERMISSION_REQUEST: Option<&GeolocationPermissionRequest> = None; + +impl fmt::Display for GeolocationPermissionRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "GeolocationPermissionRequest") + } +} diff --git a/src/auto/hit_test_result.rs b/src/auto/hit_test_result.rs index 25f87c59..08c5556f 100644 --- a/src/auto/hit_test_result.rs +++ b/src/auto/hit_test_result.rs @@ -3,22 +3,22 @@ // DO NOT EDIT use ffi; +use glib::GString; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct HitTestResult(Object); + pub struct HitTestResult(Object); match fn { get_type => || ffi::webkit_hit_test_result_get_type(), } } -pub trait HitTestResultExt { +pub const NONE_HIT_TEST_RESULT: Option<&HitTestResult> = None; + +pub trait HitTestResultExt: 'static { fn context_is_editable(&self) -> bool; fn context_is_image(&self) -> bool; @@ -34,88 +34,94 @@ pub trait HitTestResultExt { fn get_context(&self) -> u32; - fn get_image_uri(&self) -> Option; + fn get_image_uri(&self) -> Option; - fn get_link_label(&self) -> Option; + fn get_link_label(&self) -> Option; - fn get_link_title(&self) -> Option; + fn get_link_title(&self) -> Option; - fn get_link_uri(&self) -> Option; + fn get_link_uri(&self) -> Option; - fn get_media_uri(&self) -> Option; + fn get_media_uri(&self) -> Option; } impl> HitTestResultExt for O { fn context_is_editable(&self) -> bool { unsafe { - from_glib(ffi::webkit_hit_test_result_context_is_editable(self.to_glib_none().0)) + from_glib(ffi::webkit_hit_test_result_context_is_editable(self.as_ref().to_glib_none().0)) } } fn context_is_image(&self) -> bool { unsafe { - from_glib(ffi::webkit_hit_test_result_context_is_image(self.to_glib_none().0)) + from_glib(ffi::webkit_hit_test_result_context_is_image(self.as_ref().to_glib_none().0)) } } fn context_is_link(&self) -> bool { unsafe { - from_glib(ffi::webkit_hit_test_result_context_is_link(self.to_glib_none().0)) + from_glib(ffi::webkit_hit_test_result_context_is_link(self.as_ref().to_glib_none().0)) } } fn context_is_media(&self) -> bool { unsafe { - from_glib(ffi::webkit_hit_test_result_context_is_media(self.to_glib_none().0)) + from_glib(ffi::webkit_hit_test_result_context_is_media(self.as_ref().to_glib_none().0)) } } fn context_is_scrollbar(&self) -> bool { unsafe { - from_glib(ffi::webkit_hit_test_result_context_is_scrollbar(self.to_glib_none().0)) + from_glib(ffi::webkit_hit_test_result_context_is_scrollbar(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn context_is_selection(&self) -> bool { unsafe { - from_glib(ffi::webkit_hit_test_result_context_is_selection(self.to_glib_none().0)) + from_glib(ffi::webkit_hit_test_result_context_is_selection(self.as_ref().to_glib_none().0)) } } fn get_context(&self) -> u32 { unsafe { - ffi::webkit_hit_test_result_get_context(self.to_glib_none().0) + ffi::webkit_hit_test_result_get_context(self.as_ref().to_glib_none().0) } } - fn get_image_uri(&self) -> Option { + fn get_image_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_hit_test_result_get_image_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_hit_test_result_get_image_uri(self.as_ref().to_glib_none().0)) } } - fn get_link_label(&self) -> Option { + fn get_link_label(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_hit_test_result_get_link_label(self.to_glib_none().0)) + from_glib_none(ffi::webkit_hit_test_result_get_link_label(self.as_ref().to_glib_none().0)) } } - fn get_link_title(&self) -> Option { + fn get_link_title(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_hit_test_result_get_link_title(self.to_glib_none().0)) + from_glib_none(ffi::webkit_hit_test_result_get_link_title(self.as_ref().to_glib_none().0)) } } - fn get_link_uri(&self) -> Option { + fn get_link_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_hit_test_result_get_link_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_hit_test_result_get_link_uri(self.as_ref().to_glib_none().0)) } } - fn get_media_uri(&self) -> Option { + fn get_media_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_hit_test_result_get_media_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_hit_test_result_get_media_uri(self.as_ref().to_glib_none().0)) } } } + +impl fmt::Display for HitTestResult { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "HitTestResult") + } +} diff --git a/src/auto/install_missing_media_plugins_permission_request.rs b/src/auto/install_missing_media_plugins_permission_request.rs index 78f2090d..05cdcb60 100644 --- a/src/auto/install_missing_media_plugins_permission_request.rs +++ b/src/auto/install_missing_media_plugins_permission_request.rs @@ -4,31 +4,38 @@ use PermissionRequest; use ffi; +#[cfg(any(feature = "v2_10", feature = "dox"))] +use glib::GString; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct InstallMissingMediaPluginsPermissionRequest(Object): PermissionRequest; + pub struct InstallMissingMediaPluginsPermissionRequest(Object) @implements PermissionRequest; match fn { get_type => || ffi::webkit_install_missing_media_plugins_permission_request_get_type(), } } -pub trait InstallMissingMediaPluginsPermissionRequestExt { +pub const NONE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST: Option<&InstallMissingMediaPluginsPermissionRequest> = None; + +pub trait InstallMissingMediaPluginsPermissionRequestExt: 'static { #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_description(&self) -> Option; + fn get_description(&self) -> Option; } impl> InstallMissingMediaPluginsPermissionRequestExt for O { #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_description(&self) -> Option { + fn get_description(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_install_missing_media_plugins_permission_request_get_description(self.to_glib_none().0)) + from_glib_none(ffi::webkit_install_missing_media_plugins_permission_request_get_description(self.as_ref().to_glib_none().0)) } } } + +impl fmt::Display for InstallMissingMediaPluginsPermissionRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "InstallMissingMediaPluginsPermissionRequest") + } +} diff --git a/src/auto/javascript_result.rs b/src/auto/javascript_result.rs index 5e64b1d1..de2bcf8e 100644 --- a/src/auto/javascript_result.rs +++ b/src/auto/javascript_result.rs @@ -4,11 +4,7 @@ use ffi; use glib::translate::*; -use glib_ffi; -use gobject_ffi; use java_script_core; -use std::mem; -use std::ptr; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/src/auto/mime_info.rs b/src/auto/mime_info.rs index 7159a021..9d391d77 100644 --- a/src/auto/mime_info.rs +++ b/src/auto/mime_info.rs @@ -3,11 +3,8 @@ // DO NOT EDIT use ffi; +use glib::GString; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -21,19 +18,19 @@ glib_wrapper! { } impl MimeInfo { - pub fn get_description(&self) -> Option { + pub fn get_description(&self) -> Option { unsafe { from_glib_none(ffi::webkit_mime_info_get_description(self.to_glib_none().0)) } } - pub fn get_extensions(&self) -> Vec { + pub fn get_extensions(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::webkit_mime_info_get_extensions(self.to_glib_none().0)) } } - pub fn get_mime_type(&self) -> Option { + pub fn get_mime_type(&self) -> Option { unsafe { from_glib_none(ffi::webkit_mime_info_get_mime_type(self.to_glib_none().0)) } diff --git a/src/auto/mod.rs b/src/auto/mod.rs index 175f40c8..12d791a7 100644 --- a/src/auto/mod.rs +++ b/src/auto/mod.rs @@ -5,178 +5,178 @@ #[cfg(any(feature = "v2_2", feature = "dox"))] mod authentication_request; #[cfg(any(feature = "v2_2", feature = "dox"))] -pub use self::authentication_request::AuthenticationRequest; +pub use self::authentication_request::{AuthenticationRequest, AuthenticationRequestClass, NONE_AUTHENTICATION_REQUEST}; #[cfg(any(feature = "v2_2", feature = "dox"))] pub use self::authentication_request::AuthenticationRequestExt; mod back_forward_list; -pub use self::back_forward_list::BackForwardList; +pub use self::back_forward_list::{BackForwardList, BackForwardListClass, NONE_BACK_FORWARD_LIST}; pub use self::back_forward_list::BackForwardListExt; mod back_forward_list_item; -pub use self::back_forward_list_item::BackForwardListItem; +pub use self::back_forward_list_item::{BackForwardListItem, BackForwardListItemClass, NONE_BACK_FORWARD_LIST_ITEM}; pub use self::back_forward_list_item::BackForwardListItemExt; #[cfg(any(feature = "v2_8", feature = "dox"))] mod color_chooser_request; #[cfg(any(feature = "v2_8", feature = "dox"))] -pub use self::color_chooser_request::ColorChooserRequest; +pub use self::color_chooser_request::{ColorChooserRequest, ColorChooserRequestClass, NONE_COLOR_CHOOSER_REQUEST}; #[cfg(any(feature = "v2_8", feature = "dox"))] pub use self::color_chooser_request::ColorChooserRequestExt; mod context_menu; -pub use self::context_menu::ContextMenu; +pub use self::context_menu::{ContextMenu, ContextMenuClass, NONE_CONTEXT_MENU}; pub use self::context_menu::ContextMenuExt; mod context_menu_item; -pub use self::context_menu_item::ContextMenuItem; +pub use self::context_menu_item::{ContextMenuItem, ContextMenuItemClass, NONE_CONTEXT_MENU_ITEM}; pub use self::context_menu_item::ContextMenuItemExt; mod cookie_manager; -pub use self::cookie_manager::CookieManager; +pub use self::cookie_manager::{CookieManager, CookieManagerClass, NONE_COOKIE_MANAGER}; pub use self::cookie_manager::CookieManagerExt; mod download; -pub use self::download::Download; +pub use self::download::{Download, DownloadClass, NONE_DOWNLOAD}; pub use self::download::DownloadExt; #[cfg(any(feature = "v2_10", feature = "dox"))] mod editor_state; #[cfg(any(feature = "v2_10", feature = "dox"))] -pub use self::editor_state::EditorState; +pub use self::editor_state::{EditorState, EditorStateClass, NONE_EDITOR_STATE}; #[cfg(any(feature = "v2_10", feature = "dox"))] pub use self::editor_state::EditorStateExt; mod favicon_database; -pub use self::favicon_database::FaviconDatabase; +pub use self::favicon_database::{FaviconDatabase, FaviconDatabaseClass, NONE_FAVICON_DATABASE}; pub use self::favicon_database::FaviconDatabaseExt; mod file_chooser_request; -pub use self::file_chooser_request::FileChooserRequest; +pub use self::file_chooser_request::{FileChooserRequest, FileChooserRequestClass, NONE_FILE_CHOOSER_REQUEST}; pub use self::file_chooser_request::FileChooserRequestExt; mod find_controller; -pub use self::find_controller::FindController; +pub use self::find_controller::{FindController, FindControllerClass, NONE_FIND_CONTROLLER}; pub use self::find_controller::FindControllerExt; mod form_submission_request; -pub use self::form_submission_request::FormSubmissionRequest; +pub use self::form_submission_request::{FormSubmissionRequest, FormSubmissionRequestClass, NONE_FORM_SUBMISSION_REQUEST}; pub use self::form_submission_request::FormSubmissionRequestExt; mod geolocation_permission_request; -pub use self::geolocation_permission_request::GeolocationPermissionRequest; +pub use self::geolocation_permission_request::{GeolocationPermissionRequest, GeolocationPermissionRequestClass, NONE_GEOLOCATION_PERMISSION_REQUEST}; mod hit_test_result; -pub use self::hit_test_result::HitTestResult; +pub use self::hit_test_result::{HitTestResult, HitTestResultClass, NONE_HIT_TEST_RESULT}; pub use self::hit_test_result::HitTestResultExt; #[cfg(any(feature = "v2_10", feature = "dox"))] mod install_missing_media_plugins_permission_request; #[cfg(any(feature = "v2_10", feature = "dox"))] -pub use self::install_missing_media_plugins_permission_request::InstallMissingMediaPluginsPermissionRequest; +pub use self::install_missing_media_plugins_permission_request::{InstallMissingMediaPluginsPermissionRequest, InstallMissingMediaPluginsPermissionRequestClass, NONE_INSTALL_MISSING_MEDIA_PLUGINS_PERMISSION_REQUEST}; #[cfg(any(feature = "v2_10", feature = "dox"))] pub use self::install_missing_media_plugins_permission_request::InstallMissingMediaPluginsPermissionRequestExt; mod navigation_policy_decision; -pub use self::navigation_policy_decision::NavigationPolicyDecision; +pub use self::navigation_policy_decision::{NavigationPolicyDecision, NavigationPolicyDecisionClass, NONE_NAVIGATION_POLICY_DECISION}; pub use self::navigation_policy_decision::NavigationPolicyDecisionExt; #[cfg(any(feature = "v2_8", feature = "dox"))] mod notification; #[cfg(any(feature = "v2_8", feature = "dox"))] -pub use self::notification::Notification; +pub use self::notification::{Notification, NotificationClass, NONE_NOTIFICATION}; #[cfg(any(feature = "v2_8", feature = "dox"))] pub use self::notification::NotificationExt; mod notification_permission_request; -pub use self::notification_permission_request::NotificationPermissionRequest; +pub use self::notification_permission_request::{NotificationPermissionRequest, NotificationPermissionRequestClass, NONE_NOTIFICATION_PERMISSION_REQUEST}; mod permission_request; -pub use self::permission_request::PermissionRequest; +pub use self::permission_request::{PermissionRequest, NONE_PERMISSION_REQUEST}; pub use self::permission_request::PermissionRequestExt; mod plugin; -pub use self::plugin::Plugin; +pub use self::plugin::{Plugin, PluginClass, NONE_PLUGIN}; pub use self::plugin::PluginExt; mod policy_decision; -pub use self::policy_decision::PolicyDecision; +pub use self::policy_decision::{PolicyDecision, PolicyDecisionClass, NONE_POLICY_DECISION}; pub use self::policy_decision::PolicyDecisionExt; #[cfg(any(feature = "v2_16", feature = "dox"))] mod print_custom_widget; #[cfg(any(feature = "v2_16", feature = "dox"))] -pub use self::print_custom_widget::PrintCustomWidget; +pub use self::print_custom_widget::{PrintCustomWidget, PrintCustomWidgetClass, NONE_PRINT_CUSTOM_WIDGET}; #[cfg(any(feature = "v2_16", feature = "dox"))] pub use self::print_custom_widget::PrintCustomWidgetExt; mod print_operation; -pub use self::print_operation::PrintOperation; +pub use self::print_operation::{PrintOperation, PrintOperationClass, NONE_PRINT_OPERATION}; pub use self::print_operation::PrintOperationExt; mod response_policy_decision; -pub use self::response_policy_decision::ResponsePolicyDecision; +pub use self::response_policy_decision::{ResponsePolicyDecision, ResponsePolicyDecisionClass, NONE_RESPONSE_POLICY_DECISION}; pub use self::response_policy_decision::ResponsePolicyDecisionExt; mod security_manager; -pub use self::security_manager::SecurityManager; +pub use self::security_manager::{SecurityManager, SecurityManagerClass, NONE_SECURITY_MANAGER}; pub use self::security_manager::SecurityManagerExt; mod settings; -pub use self::settings::Settings; +pub use self::settings::{Settings, SettingsClass, NONE_SETTINGS}; pub use self::settings::SettingsExt; mod uri_request; -pub use self::uri_request::URIRequest; +pub use self::uri_request::{URIRequest, URIRequestClass, NONE_URI_REQUEST}; pub use self::uri_request::URIRequestExt; mod uri_response; -pub use self::uri_response::URIResponse; +pub use self::uri_response::{URIResponse, URIResponseClass, NONE_URI_RESPONSE}; pub use self::uri_response::URIResponseExt; mod uri_scheme_request; -pub use self::uri_scheme_request::URISchemeRequest; +pub use self::uri_scheme_request::{URISchemeRequest, URISchemeRequestClass, NONE_URI_SCHEME_REQUEST}; pub use self::uri_scheme_request::URISchemeRequestExt; #[cfg(any(feature = "v2_6", feature = "dox"))] mod user_content_manager; #[cfg(any(feature = "v2_6", feature = "dox"))] -pub use self::user_content_manager::UserContentManager; +pub use self::user_content_manager::{UserContentManager, UserContentManagerClass, NONE_USER_CONTENT_MANAGER}; #[cfg(any(feature = "v2_6", feature = "dox"))] pub use self::user_content_manager::UserContentManagerExt; mod user_media_permission_request; -pub use self::user_media_permission_request::UserMediaPermissionRequest; +pub use self::user_media_permission_request::{UserMediaPermissionRequest, UserMediaPermissionRequestClass, NONE_USER_MEDIA_PERMISSION_REQUEST}; pub use self::user_media_permission_request::UserMediaPermissionRequestExt; mod web_context; -pub use self::web_context::WebContext; +pub use self::web_context::{WebContext, WebContextClass, NONE_WEB_CONTEXT}; pub use self::web_context::WebContextExt; mod web_inspector; -pub use self::web_inspector::WebInspector; +pub use self::web_inspector::{WebInspector, WebInspectorClass, NONE_WEB_INSPECTOR}; pub use self::web_inspector::WebInspectorExt; mod web_resource; -pub use self::web_resource::WebResource; +pub use self::web_resource::{WebResource, WebResourceClass, NONE_WEB_RESOURCE}; pub use self::web_resource::WebResourceExt; mod web_view; -pub use self::web_view::WebView; +pub use self::web_view::{WebView, WebViewClass, NONE_WEB_VIEW}; pub use self::web_view::WebViewExt; mod web_view_base; -pub use self::web_view_base::WebViewBase; +pub use self::web_view_base::{WebViewBase, WebViewBaseClass, NONE_WEB_VIEW_BASE}; #[cfg(any(feature = "v2_10", feature = "dox"))] mod website_data_manager; #[cfg(any(feature = "v2_10", feature = "dox"))] -pub use self::website_data_manager::WebsiteDataManager; +pub use self::website_data_manager::{WebsiteDataManager, WebsiteDataManagerClass, NONE_WEBSITE_DATA_MANAGER}; #[cfg(any(feature = "v2_10", feature = "dox"))] pub use self::website_data_manager::WebsiteDataManagerExt; mod window_properties; -pub use self::window_properties::WindowProperties; +pub use self::window_properties::{WindowProperties, WindowPropertiesClass, NONE_WINDOW_PROPERTIES}; pub use self::window_properties::WindowPropertiesExt; #[cfg(any(feature = "v2_2", feature = "dox"))] diff --git a/src/auto/navigation_action.rs b/src/auto/navigation_action.rs index 8582e737..5d543a6e 100644 --- a/src/auto/navigation_action.rs +++ b/src/auto/navigation_action.rs @@ -7,11 +7,8 @@ use NavigationType; #[cfg(any(feature = "v2_6", feature = "dox"))] use URIRequest; use ffi; +#[cfg(any(feature = "v2_6", feature = "dox"))] use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/src/auto/navigation_policy_decision.rs b/src/auto/navigation_policy_decision.rs index 9c2579d6..34c620aa 100644 --- a/src/auto/navigation_policy_decision.rs +++ b/src/auto/navigation_policy_decision.rs @@ -8,29 +8,29 @@ use NavigationType; use PolicyDecision; use URIRequest; use ffi; -use glib; -use glib::object::Downcast; +use glib::GString; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; -use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct NavigationPolicyDecision(Object): PolicyDecision; + pub struct NavigationPolicyDecision(Object) @extends PolicyDecision; match fn { get_type => || ffi::webkit_navigation_policy_decision_get_type(), } } -pub trait NavigationPolicyDecisionExt { - fn get_frame_name(&self) -> Option; +pub const NONE_NAVIGATION_POLICY_DECISION: Option<&NavigationPolicyDecision> = None; + +pub trait NavigationPolicyDecisionExt: 'static { + fn get_frame_name(&self) -> Option; #[cfg_attr(feature = "v2_6", deprecated)] fn get_modifiers(&self) -> u32; @@ -65,48 +65,48 @@ pub trait NavigationPolicyDecisionExt { fn connect_property_request_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> NavigationPolicyDecisionExt for O { - fn get_frame_name(&self) -> Option { +impl> NavigationPolicyDecisionExt for O { + fn get_frame_name(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_navigation_policy_decision_get_frame_name(self.to_glib_none().0)) + from_glib_none(ffi::webkit_navigation_policy_decision_get_frame_name(self.as_ref().to_glib_none().0)) } } fn get_modifiers(&self) -> u32 { unsafe { - ffi::webkit_navigation_policy_decision_get_modifiers(self.to_glib_none().0) + ffi::webkit_navigation_policy_decision_get_modifiers(self.as_ref().to_glib_none().0) } } fn get_mouse_button(&self) -> u32 { unsafe { - ffi::webkit_navigation_policy_decision_get_mouse_button(self.to_glib_none().0) + ffi::webkit_navigation_policy_decision_get_mouse_button(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn get_navigation_action(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_navigation_policy_decision_get_navigation_action(self.to_glib_none().0)) + from_glib_none(ffi::webkit_navigation_policy_decision_get_navigation_action(self.as_ref().to_glib_none().0)) } } fn get_navigation_type(&self) -> NavigationType { unsafe { - from_glib(ffi::webkit_navigation_policy_decision_get_navigation_type(self.to_glib_none().0)) + from_glib(ffi::webkit_navigation_policy_decision_get_navigation_type(self.as_ref().to_glib_none().0)) } } fn get_request(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_navigation_policy_decision_get_request(self.to_glib_none().0)) + from_glib_none(ffi::webkit_navigation_policy_decision_get_request(self.as_ref().to_glib_none().0)) } } fn connect_property_frame_name_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::frame-name", + 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 _) } } @@ -114,7 +114,7 @@ impl + IsA> NavigationPol fn connect_property_modifiers_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::modifiers", + 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 _) } } @@ -122,7 +122,7 @@ impl + IsA> NavigationPol fn connect_property_mouse_button_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::mouse-button", + 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 _) } } @@ -131,7 +131,7 @@ impl + IsA> NavigationPol fn connect_property_navigation_action_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::navigation-action", + 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 _) } } @@ -139,7 +139,7 @@ impl + IsA> NavigationPol fn connect_property_navigation_type_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::navigation-type", + 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 _) } } @@ -147,7 +147,7 @@ impl + IsA> NavigationPol fn connect_property_request_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::request", + 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 _) } } @@ -156,36 +156,42 @@ impl + IsA> NavigationPol 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); - f(&NavigationPolicyDecision::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&NavigationPolicyDecision::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&NavigationPolicyDecision::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&NavigationPolicyDecision::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&NavigationPolicyDecision::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&NavigationPolicyDecision::from_glib_borrow(this).downcast_unchecked()) + f(&NavigationPolicyDecision::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for NavigationPolicyDecision { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "NavigationPolicyDecision") + } } diff --git a/src/auto/network_proxy_settings.rs b/src/auto/network_proxy_settings.rs index b7858165..8f28475c 100644 --- a/src/auto/network_proxy_settings.rs +++ b/src/auto/network_proxy_settings.rs @@ -3,11 +3,8 @@ // DO NOT EDIT use ffi; +#[cfg(any(feature = "v2_16", feature = "dox"))] use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/src/auto/notification.rs b/src/auto/notification.rs index 5477607a..9aa6729d 100644 --- a/src/auto/notification.rs +++ b/src/auto/notification.rs @@ -3,33 +3,35 @@ // DO NOT EDIT use ffi; -use glib; #[cfg(any(feature = "v2_8", feature = "dox"))] -use glib::object::Downcast; +use glib::GString; +#[cfg(any(feature = "v2_8", feature = "dox"))] +use glib::object::Cast; use glib::object::IsA; #[cfg(any(feature = "v2_8", feature = "dox"))] use glib::signal::SignalHandlerId; #[cfg(any(feature = "v2_8", feature = "dox"))] -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; +#[cfg(any(feature = "v2_8", feature = "dox"))] use glib_ffi; -use gobject_ffi; #[cfg(any(feature = "v2_8", feature = "dox"))] use std::boxed::Box as Box_; -use std::mem; +use std::fmt; #[cfg(any(feature = "v2_8", feature = "dox"))] use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct Notification(Object); + pub struct Notification(Object); match fn { get_type => || ffi::webkit_notification_get_type(), } } -pub trait NotificationExt { +pub const NONE_NOTIFICATION: Option<&Notification> = None; + +pub trait NotificationExt: 'static { #[cfg(any(feature = "v2_12", feature = "dox"))] fn clicked(&self); @@ -37,16 +39,16 @@ pub trait NotificationExt { fn close(&self); #[cfg(any(feature = "v2_8", feature = "dox"))] - fn get_body(&self) -> Option; + fn get_body(&self) -> Option; #[cfg(any(feature = "v2_8", feature = "dox"))] fn get_id(&self) -> u64; #[cfg(any(feature = "v2_16", feature = "dox"))] - fn get_tag(&self) -> Option; + fn get_tag(&self) -> Option; #[cfg(any(feature = "v2_8", feature = "dox"))] - fn get_title(&self) -> Option; + fn get_title(&self) -> Option; #[cfg(any(feature = "v2_12", feature = "dox"))] fn connect_clicked(&self, f: F) -> SignalHandlerId; @@ -67,46 +69,46 @@ pub trait NotificationExt { fn connect_property_title_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> NotificationExt for O { +impl> NotificationExt for O { #[cfg(any(feature = "v2_12", feature = "dox"))] fn clicked(&self) { unsafe { - ffi::webkit_notification_clicked(self.to_glib_none().0); + ffi::webkit_notification_clicked(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn close(&self) { unsafe { - ffi::webkit_notification_close(self.to_glib_none().0); + ffi::webkit_notification_close(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_8", feature = "dox"))] - fn get_body(&self) -> Option { + fn get_body(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_notification_get_body(self.to_glib_none().0)) + from_glib_none(ffi::webkit_notification_get_body(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn get_id(&self) -> u64 { unsafe { - ffi::webkit_notification_get_id(self.to_glib_none().0) + ffi::webkit_notification_get_id(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v2_16", feature = "dox"))] - fn get_tag(&self) -> Option { + fn get_tag(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_notification_get_tag(self.to_glib_none().0)) + from_glib_none(ffi::webkit_notification_get_tag(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] - fn get_title(&self) -> Option { + fn get_title(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_notification_get_title(self.to_glib_none().0)) + from_glib_none(ffi::webkit_notification_get_title(self.as_ref().to_glib_none().0)) } } @@ -114,7 +116,7 @@ impl + IsA> NotificationExt for O { fn connect_clicked(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "clicked", + 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 _) } } @@ -123,7 +125,7 @@ impl + IsA> NotificationExt for O { fn connect_closed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "closed", + 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 _) } } @@ -132,7 +134,7 @@ impl + IsA> NotificationExt for O { fn connect_property_body_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::body", + 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 _) } } @@ -141,7 +143,7 @@ impl + IsA> NotificationExt for O { fn connect_property_id_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::id", + 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 _) } } @@ -150,7 +152,7 @@ impl + IsA> NotificationExt for O { fn connect_property_tag_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::tag", + 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 _) } } @@ -159,7 +161,7 @@ impl + IsA> NotificationExt for O { fn connect_property_title_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::title", + 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 _) } } @@ -169,40 +171,46 @@ impl + IsA> NotificationExt for O { unsafe extern "C" fn clicked_trampoline

(this: *mut ffi::WebKitNotification, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Notification::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Notification::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Notification::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Notification::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Notification::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Notification::from_glib_borrow(this).downcast_unchecked()) + f(&Notification::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for Notification { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Notification") + } } diff --git a/src/auto/notification_permission_request.rs b/src/auto/notification_permission_request.rs index 05970105..9926c129 100644 --- a/src/auto/notification_permission_request.rs +++ b/src/auto/notification_permission_request.rs @@ -5,13 +5,10 @@ use PermissionRequest; use ffi; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct NotificationPermissionRequest(Object): PermissionRequest; + pub struct NotificationPermissionRequest(Object) @implements PermissionRequest; match fn { get_type => || ffi::webkit_notification_permission_request_get_type(), @@ -19,3 +16,11 @@ glib_wrapper! { } impl NotificationPermissionRequest {} + +pub const NONE_NOTIFICATION_PERMISSION_REQUEST: Option<&NotificationPermissionRequest> = None; + +impl fmt::Display for NotificationPermissionRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "NotificationPermissionRequest") + } +} diff --git a/src/auto/permission_request.rs b/src/auto/permission_request.rs index 309cc770..25612d31 100644 --- a/src/auto/permission_request.rs +++ b/src/auto/permission_request.rs @@ -5,20 +5,19 @@ use ffi; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct PermissionRequest(Object); + pub struct PermissionRequest(Interface); match fn { get_type => || ffi::webkit_permission_request_get_type(), } } -pub trait PermissionRequestExt { +pub const NONE_PERMISSION_REQUEST: Option<&PermissionRequest> = None; + +pub trait PermissionRequestExt: 'static { fn allow(&self); fn deny(&self); @@ -27,13 +26,19 @@ pub trait PermissionRequestExt { impl> PermissionRequestExt for O { fn allow(&self) { unsafe { - ffi::webkit_permission_request_allow(self.to_glib_none().0); + ffi::webkit_permission_request_allow(self.as_ref().to_glib_none().0); } } fn deny(&self) { unsafe { - ffi::webkit_permission_request_deny(self.to_glib_none().0); + ffi::webkit_permission_request_deny(self.as_ref().to_glib_none().0); } } } + +impl fmt::Display for PermissionRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "PermissionRequest") + } +} diff --git a/src/auto/plugin.rs b/src/auto/plugin.rs index 1ad80f85..4ead825a 100644 --- a/src/auto/plugin.rs +++ b/src/auto/plugin.rs @@ -4,53 +4,59 @@ use MimeInfo; use ffi; +use glib::GString; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct Plugin(Object); + pub struct Plugin(Object); match fn { get_type => || ffi::webkit_plugin_get_type(), } } -pub trait PluginExt { - fn get_description(&self) -> Option; +pub const NONE_PLUGIN: Option<&Plugin> = None; + +pub trait PluginExt: 'static { + fn get_description(&self) -> Option; fn get_mime_info_list(&self) -> Vec; - fn get_name(&self) -> Option; + fn get_name(&self) -> Option; - fn get_path(&self) -> Option; + fn get_path(&self) -> Option; } impl> PluginExt for O { - fn get_description(&self) -> Option { + fn get_description(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_plugin_get_description(self.to_glib_none().0)) + from_glib_none(ffi::webkit_plugin_get_description(self.as_ref().to_glib_none().0)) } } fn get_mime_info_list(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::webkit_plugin_get_mime_info_list(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::webkit_plugin_get_mime_info_list(self.as_ref().to_glib_none().0)) } } - fn get_name(&self) -> Option { + fn get_name(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_plugin_get_name(self.to_glib_none().0)) + from_glib_none(ffi::webkit_plugin_get_name(self.as_ref().to_glib_none().0)) } } - fn get_path(&self) -> Option { + fn get_path(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_plugin_get_path(self.to_glib_none().0)) + from_glib_none(ffi::webkit_plugin_get_path(self.as_ref().to_glib_none().0)) } } } + +impl fmt::Display for Plugin { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Plugin") + } +} diff --git a/src/auto/policy_decision.rs b/src/auto/policy_decision.rs index 9ff1e60e..2aa8681d 100644 --- a/src/auto/policy_decision.rs +++ b/src/auto/policy_decision.rs @@ -5,20 +5,19 @@ use ffi; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct PolicyDecision(Object); + pub struct PolicyDecision(Object); match fn { get_type => || ffi::webkit_policy_decision_get_type(), } } -pub trait PolicyDecisionExt { +pub const NONE_POLICY_DECISION: Option<&PolicyDecision> = None; + +pub trait PolicyDecisionExt: 'static { fn download(&self); fn ignore(&self); @@ -29,19 +28,25 @@ pub trait PolicyDecisionExt { impl> PolicyDecisionExt for O { fn download(&self) { unsafe { - ffi::webkit_policy_decision_download(self.to_glib_none().0); + ffi::webkit_policy_decision_download(self.as_ref().to_glib_none().0); } } fn ignore(&self) { unsafe { - ffi::webkit_policy_decision_ignore(self.to_glib_none().0); + ffi::webkit_policy_decision_ignore(self.as_ref().to_glib_none().0); } } fn use_(&self) { unsafe { - ffi::webkit_policy_decision_use(self.to_glib_none().0); + ffi::webkit_policy_decision_use(self.as_ref().to_glib_none().0); } } } + +impl fmt::Display for PolicyDecision { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "PolicyDecision") + } +} diff --git a/src/auto/print_custom_widget.rs b/src/auto/print_custom_widget.rs index ee5b3210..5e055ba3 100644 --- a/src/auto/print_custom_widget.rs +++ b/src/auto/print_custom_widget.rs @@ -3,30 +3,30 @@ // DO NOT EDIT use ffi; -use glib; #[cfg(any(feature = "v2_16", feature = "dox"))] -use glib::object::Downcast; +use glib::GString; +#[cfg(any(feature = "v2_16", feature = "dox"))] +use glib::object::Cast; use glib::object::IsA; #[cfg(any(feature = "v2_16", feature = "dox"))] use glib::signal::SignalHandlerId; #[cfg(any(feature = "v2_16", feature = "dox"))] -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; +#[cfg(any(feature = "v2_16", feature = "dox"))] use glib_ffi; -use gobject_ffi; #[cfg(any(feature = "v2_16", feature = "dox"))] use gtk; #[cfg(any(feature = "v2_16", feature = "dox"))] use gtk_ffi; #[cfg(any(feature = "v2_16", feature = "dox"))] use std::boxed::Box as Box_; -use std::mem; +use std::fmt; #[cfg(any(feature = "v2_16", feature = "dox"))] use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct PrintCustomWidget(Object); + pub struct PrintCustomWidget(Object); match fn { get_type => || ffi::webkit_print_custom_widget_get_type(), @@ -38,14 +38,16 @@ impl PrintCustomWidget { pub fn new>(widget: &P, title: &str) -> PrintCustomWidget { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::webkit_print_custom_widget_new(widget.to_glib_none().0, title.to_glib_none().0)) + from_glib_full(ffi::webkit_print_custom_widget_new(widget.as_ref().to_glib_none().0, title.to_glib_none().0)) } } } -pub trait PrintCustomWidgetExt { +pub const NONE_PRINT_CUSTOM_WIDGET: Option<&PrintCustomWidget> = None; + +pub trait PrintCustomWidgetExt: 'static { #[cfg(any(feature = "v2_16", feature = "dox"))] - fn get_title(&self) -> Option; + fn get_title(&self) -> Option; #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_widget(&self) -> Option; @@ -57,18 +59,18 @@ pub trait PrintCustomWidgetExt { fn connect_update(&self, f: F) -> SignalHandlerId; } -impl + IsA> PrintCustomWidgetExt for O { +impl> PrintCustomWidgetExt for O { #[cfg(any(feature = "v2_16", feature = "dox"))] - fn get_title(&self) -> Option { + fn get_title(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_print_custom_widget_get_title(self.to_glib_none().0)) + from_glib_none(ffi::webkit_print_custom_widget_get_title(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_widget(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_print_custom_widget_get_widget(self.to_glib_none().0)) + from_glib_none(ffi::webkit_print_custom_widget_get_widget(self.as_ref().to_glib_none().0)) } } @@ -76,7 +78,7 @@ impl + IsA> PrintCustomWidgetExt fn connect_apply(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "apply", + 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 _) } } @@ -85,7 +87,7 @@ impl + IsA> PrintCustomWidgetExt fn connect_update(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "update", + 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 _) } } @@ -95,12 +97,18 @@ impl + IsA> PrintCustomWidgetExt unsafe extern "C" fn apply_trampoline

(this: *mut ffi::WebKitPrintCustomWidget, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&PrintCustomWidget::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P, >k::PageSetup, >k::PrintSettings) + 'static) = transmute(f); - f(&PrintCustomWidget::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(page_setup), &from_glib_borrow(print_settings)) + f(&PrintCustomWidget::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(page_setup), &from_glib_borrow(print_settings)) +} + +impl fmt::Display for PrintCustomWidget { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "PrintCustomWidget") + } } diff --git a/src/auto/print_operation.rs b/src/auto/print_operation.rs index bf8368f0..a1bb0105 100644 --- a/src/auto/print_operation.rs +++ b/src/auto/print_operation.rs @@ -8,24 +8,22 @@ use PrintCustomWidget; use PrintOperationResponse; use WebView; use ffi; -use glib; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gtk; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct PrintOperation(Object); + pub struct PrintOperation(Object); match fn { get_type => || ffi::webkit_print_operation_get_type(), @@ -33,15 +31,17 @@ glib_wrapper! { } impl PrintOperation { - pub fn new(web_view: &WebView) -> PrintOperation { + pub fn new>(web_view: &P) -> PrintOperation { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::webkit_print_operation_new(web_view.to_glib_none().0)) + from_glib_full(ffi::webkit_print_operation_new(web_view.as_ref().to_glib_none().0)) } } } -pub trait PrintOperationExt { +pub const NONE_PRINT_OPERATION: Option<&PrintOperation> = None; + +pub trait PrintOperationExt: 'static { fn get_page_setup(&self) -> Option; fn get_print_settings(&self) -> Option; @@ -50,9 +50,9 @@ pub trait PrintOperationExt { fn run_dialog<'a, P: IsA + 'a, Q: Into>>(&self, parent: Q) -> PrintOperationResponse; - fn set_page_setup(&self, page_setup: >k::PageSetup); + fn set_page_setup>(&self, page_setup: &P); - fn set_print_settings(&self, print_settings: >k::PrintSettings); + fn set_print_settings>(&self, print_settings: &P); fn get_property_web_view(&self) -> Option; @@ -68,49 +68,48 @@ pub trait PrintOperationExt { fn connect_property_print_settings_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> PrintOperationExt for O { +impl> PrintOperationExt for O { fn get_page_setup(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_print_operation_get_page_setup(self.to_glib_none().0)) + from_glib_none(ffi::webkit_print_operation_get_page_setup(self.as_ref().to_glib_none().0)) } } fn get_print_settings(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_print_operation_get_print_settings(self.to_glib_none().0)) + from_glib_none(ffi::webkit_print_operation_get_print_settings(self.as_ref().to_glib_none().0)) } } fn print(&self) { unsafe { - ffi::webkit_print_operation_print(self.to_glib_none().0); + ffi::webkit_print_operation_print(self.as_ref().to_glib_none().0); } } fn run_dialog<'a, P: IsA + 'a, Q: Into>>(&self, parent: Q) -> PrintOperationResponse { let parent = parent.into(); - let parent = parent.to_glib_none(); unsafe { - from_glib(ffi::webkit_print_operation_run_dialog(self.to_glib_none().0, parent.0)) + 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)) } } - fn set_page_setup(&self, page_setup: >k::PageSetup) { + fn set_page_setup>(&self, page_setup: &P) { unsafe { - ffi::webkit_print_operation_set_page_setup(self.to_glib_none().0, page_setup.to_glib_none().0); + ffi::webkit_print_operation_set_page_setup(self.as_ref().to_glib_none().0, page_setup.as_ref().to_glib_none().0); } } - fn set_print_settings(&self, print_settings: >k::PrintSettings) { + fn set_print_settings>(&self, print_settings: &P) { unsafe { - ffi::webkit_print_operation_set_print_settings(self.to_glib_none().0, print_settings.to_glib_none().0); + ffi::webkit_print_operation_set_print_settings(self.as_ref().to_glib_none().0, print_settings.as_ref().to_glib_none().0); } } fn get_property_web_view(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "web-view".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"web-view\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -119,7 +118,7 @@ impl + IsA> PrintOperationExt for O fn connect_create_custom_widget PrintCustomWidget + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ PrintCustomWidget + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "create-custom-widget", + 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 _) } } @@ -127,7 +126,7 @@ impl + IsA> PrintOperationExt for O fn connect_failed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "failed", + 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 _) } } @@ -135,7 +134,7 @@ impl + IsA> PrintOperationExt for O fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "finished", + 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 _) } } @@ -143,7 +142,7 @@ impl + IsA> PrintOperationExt for O fn connect_property_page_setup_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::page-setup", + 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 _) } } @@ -151,7 +150,7 @@ impl + IsA> PrintOperationExt for O fn connect_property_print_settings_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::print-settings", + 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 _) } } @@ -161,29 +160,35 @@ impl + IsA> PrintOperationExt for O unsafe extern "C" fn create_custom_widget_trampoline

(this: *mut ffi::WebKitPrintOperation, f: glib_ffi::gpointer) -> *mut ffi::WebKitPrintCustomWidget where P: IsA { let f: &&(Fn(&P) -> PrintCustomWidget + 'static) = transmute(f); - f(&PrintOperation::from_glib_borrow(this).downcast_unchecked()).to_glib_full() + 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) where P: IsA { let f: &&(Fn(&P, &Error) + 'static) = transmute(f); - f(&PrintOperation::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(error)) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&PrintOperation::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&PrintOperation::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&PrintOperation::from_glib_borrow(this).downcast_unchecked()) + f(&PrintOperation::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for PrintOperation { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "PrintOperation") + } } diff --git a/src/auto/response_policy_decision.rs b/src/auto/response_policy_decision.rs index 5fa56e27..a3637835 100644 --- a/src/auto/response_policy_decision.rs +++ b/src/auto/response_policy_decision.rs @@ -6,28 +6,27 @@ use PolicyDecision; use URIRequest; use URIResponse; use ffi; -use glib; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; -use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct ResponsePolicyDecision(Object): PolicyDecision; + pub struct ResponsePolicyDecision(Object) @extends PolicyDecision; match fn { get_type => || ffi::webkit_response_policy_decision_get_type(), } } -pub trait ResponsePolicyDecisionExt { +pub const NONE_RESPONSE_POLICY_DECISION: Option<&ResponsePolicyDecision> = None; + +pub trait ResponsePolicyDecisionExt: 'static { fn get_request(&self) -> Option; fn get_response(&self) -> Option; @@ -40,30 +39,30 @@ pub trait ResponsePolicyDecisionExt { fn connect_property_response_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> ResponsePolicyDecisionExt for O { +impl> ResponsePolicyDecisionExt for O { fn get_request(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_response_policy_decision_get_request(self.to_glib_none().0)) + from_glib_none(ffi::webkit_response_policy_decision_get_request(self.as_ref().to_glib_none().0)) } } fn get_response(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_response_policy_decision_get_response(self.to_glib_none().0)) + from_glib_none(ffi::webkit_response_policy_decision_get_response(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn is_mime_type_supported(&self) -> bool { unsafe { - from_glib(ffi::webkit_response_policy_decision_is_mime_type_supported(self.to_glib_none().0)) + from_glib(ffi::webkit_response_policy_decision_is_mime_type_supported(self.as_ref().to_glib_none().0)) } } fn connect_property_request_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::request", + 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 _) } } @@ -71,7 +70,7 @@ impl + IsA> ResponsePolicyD fn connect_property_response_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::response", + 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 _) } } @@ -80,11 +79,17 @@ impl + IsA> ResponsePolicyD 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); - f(&ResponsePolicyDecision::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&ResponsePolicyDecision::from_glib_borrow(this).downcast_unchecked()) + f(&ResponsePolicyDecision::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for ResponsePolicyDecision { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ResponsePolicyDecision") + } } diff --git a/src/auto/security_manager.rs b/src/auto/security_manager.rs index 626266a9..539a8919 100644 --- a/src/auto/security_manager.rs +++ b/src/auto/security_manager.rs @@ -5,20 +5,19 @@ use ffi; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct SecurityManager(Object); + pub struct SecurityManager(Object); match fn { get_type => || ffi::webkit_security_manager_get_type(), } } -pub trait SecurityManagerExt { +pub const NONE_SECURITY_MANAGER: Option<&SecurityManager> = None; + +pub trait SecurityManagerExt: 'static { fn register_uri_scheme_as_cors_enabled(&self, scheme: &str); fn register_uri_scheme_as_display_isolated(&self, scheme: &str); @@ -47,73 +46,79 @@ pub trait SecurityManagerExt { impl> SecurityManagerExt for O { fn register_uri_scheme_as_cors_enabled(&self, scheme: &str) { unsafe { - ffi::webkit_security_manager_register_uri_scheme_as_cors_enabled(self.to_glib_none().0, scheme.to_glib_none().0); + ffi::webkit_security_manager_register_uri_scheme_as_cors_enabled(self.as_ref().to_glib_none().0, scheme.to_glib_none().0); } } fn register_uri_scheme_as_display_isolated(&self, scheme: &str) { unsafe { - ffi::webkit_security_manager_register_uri_scheme_as_display_isolated(self.to_glib_none().0, scheme.to_glib_none().0); + ffi::webkit_security_manager_register_uri_scheme_as_display_isolated(self.as_ref().to_glib_none().0, scheme.to_glib_none().0); } } fn register_uri_scheme_as_empty_document(&self, scheme: &str) { unsafe { - ffi::webkit_security_manager_register_uri_scheme_as_empty_document(self.to_glib_none().0, scheme.to_glib_none().0); + ffi::webkit_security_manager_register_uri_scheme_as_empty_document(self.as_ref().to_glib_none().0, scheme.to_glib_none().0); } } fn register_uri_scheme_as_local(&self, scheme: &str) { unsafe { - ffi::webkit_security_manager_register_uri_scheme_as_local(self.to_glib_none().0, scheme.to_glib_none().0); + ffi::webkit_security_manager_register_uri_scheme_as_local(self.as_ref().to_glib_none().0, scheme.to_glib_none().0); } } fn register_uri_scheme_as_no_access(&self, scheme: &str) { unsafe { - ffi::webkit_security_manager_register_uri_scheme_as_no_access(self.to_glib_none().0, scheme.to_glib_none().0); + ffi::webkit_security_manager_register_uri_scheme_as_no_access(self.as_ref().to_glib_none().0, scheme.to_glib_none().0); } } fn register_uri_scheme_as_secure(&self, scheme: &str) { unsafe { - ffi::webkit_security_manager_register_uri_scheme_as_secure(self.to_glib_none().0, scheme.to_glib_none().0); + ffi::webkit_security_manager_register_uri_scheme_as_secure(self.as_ref().to_glib_none().0, scheme.to_glib_none().0); } } fn uri_scheme_is_cors_enabled(&self, scheme: &str) -> bool { unsafe { - from_glib(ffi::webkit_security_manager_uri_scheme_is_cors_enabled(self.to_glib_none().0, scheme.to_glib_none().0)) + from_glib(ffi::webkit_security_manager_uri_scheme_is_cors_enabled(self.as_ref().to_glib_none().0, scheme.to_glib_none().0)) } } fn uri_scheme_is_display_isolated(&self, scheme: &str) -> bool { unsafe { - from_glib(ffi::webkit_security_manager_uri_scheme_is_display_isolated(self.to_glib_none().0, scheme.to_glib_none().0)) + from_glib(ffi::webkit_security_manager_uri_scheme_is_display_isolated(self.as_ref().to_glib_none().0, scheme.to_glib_none().0)) } } fn uri_scheme_is_empty_document(&self, scheme: &str) -> bool { unsafe { - from_glib(ffi::webkit_security_manager_uri_scheme_is_empty_document(self.to_glib_none().0, scheme.to_glib_none().0)) + from_glib(ffi::webkit_security_manager_uri_scheme_is_empty_document(self.as_ref().to_glib_none().0, scheme.to_glib_none().0)) } } fn uri_scheme_is_local(&self, scheme: &str) -> bool { unsafe { - from_glib(ffi::webkit_security_manager_uri_scheme_is_local(self.to_glib_none().0, scheme.to_glib_none().0)) + from_glib(ffi::webkit_security_manager_uri_scheme_is_local(self.as_ref().to_glib_none().0, scheme.to_glib_none().0)) } } fn uri_scheme_is_no_access(&self, scheme: &str) -> bool { unsafe { - from_glib(ffi::webkit_security_manager_uri_scheme_is_no_access(self.to_glib_none().0, scheme.to_glib_none().0)) + from_glib(ffi::webkit_security_manager_uri_scheme_is_no_access(self.as_ref().to_glib_none().0, scheme.to_glib_none().0)) } } fn uri_scheme_is_secure(&self, scheme: &str) -> bool { unsafe { - from_glib(ffi::webkit_security_manager_uri_scheme_is_secure(self.to_glib_none().0, scheme.to_glib_none().0)) + from_glib(ffi::webkit_security_manager_uri_scheme_is_secure(self.as_ref().to_glib_none().0, scheme.to_glib_none().0)) } } } + +impl fmt::Display for SecurityManager { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "SecurityManager") + } +} diff --git a/src/auto/security_origin.rs b/src/auto/security_origin.rs index 37e93dcf..5efebc42 100644 --- a/src/auto/security_origin.rs +++ b/src/auto/security_origin.rs @@ -3,12 +3,11 @@ // DO NOT EDIT use ffi; +#[cfg(any(feature = "v2_16", feature = "dox"))] +use glib::GString; +#[cfg(any(feature = "v2_16", feature = "dox"))] use glib::translate::*; -use glib_ffi; -use gobject_ffi; use std::fmt; -use std::mem; -use std::ptr; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -39,7 +38,7 @@ impl SecurityOrigin { } #[cfg(any(feature = "v2_16", feature = "dox"))] - pub fn get_host(&self) -> Option { + pub fn get_host(&self) -> Option { unsafe { from_glib_none(ffi::webkit_security_origin_get_host(self.to_glib_none().0)) } @@ -53,7 +52,7 @@ impl SecurityOrigin { } #[cfg(any(feature = "v2_16", feature = "dox"))] - pub fn get_protocol(&self) -> Option { + pub fn get_protocol(&self) -> Option { unsafe { from_glib_none(ffi::webkit_security_origin_get_protocol(self.to_glib_none().0)) } @@ -67,7 +66,7 @@ impl SecurityOrigin { } #[cfg(any(feature = "v2_16", feature = "dox"))] - fn to_string(&self) -> String { + fn to_string(&self) -> GString { unsafe { from_glib_full(ffi::webkit_security_origin_to_string(self.to_glib_none().0)) } diff --git a/src/auto/settings.rs b/src/auto/settings.rs index f7e2495a..905f0efa 100644 --- a/src/auto/settings.rs +++ b/src/auto/settings.rs @@ -5,21 +5,19 @@ #[cfg(any(feature = "v2_16", feature = "dox"))] use HardwareAccelerationPolicy; use ffi; -use glib; -use glib::object::Downcast; +use glib::GString; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; -use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct Settings(Object); + pub struct Settings(Object); match fn { get_type => || ffi::webkit_settings_get_type(), @@ -61,7 +59,9 @@ impl Default for Settings { } } -pub trait SettingsExt { +pub const NONE_SETTINGS: Option<&Settings> = None; + +pub trait SettingsExt: 'static { #[cfg(any(feature = "v2_10", feature = "dox"))] fn get_allow_file_access_from_file_urls(&self) -> bool; @@ -72,11 +72,11 @@ pub trait SettingsExt { fn get_auto_load_images(&self) -> bool; - fn get_cursive_font_family(&self) -> Option; + fn get_cursive_font_family(&self) -> Option; - fn get_default_charset(&self) -> Option; + fn get_default_charset(&self) -> Option; - fn get_default_font_family(&self) -> Option; + fn get_default_font_family(&self) -> Option; fn get_default_font_size(&self) -> u32; @@ -145,7 +145,7 @@ pub trait SettingsExt { fn get_enable_xss_auditor(&self) -> bool; - fn get_fantasy_font_family(&self) -> Option; + fn get_fantasy_font_family(&self) -> Option; #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_hardware_acceleration_policy(&self) -> HardwareAccelerationPolicy; @@ -162,17 +162,17 @@ pub trait SettingsExt { fn get_minimum_font_size(&self) -> u32; - fn get_monospace_font_family(&self) -> Option; + fn get_monospace_font_family(&self) -> Option; - fn get_pictograph_font_family(&self) -> Option; + fn get_pictograph_font_family(&self) -> Option; fn get_print_backgrounds(&self) -> bool; - fn get_sans_serif_font_family(&self) -> Option; + fn get_sans_serif_font_family(&self) -> Option; - fn get_serif_font_family(&self) -> Option; + fn get_serif_font_family(&self) -> Option; - fn get_user_agent(&self) -> Option; + fn get_user_agent(&self) -> Option; fn get_zoom_text_only(&self) -> bool; @@ -407,658 +407,655 @@ pub trait SettingsExt { fn connect_property_zoom_text_only_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> SettingsExt for O { +impl> SettingsExt for O { #[cfg(any(feature = "v2_10", feature = "dox"))] fn get_allow_file_access_from_file_urls(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_allow_file_access_from_file_urls(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_allow_file_access_from_file_urls(self.as_ref().to_glib_none().0)) } } fn get_allow_modal_dialogs(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_allow_modal_dialogs(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_allow_modal_dialogs(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_14", feature = "dox"))] fn get_allow_universal_access_from_file_urls(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_allow_universal_access_from_file_urls(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_allow_universal_access_from_file_urls(self.as_ref().to_glib_none().0)) } } fn get_auto_load_images(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_auto_load_images(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_auto_load_images(self.as_ref().to_glib_none().0)) } } - fn get_cursive_font_family(&self) -> Option { + fn get_cursive_font_family(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_settings_get_cursive_font_family(self.to_glib_none().0)) + from_glib_none(ffi::webkit_settings_get_cursive_font_family(self.as_ref().to_glib_none().0)) } } - fn get_default_charset(&self) -> Option { + fn get_default_charset(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_settings_get_default_charset(self.to_glib_none().0)) + from_glib_none(ffi::webkit_settings_get_default_charset(self.as_ref().to_glib_none().0)) } } - fn get_default_font_family(&self) -> Option { + fn get_default_font_family(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_settings_get_default_font_family(self.to_glib_none().0)) + from_glib_none(ffi::webkit_settings_get_default_font_family(self.as_ref().to_glib_none().0)) } } fn get_default_font_size(&self) -> u32 { unsafe { - ffi::webkit_settings_get_default_font_size(self.to_glib_none().0) + ffi::webkit_settings_get_default_font_size(self.as_ref().to_glib_none().0) } } fn get_default_monospace_font_size(&self) -> u32 { unsafe { - ffi::webkit_settings_get_default_monospace_font_size(self.to_glib_none().0) + ffi::webkit_settings_get_default_monospace_font_size(self.as_ref().to_glib_none().0) } } fn get_draw_compositing_indicators(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_draw_compositing_indicators(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_draw_compositing_indicators(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn get_enable_accelerated_2d_canvas(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_accelerated_2d_canvas(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_accelerated_2d_canvas(self.as_ref().to_glib_none().0)) } } fn get_enable_caret_browsing(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_caret_browsing(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_caret_browsing(self.as_ref().to_glib_none().0)) } } fn get_enable_developer_extras(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_developer_extras(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_developer_extras(self.as_ref().to_glib_none().0)) } } fn get_enable_dns_prefetching(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_dns_prefetching(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_dns_prefetching(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_20", feature = "dox"))] fn get_enable_encrypted_media(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_encrypted_media(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_encrypted_media(self.as_ref().to_glib_none().0)) } } fn get_enable_frame_flattening(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_frame_flattening(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_frame_flattening(self.as_ref().to_glib_none().0)) } } fn get_enable_fullscreen(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_fullscreen(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_fullscreen(self.as_ref().to_glib_none().0)) } } fn get_enable_html5_database(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_html5_database(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_html5_database(self.as_ref().to_glib_none().0)) } } fn get_enable_html5_local_storage(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_html5_local_storage(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_html5_local_storage(self.as_ref().to_glib_none().0)) } } fn get_enable_hyperlink_auditing(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_hyperlink_auditing(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_hyperlink_auditing(self.as_ref().to_glib_none().0)) } } fn get_enable_java(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_java(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_java(self.as_ref().to_glib_none().0)) } } fn get_enable_javascript(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_javascript(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_javascript(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn get_enable_media_stream(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_media_stream(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_media_stream(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn get_enable_mediasource(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_mediasource(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_mediasource(self.as_ref().to_glib_none().0)) } } fn get_enable_offline_web_application_cache(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_offline_web_application_cache(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_offline_web_application_cache(self.as_ref().to_glib_none().0)) } } fn get_enable_page_cache(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_page_cache(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_page_cache(self.as_ref().to_glib_none().0)) } } fn get_enable_plugins(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_plugins(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_plugins(self.as_ref().to_glib_none().0)) } } fn get_enable_private_browsing(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_private_browsing(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_private_browsing(self.as_ref().to_glib_none().0)) } } fn get_enable_resizable_text_areas(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_resizable_text_areas(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_resizable_text_areas(self.as_ref().to_glib_none().0)) } } fn get_enable_site_specific_quirks(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_site_specific_quirks(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_site_specific_quirks(self.as_ref().to_glib_none().0)) } } fn get_enable_smooth_scrolling(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_smooth_scrolling(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_smooth_scrolling(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn get_enable_spatial_navigation(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_spatial_navigation(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_spatial_navigation(self.as_ref().to_glib_none().0)) } } fn get_enable_tabs_to_links(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_tabs_to_links(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_tabs_to_links(self.as_ref().to_glib_none().0)) } } fn get_enable_webaudio(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_webaudio(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_webaudio(self.as_ref().to_glib_none().0)) } } fn get_enable_webgl(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_webgl(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_webgl(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn get_enable_write_console_messages_to_stdout(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_write_console_messages_to_stdout(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_write_console_messages_to_stdout(self.as_ref().to_glib_none().0)) } } fn get_enable_xss_auditor(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_enable_xss_auditor(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_enable_xss_auditor(self.as_ref().to_glib_none().0)) } } - fn get_fantasy_font_family(&self) -> Option { + fn get_fantasy_font_family(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_settings_get_fantasy_font_family(self.to_glib_none().0)) + from_glib_none(ffi::webkit_settings_get_fantasy_font_family(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_hardware_acceleration_policy(&self) -> HardwareAccelerationPolicy { unsafe { - from_glib(ffi::webkit_settings_get_hardware_acceleration_policy(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_hardware_acceleration_policy(self.as_ref().to_glib_none().0)) } } fn get_javascript_can_access_clipboard(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_javascript_can_access_clipboard(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_javascript_can_access_clipboard(self.as_ref().to_glib_none().0)) } } fn get_javascript_can_open_windows_automatically(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_javascript_can_open_windows_automatically(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_javascript_can_open_windows_automatically(self.as_ref().to_glib_none().0)) } } fn get_load_icons_ignoring_image_load_setting(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_load_icons_ignoring_image_load_setting(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_load_icons_ignoring_image_load_setting(self.as_ref().to_glib_none().0)) } } fn get_media_playback_allows_inline(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_media_playback_allows_inline(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_media_playback_allows_inline(self.as_ref().to_glib_none().0)) } } fn get_media_playback_requires_user_gesture(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_media_playback_requires_user_gesture(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_media_playback_requires_user_gesture(self.as_ref().to_glib_none().0)) } } fn get_minimum_font_size(&self) -> u32 { unsafe { - ffi::webkit_settings_get_minimum_font_size(self.to_glib_none().0) + ffi::webkit_settings_get_minimum_font_size(self.as_ref().to_glib_none().0) } } - fn get_monospace_font_family(&self) -> Option { + fn get_monospace_font_family(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_settings_get_monospace_font_family(self.to_glib_none().0)) + from_glib_none(ffi::webkit_settings_get_monospace_font_family(self.as_ref().to_glib_none().0)) } } - fn get_pictograph_font_family(&self) -> Option { + fn get_pictograph_font_family(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_settings_get_pictograph_font_family(self.to_glib_none().0)) + from_glib_none(ffi::webkit_settings_get_pictograph_font_family(self.as_ref().to_glib_none().0)) } } fn get_print_backgrounds(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_print_backgrounds(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_print_backgrounds(self.as_ref().to_glib_none().0)) } } - fn get_sans_serif_font_family(&self) -> Option { + fn get_sans_serif_font_family(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_settings_get_sans_serif_font_family(self.to_glib_none().0)) + from_glib_none(ffi::webkit_settings_get_sans_serif_font_family(self.as_ref().to_glib_none().0)) } } - fn get_serif_font_family(&self) -> Option { + fn get_serif_font_family(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_settings_get_serif_font_family(self.to_glib_none().0)) + from_glib_none(ffi::webkit_settings_get_serif_font_family(self.as_ref().to_glib_none().0)) } } - fn get_user_agent(&self) -> Option { + fn get_user_agent(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_settings_get_user_agent(self.to_glib_none().0)) + from_glib_none(ffi::webkit_settings_get_user_agent(self.as_ref().to_glib_none().0)) } } fn get_zoom_text_only(&self) -> bool { unsafe { - from_glib(ffi::webkit_settings_get_zoom_text_only(self.to_glib_none().0)) + from_glib(ffi::webkit_settings_get_zoom_text_only(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_10", feature = "dox"))] fn set_allow_file_access_from_file_urls(&self, allowed: bool) { unsafe { - ffi::webkit_settings_set_allow_file_access_from_file_urls(self.to_glib_none().0, allowed.to_glib()); + ffi::webkit_settings_set_allow_file_access_from_file_urls(self.as_ref().to_glib_none().0, allowed.to_glib()); } } fn set_allow_modal_dialogs(&self, allowed: bool) { unsafe { - ffi::webkit_settings_set_allow_modal_dialogs(self.to_glib_none().0, allowed.to_glib()); + ffi::webkit_settings_set_allow_modal_dialogs(self.as_ref().to_glib_none().0, allowed.to_glib()); } } #[cfg(any(feature = "v2_14", feature = "dox"))] fn set_allow_universal_access_from_file_urls(&self, allowed: bool) { unsafe { - ffi::webkit_settings_set_allow_universal_access_from_file_urls(self.to_glib_none().0, allowed.to_glib()); + ffi::webkit_settings_set_allow_universal_access_from_file_urls(self.as_ref().to_glib_none().0, allowed.to_glib()); } } fn set_auto_load_images(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_auto_load_images(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_auto_load_images(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_cursive_font_family(&self, cursive_font_family: &str) { unsafe { - ffi::webkit_settings_set_cursive_font_family(self.to_glib_none().0, cursive_font_family.to_glib_none().0); + ffi::webkit_settings_set_cursive_font_family(self.as_ref().to_glib_none().0, cursive_font_family.to_glib_none().0); } } fn set_default_charset(&self, default_charset: &str) { unsafe { - ffi::webkit_settings_set_default_charset(self.to_glib_none().0, default_charset.to_glib_none().0); + ffi::webkit_settings_set_default_charset(self.as_ref().to_glib_none().0, default_charset.to_glib_none().0); } } fn set_default_font_family(&self, default_font_family: &str) { unsafe { - ffi::webkit_settings_set_default_font_family(self.to_glib_none().0, default_font_family.to_glib_none().0); + ffi::webkit_settings_set_default_font_family(self.as_ref().to_glib_none().0, default_font_family.to_glib_none().0); } } fn set_default_font_size(&self, font_size: u32) { unsafe { - ffi::webkit_settings_set_default_font_size(self.to_glib_none().0, font_size); + ffi::webkit_settings_set_default_font_size(self.as_ref().to_glib_none().0, font_size); } } fn set_default_monospace_font_size(&self, font_size: u32) { unsafe { - ffi::webkit_settings_set_default_monospace_font_size(self.to_glib_none().0, font_size); + ffi::webkit_settings_set_default_monospace_font_size(self.as_ref().to_glib_none().0, font_size); } } fn set_draw_compositing_indicators(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_draw_compositing_indicators(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_draw_compositing_indicators(self.as_ref().to_glib_none().0, enabled.to_glib()); } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn set_enable_accelerated_2d_canvas(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_accelerated_2d_canvas(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_accelerated_2d_canvas(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_caret_browsing(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_caret_browsing(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_caret_browsing(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_developer_extras(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_developer_extras(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_developer_extras(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_dns_prefetching(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_dns_prefetching(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_dns_prefetching(self.as_ref().to_glib_none().0, enabled.to_glib()); } } #[cfg(any(feature = "v2_20", feature = "dox"))] fn set_enable_encrypted_media(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_encrypted_media(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_encrypted_media(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_frame_flattening(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_frame_flattening(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_frame_flattening(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_fullscreen(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_fullscreen(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_fullscreen(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_html5_database(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_html5_database(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_html5_database(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_html5_local_storage(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_html5_local_storage(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_html5_local_storage(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_hyperlink_auditing(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_hyperlink_auditing(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_hyperlink_auditing(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_java(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_java(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_java(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_javascript(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_javascript(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_javascript(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 { - ffi::webkit_settings_set_enable_media_stream(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_media_stream(self.as_ref().to_glib_none().0, enabled.to_glib()); } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn set_enable_mediasource(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_mediasource(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_mediasource(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_offline_web_application_cache(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_offline_web_application_cache(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_offline_web_application_cache(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_page_cache(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_page_cache(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_page_cache(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_plugins(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_plugins(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_plugins(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_private_browsing(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_private_browsing(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_private_browsing(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_resizable_text_areas(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_resizable_text_areas(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_resizable_text_areas(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_site_specific_quirks(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_site_specific_quirks(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_site_specific_quirks(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_smooth_scrolling(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_smooth_scrolling(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_smooth_scrolling(self.as_ref().to_glib_none().0, enabled.to_glib()); } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn set_enable_spatial_navigation(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_spatial_navigation(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_spatial_navigation(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_tabs_to_links(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_tabs_to_links(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_tabs_to_links(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_webaudio(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_webaudio(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_webaudio(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_webgl(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_webgl(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_webgl(self.as_ref().to_glib_none().0, enabled.to_glib()); } } #[cfg(any(feature = "v2_2", feature = "dox"))] fn set_enable_write_console_messages_to_stdout(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_write_console_messages_to_stdout(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_write_console_messages_to_stdout(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_enable_xss_auditor(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_enable_xss_auditor(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_enable_xss_auditor(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_fantasy_font_family(&self, fantasy_font_family: &str) { unsafe { - ffi::webkit_settings_set_fantasy_font_family(self.to_glib_none().0, fantasy_font_family.to_glib_none().0); + ffi::webkit_settings_set_fantasy_font_family(self.as_ref().to_glib_none().0, fantasy_font_family.to_glib_none().0); } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn set_hardware_acceleration_policy(&self, policy: HardwareAccelerationPolicy) { unsafe { - ffi::webkit_settings_set_hardware_acceleration_policy(self.to_glib_none().0, policy.to_glib()); + ffi::webkit_settings_set_hardware_acceleration_policy(self.as_ref().to_glib_none().0, policy.to_glib()); } } fn set_javascript_can_access_clipboard(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_javascript_can_access_clipboard(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_javascript_can_access_clipboard(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_javascript_can_open_windows_automatically(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_javascript_can_open_windows_automatically(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_javascript_can_open_windows_automatically(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_load_icons_ignoring_image_load_setting(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_load_icons_ignoring_image_load_setting(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_load_icons_ignoring_image_load_setting(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_media_playback_allows_inline(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_media_playback_allows_inline(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_media_playback_allows_inline(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_media_playback_requires_user_gesture(&self, enabled: bool) { unsafe { - ffi::webkit_settings_set_media_playback_requires_user_gesture(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_settings_set_media_playback_requires_user_gesture(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_minimum_font_size(&self, font_size: u32) { unsafe { - ffi::webkit_settings_set_minimum_font_size(self.to_glib_none().0, font_size); + ffi::webkit_settings_set_minimum_font_size(self.as_ref().to_glib_none().0, font_size); } } fn set_monospace_font_family(&self, monospace_font_family: &str) { unsafe { - ffi::webkit_settings_set_monospace_font_family(self.to_glib_none().0, monospace_font_family.to_glib_none().0); + ffi::webkit_settings_set_monospace_font_family(self.as_ref().to_glib_none().0, monospace_font_family.to_glib_none().0); } } fn set_pictograph_font_family(&self, pictograph_font_family: &str) { unsafe { - ffi::webkit_settings_set_pictograph_font_family(self.to_glib_none().0, pictograph_font_family.to_glib_none().0); + ffi::webkit_settings_set_pictograph_font_family(self.as_ref().to_glib_none().0, pictograph_font_family.to_glib_none().0); } } fn set_print_backgrounds(&self, print_backgrounds: bool) { unsafe { - ffi::webkit_settings_set_print_backgrounds(self.to_glib_none().0, print_backgrounds.to_glib()); + ffi::webkit_settings_set_print_backgrounds(self.as_ref().to_glib_none().0, print_backgrounds.to_glib()); } } fn set_sans_serif_font_family(&self, sans_serif_font_family: &str) { unsafe { - ffi::webkit_settings_set_sans_serif_font_family(self.to_glib_none().0, sans_serif_font_family.to_glib_none().0); + ffi::webkit_settings_set_sans_serif_font_family(self.as_ref().to_glib_none().0, sans_serif_font_family.to_glib_none().0); } } fn set_serif_font_family(&self, serif_font_family: &str) { unsafe { - ffi::webkit_settings_set_serif_font_family(self.to_glib_none().0, serif_font_family.to_glib_none().0); + ffi::webkit_settings_set_serif_font_family(self.as_ref().to_glib_none().0, serif_font_family.to_glib_none().0); } } fn set_user_agent<'a, P: Into>>(&self, user_agent: P) { let user_agent = user_agent.into(); - let user_agent = user_agent.to_glib_none(); unsafe { - ffi::webkit_settings_set_user_agent(self.to_glib_none().0, user_agent.0); + 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_name = application_name.to_glib_none(); let application_version = application_version.into(); - let application_version = application_version.to_glib_none(); unsafe { - ffi::webkit_settings_set_user_agent_with_application_details(self.to_glib_none().0, application_name.0, application_version.0); + 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); } } fn set_zoom_text_only(&self, zoom_text_only: bool) { unsafe { - ffi::webkit_settings_set_zoom_text_only(self.to_glib_none().0, zoom_text_only.to_glib()); + ffi::webkit_settings_set_zoom_text_only(self.as_ref().to_glib_none().0, zoom_text_only.to_glib()); } } @@ -1066,7 +1063,7 @@ impl + IsA> SettingsExt for O { fn connect_property_allow_file_access_from_file_urls_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::allow-file-access-from-file-urls", + 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 _) } } @@ -1074,7 +1071,7 @@ impl + IsA> SettingsExt for O { fn connect_property_allow_modal_dialogs_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::allow-modal-dialogs", + 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 _) } } @@ -1083,7 +1080,7 @@ impl + IsA> SettingsExt for O { fn connect_property_allow_universal_access_from_file_urls_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::allow-universal-access-from-file-urls", + 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 _) } } @@ -1091,7 +1088,7 @@ impl + IsA> SettingsExt for O { fn connect_property_auto_load_images_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::auto-load-images", + 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 _) } } @@ -1099,7 +1096,7 @@ impl + IsA> SettingsExt for O { fn connect_property_cursive_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::cursive-font-family", + 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 _) } } @@ -1107,7 +1104,7 @@ impl + IsA> SettingsExt for O { fn connect_property_default_charset_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::default-charset", + 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 _) } } @@ -1115,7 +1112,7 @@ impl + IsA> SettingsExt for O { fn connect_property_default_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::default-font-family", + 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 _) } } @@ -1123,7 +1120,7 @@ impl + IsA> SettingsExt for O { fn connect_property_default_font_size_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::default-font-size", + 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 _) } } @@ -1131,7 +1128,7 @@ impl + IsA> SettingsExt for O { fn connect_property_default_monospace_font_size_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::default-monospace-font-size", + 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 _) } } @@ -1139,7 +1136,7 @@ impl + IsA> SettingsExt for O { fn connect_property_draw_compositing_indicators_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::draw-compositing-indicators", + 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 _) } } @@ -1148,7 +1145,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_accelerated_2d_canvas_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-accelerated-2d-canvas", + 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 _) } } @@ -1156,7 +1153,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_caret_browsing_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-caret-browsing", + 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 _) } } @@ -1164,7 +1161,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_developer_extras_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-developer-extras", + 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 _) } } @@ -1172,7 +1169,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_dns_prefetching_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-dns-prefetching", + 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 _) } } @@ -1181,7 +1178,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_encrypted_media_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-encrypted-media", + 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 _) } } @@ -1189,7 +1186,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_frame_flattening_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-frame-flattening", + 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 _) } } @@ -1197,7 +1194,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_fullscreen_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-fullscreen", + 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 _) } } @@ -1205,7 +1202,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_html5_database_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-html5-database", + 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 _) } } @@ -1213,7 +1210,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_html5_local_storage_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-html5-local-storage", + 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 _) } } @@ -1221,7 +1218,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_hyperlink_auditing_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-hyperlink-auditing", + 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 _) } } @@ -1229,7 +1226,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_java_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-java", + 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 _) } } @@ -1237,7 +1234,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_javascript_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-javascript", + 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 _) } } @@ -1246,7 +1243,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_media_stream_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-media-stream", + 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 _) } } @@ -1255,7 +1252,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_mediasource_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-mediasource", + 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 _) } } @@ -1263,7 +1260,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_offline_web_application_cache_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-offline-web-application-cache", + 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 _) } } @@ -1271,7 +1268,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_page_cache_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-page-cache", + 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 _) } } @@ -1279,7 +1276,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_plugins_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-plugins", + 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 _) } } @@ -1287,7 +1284,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_private_browsing_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-private-browsing", + 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 _) } } @@ -1295,7 +1292,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_resizable_text_areas_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-resizable-text-areas", + 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 _) } } @@ -1303,7 +1300,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_site_specific_quirks_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-site-specific-quirks", + 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 _) } } @@ -1311,7 +1308,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_smooth_scrolling_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-smooth-scrolling", + 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 _) } } @@ -1320,7 +1317,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_spatial_navigation_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-spatial-navigation", + 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 _) } } @@ -1328,7 +1325,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_tabs_to_links_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-tabs-to-links", + 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 _) } } @@ -1336,7 +1333,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_webaudio_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-webaudio", + 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 _) } } @@ -1344,7 +1341,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_webgl_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-webgl", + 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 _) } } @@ -1353,7 +1350,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_write_console_messages_to_stdout_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-write-console-messages-to-stdout", + 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 _) } } @@ -1361,7 +1358,7 @@ impl + IsA> SettingsExt for O { fn connect_property_enable_xss_auditor_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::enable-xss-auditor", + 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 _) } } @@ -1369,7 +1366,7 @@ impl + IsA> SettingsExt for O { fn connect_property_fantasy_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::fantasy-font-family", + 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 _) } } @@ -1378,7 +1375,7 @@ impl + IsA> SettingsExt for O { fn connect_property_hardware_acceleration_policy_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::hardware-acceleration-policy", + 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 _) } } @@ -1386,7 +1383,7 @@ impl + IsA> SettingsExt for O { fn connect_property_javascript_can_access_clipboard_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::javascript-can-access-clipboard", + 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 _) } } @@ -1394,7 +1391,7 @@ impl + IsA> SettingsExt for O { fn connect_property_javascript_can_open_windows_automatically_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::javascript-can-open-windows-automatically", + 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 _) } } @@ -1402,7 +1399,7 @@ impl + IsA> SettingsExt for O { fn connect_property_load_icons_ignoring_image_load_setting_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::load-icons-ignoring-image-load-setting", + 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 _) } } @@ -1410,7 +1407,7 @@ impl + IsA> SettingsExt for O { fn connect_property_media_playback_allows_inline_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::media-playback-allows-inline", + 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 _) } } @@ -1418,7 +1415,7 @@ impl + IsA> SettingsExt for O { fn connect_property_media_playback_requires_user_gesture_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::media-playback-requires-user-gesture", + 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 _) } } @@ -1426,7 +1423,7 @@ impl + IsA> SettingsExt for O { fn connect_property_minimum_font_size_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::minimum-font-size", + 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 _) } } @@ -1434,7 +1431,7 @@ impl + IsA> SettingsExt for O { fn connect_property_monospace_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::monospace-font-family", + 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 _) } } @@ -1442,7 +1439,7 @@ impl + IsA> SettingsExt for O { fn connect_property_pictograph_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::pictograph-font-family", + 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 _) } } @@ -1450,7 +1447,7 @@ impl + IsA> SettingsExt for O { fn connect_property_print_backgrounds_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::print-backgrounds", + 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 _) } } @@ -1458,7 +1455,7 @@ impl + IsA> SettingsExt for O { fn connect_property_sans_serif_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::sans-serif-font-family", + 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 _) } } @@ -1466,7 +1463,7 @@ impl + IsA> SettingsExt for O { fn connect_property_serif_font_family_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::serif-font-family", + 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 _) } } @@ -1474,7 +1471,7 @@ impl + IsA> SettingsExt for O { fn connect_property_user_agent_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::user-agent", + 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 _) } } @@ -1482,7 +1479,7 @@ impl + IsA> SettingsExt for O { fn connect_property_zoom_text_only_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::zoom-text-only", + 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 _) } } @@ -1492,319 +1489,325 @@ impl + IsA> SettingsExt for O { 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); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&Settings::from_glib_borrow(this).downcast_unchecked()) + f(&Settings::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for Settings { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Settings") + } } diff --git a/src/auto/uri_request.rs b/src/auto/uri_request.rs index 124299fc..d7cbd96e 100644 --- a/src/auto/uri_request.rs +++ b/src/auto/uri_request.rs @@ -3,21 +3,19 @@ // DO NOT EDIT use ffi; -use glib; -use glib::object::Downcast; +use glib::GString; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; -use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct URIRequest(Object); + pub struct URIRequest(Object); match fn { get_type => || ffi::webkit_uri_request_get_type(), @@ -33,47 +31,49 @@ impl URIRequest { } } -pub trait URIRequestExt { +pub const NONE_URI_REQUEST: Option<&URIRequest> = None; + +pub trait URIRequestExt: 'static { //fn get_http_headers(&self) -> /*Ignored*/Option; #[cfg(any(feature = "v2_12", feature = "dox"))] - fn get_http_method(&self) -> Option; + fn get_http_method(&self) -> Option; - fn get_uri(&self) -> Option; + fn get_uri(&self) -> Option; fn set_uri(&self, uri: &str); fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> URIRequestExt for O { +impl> URIRequestExt for O { //fn get_http_headers(&self) -> /*Ignored*/Option { // unsafe { TODO: call ffi::webkit_uri_request_get_http_headers() } //} #[cfg(any(feature = "v2_12", feature = "dox"))] - fn get_http_method(&self) -> Option { + fn get_http_method(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_uri_request_get_http_method(self.to_glib_none().0)) + from_glib_none(ffi::webkit_uri_request_get_http_method(self.as_ref().to_glib_none().0)) } } - fn get_uri(&self) -> Option { + fn get_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_uri_request_get_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_uri_request_get_uri(self.as_ref().to_glib_none().0)) } } fn set_uri(&self, uri: &str) { unsafe { - ffi::webkit_uri_request_set_uri(self.to_glib_none().0, uri.to_glib_none().0); + ffi::webkit_uri_request_set_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0); } } fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::uri", + 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 _) } } @@ -82,5 +82,11 @@ impl + IsA> URIRequestExt for O { 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); - f(&URIRequest::from_glib_borrow(this).downcast_unchecked()) + f(&URIRequest::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for URIRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "URIRequest") + } } diff --git a/src/auto/uri_response.rs b/src/auto/uri_response.rs index 9554278a..f93f72d9 100644 --- a/src/auto/uri_response.rs +++ b/src/auto/uri_response.rs @@ -3,40 +3,40 @@ // DO NOT EDIT use ffi; -use glib; -use glib::object::Downcast; +use glib::GString; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; -use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct URIResponse(Object); + pub struct URIResponse(Object); match fn { get_type => || ffi::webkit_uri_response_get_type(), } } -pub trait URIResponseExt { +pub const NONE_URI_RESPONSE: Option<&URIResponse> = None; + +pub trait URIResponseExt: 'static { fn get_content_length(&self) -> u64; //#[cfg(any(feature = "v2_6", feature = "dox"))] //fn get_http_headers(&self) -> /*Ignored*/Option; - fn get_mime_type(&self) -> Option; + fn get_mime_type(&self) -> Option; fn get_status_code(&self) -> u32; - fn get_suggested_filename(&self) -> Option; + fn get_suggested_filename(&self) -> Option; - fn get_uri(&self) -> Option; + fn get_uri(&self) -> Option; fn connect_property_content_length_notify(&self, f: F) -> SignalHandlerId; @@ -52,10 +52,10 @@ pub trait URIResponseExt { fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> URIResponseExt for O { +impl> URIResponseExt for O { fn get_content_length(&self) -> u64 { unsafe { - ffi::webkit_uri_response_get_content_length(self.to_glib_none().0) + ffi::webkit_uri_response_get_content_length(self.as_ref().to_glib_none().0) } } @@ -64,34 +64,34 @@ impl + IsA> URIResponseExt for O { // unsafe { TODO: call ffi::webkit_uri_response_get_http_headers() } //} - fn get_mime_type(&self) -> Option { + fn get_mime_type(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_uri_response_get_mime_type(self.to_glib_none().0)) + from_glib_none(ffi::webkit_uri_response_get_mime_type(self.as_ref().to_glib_none().0)) } } fn get_status_code(&self) -> u32 { unsafe { - ffi::webkit_uri_response_get_status_code(self.to_glib_none().0) + ffi::webkit_uri_response_get_status_code(self.as_ref().to_glib_none().0) } } - fn get_suggested_filename(&self) -> Option { + fn get_suggested_filename(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_uri_response_get_suggested_filename(self.to_glib_none().0)) + from_glib_none(ffi::webkit_uri_response_get_suggested_filename(self.as_ref().to_glib_none().0)) } } - fn get_uri(&self) -> Option { + fn get_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_uri_response_get_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_uri_response_get_uri(self.as_ref().to_glib_none().0)) } } fn connect_property_content_length_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::content-length", + 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 _) } } @@ -100,7 +100,7 @@ impl + IsA> URIResponseExt for O { fn connect_property_http_headers_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::http-headers", + 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 _) } } @@ -108,7 +108,7 @@ impl + IsA> URIResponseExt for O { fn connect_property_mime_type_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::mime-type", + 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 _) } } @@ -116,7 +116,7 @@ impl + IsA> URIResponseExt for O { fn connect_property_status_code_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::status-code", + 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 _) } } @@ -124,7 +124,7 @@ impl + IsA> URIResponseExt for O { fn connect_property_suggested_filename_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::suggested-filename", + 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 _) } } @@ -132,7 +132,7 @@ impl + IsA> URIResponseExt for O { fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::uri", + 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 _) } } @@ -141,36 +141,42 @@ impl + IsA> URIResponseExt for O { 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); - f(&URIResponse::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&URIResponse::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&URIResponse::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&URIResponse::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&URIResponse::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&URIResponse::from_glib_borrow(this).downcast_unchecked()) + f(&URIResponse::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for URIResponse { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "URIResponse") + } } diff --git a/src/auto/uri_scheme_request.rs b/src/auto/uri_scheme_request.rs index addfb29f..b27058c6 100644 --- a/src/auto/uri_scheme_request.rs +++ b/src/auto/uri_scheme_request.rs @@ -6,32 +6,32 @@ use Error; use WebView; use ffi; +use glib::GString; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct URISchemeRequest(Object); + pub struct URISchemeRequest(Object); match fn { get_type => || ffi::webkit_uri_scheme_request_get_type(), } } -pub trait URISchemeRequestExt { +pub const NONE_URI_SCHEME_REQUEST: Option<&URISchemeRequest> = None; + +pub trait URISchemeRequestExt: 'static { //fn finish<'a, P: IsA, Q: Into>>(&self, stream: &P, stream_length: i64, mime_type: Q); #[cfg(any(feature = "v2_2", feature = "dox"))] fn finish_error(&self, error: &mut Error); - fn get_path(&self) -> Option; + fn get_path(&self) -> Option; - fn get_scheme(&self) -> Option; + fn get_scheme(&self) -> Option; - fn get_uri(&self) -> Option; + fn get_uri(&self) -> Option; fn get_web_view(&self) -> Option; } @@ -44,31 +44,37 @@ impl> URISchemeRequestExt for O { #[cfg(any(feature = "v2_2", feature = "dox"))] fn finish_error(&self, error: &mut Error) { unsafe { - ffi::webkit_uri_scheme_request_finish_error(self.to_glib_none().0, error.to_glib_none_mut().0); + ffi::webkit_uri_scheme_request_finish_error(self.as_ref().to_glib_none().0, error.to_glib_none_mut().0); } } - fn get_path(&self) -> Option { + fn get_path(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_uri_scheme_request_get_path(self.to_glib_none().0)) + from_glib_none(ffi::webkit_uri_scheme_request_get_path(self.as_ref().to_glib_none().0)) } } - fn get_scheme(&self) -> Option { + fn get_scheme(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_uri_scheme_request_get_scheme(self.to_glib_none().0)) + from_glib_none(ffi::webkit_uri_scheme_request_get_scheme(self.as_ref().to_glib_none().0)) } } - fn get_uri(&self) -> Option { + fn get_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_uri_scheme_request_get_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_uri_scheme_request_get_uri(self.as_ref().to_glib_none().0)) } } fn get_web_view(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_uri_scheme_request_get_web_view(self.to_glib_none().0)) + from_glib_none(ffi::webkit_uri_scheme_request_get_web_view(self.as_ref().to_glib_none().0)) } } } + +impl fmt::Display for URISchemeRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "URISchemeRequest") + } +} diff --git a/src/auto/user_content_manager.rs b/src/auto/user_content_manager.rs index 8f002b79..5cff8071 100644 --- a/src/auto/user_content_manager.rs +++ b/src/auto/user_content_manager.rs @@ -9,26 +9,24 @@ use UserScript; #[cfg(any(feature = "v2_6", feature = "dox"))] use UserStyleSheet; use ffi; -use glib; #[cfg(any(feature = "v2_8", feature = "dox"))] -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; #[cfg(any(feature = "v2_8", feature = "dox"))] use glib::signal::SignalHandlerId; #[cfg(any(feature = "v2_8", feature = "dox"))] -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; +#[cfg(any(feature = "v2_8", feature = "dox"))] use glib_ffi; -use gobject_ffi; #[cfg(any(feature = "v2_8", feature = "dox"))] use std::boxed::Box as Box_; -use std::mem; +use std::fmt; #[cfg(any(feature = "v2_8", feature = "dox"))] use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct UserContentManager(Object); + pub struct UserContentManager(Object); match fn { get_type => || ffi::webkit_user_content_manager_get_type(), @@ -52,7 +50,9 @@ impl Default for UserContentManager { } } -pub trait UserContentManagerExt { +pub const NONE_USER_CONTENT_MANAGER: Option<&UserContentManager> = None; + +pub trait UserContentManagerExt: 'static { #[cfg(any(feature = "v2_6", feature = "dox"))] fn add_script(&self, script: &UserScript); @@ -75,46 +75,46 @@ pub trait UserContentManagerExt { fn connect_script_message_received(&self, f: F) -> SignalHandlerId; } -impl + IsA> UserContentManagerExt for O { +impl> UserContentManagerExt for O { #[cfg(any(feature = "v2_6", feature = "dox"))] fn add_script(&self, script: &UserScript) { unsafe { - ffi::webkit_user_content_manager_add_script(self.to_glib_none().0, script.to_glib_none().0); + ffi::webkit_user_content_manager_add_script(self.as_ref().to_glib_none().0, script.to_glib_none().0); } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn add_style_sheet(&self, stylesheet: &UserStyleSheet) { unsafe { - ffi::webkit_user_content_manager_add_style_sheet(self.to_glib_none().0, stylesheet.to_glib_none().0); + ffi::webkit_user_content_manager_add_style_sheet(self.as_ref().to_glib_none().0, stylesheet.to_glib_none().0); } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn register_script_message_handler(&self, name: &str) -> bool { unsafe { - from_glib(ffi::webkit_user_content_manager_register_script_message_handler(self.to_glib_none().0, name.to_glib_none().0)) + from_glib(ffi::webkit_user_content_manager_register_script_message_handler(self.as_ref().to_glib_none().0, name.to_glib_none().0)) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn remove_all_scripts(&self) { unsafe { - ffi::webkit_user_content_manager_remove_all_scripts(self.to_glib_none().0); + ffi::webkit_user_content_manager_remove_all_scripts(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn remove_all_style_sheets(&self) { unsafe { - ffi::webkit_user_content_manager_remove_all_style_sheets(self.to_glib_none().0); + ffi::webkit_user_content_manager_remove_all_style_sheets(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn unregister_script_message_handler(&self, name: &str) { unsafe { - ffi::webkit_user_content_manager_unregister_script_message_handler(self.to_glib_none().0, name.to_glib_none().0); + ffi::webkit_user_content_manager_unregister_script_message_handler(self.as_ref().to_glib_none().0, name.to_glib_none().0); } } @@ -122,7 +122,7 @@ impl + IsA> UserContentManagerE fn connect_script_message_received(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "script-message-received", + 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 _) } } @@ -132,5 +132,11 @@ impl + IsA> UserContentManagerE 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); - f(&UserContentManager::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(js_result)) + f(&UserContentManager::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(js_result)) +} + +impl fmt::Display for UserContentManager { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "UserContentManager") + } } diff --git a/src/auto/user_media_permission_request.rs b/src/auto/user_media_permission_request.rs index 39f46860..17fd39bd 100644 --- a/src/auto/user_media_permission_request.rs +++ b/src/auto/user_media_permission_request.rs @@ -4,30 +4,30 @@ use PermissionRequest; use ffi; -use glib; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct UserMediaPermissionRequest(Object): PermissionRequest; + pub struct UserMediaPermissionRequest(Object) @implements PermissionRequest; match fn { get_type => || ffi::webkit_user_media_permission_request_get_type(), } } -pub trait UserMediaPermissionRequestExt { +pub const NONE_USER_MEDIA_PERMISSION_REQUEST: Option<&UserMediaPermissionRequest> = None; + +pub trait UserMediaPermissionRequestExt: 'static { fn get_property_is_for_audio_device(&self) -> bool; fn get_property_is_for_video_device(&self) -> bool; @@ -37,11 +37,11 @@ pub trait UserMediaPermissionRequestExt { fn connect_property_is_for_video_device_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> UserMediaPermissionRequestExt for O { +impl> UserMediaPermissionRequestExt for O { fn get_property_is_for_audio_device(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "is-for-audio-device".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"is-for-audio-device\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -49,7 +49,7 @@ impl + IsA> UserMediaPe fn get_property_is_for_video_device(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "is-for-video-device".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"is-for-video-device\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -57,7 +57,7 @@ impl + IsA> UserMediaPe fn connect_property_is_for_audio_device_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::is-for-audio-device", + 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 _) } } @@ -65,7 +65,7 @@ impl + IsA> UserMediaPe fn connect_property_is_for_video_device_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::is-for-video-device", + 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 _) } } @@ -74,11 +74,17 @@ impl + IsA> UserMediaPe 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); - f(&UserMediaPermissionRequest::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&UserMediaPermissionRequest::from_glib_borrow(this).downcast_unchecked()) + f(&UserMediaPermissionRequest::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for UserMediaPermissionRequest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "UserMediaPermissionRequest") + } } diff --git a/src/auto/user_script.rs b/src/auto/user_script.rs index 1e42a713..de328292 100644 --- a/src/auto/user_script.rs +++ b/src/auto/user_script.rs @@ -7,11 +7,10 @@ use UserContentInjectedFrames; #[cfg(any(feature = "v2_6", feature = "dox"))] use UserScriptInjectionTime; use ffi; +#[cfg(any(feature = "v2_6", feature = "dox"))] +use glib::GString; +#[cfg(any(feature = "v2_6", feature = "dox"))] use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/src/auto/user_style_sheet.rs b/src/auto/user_style_sheet.rs index e6b57b40..eb154b95 100644 --- a/src/auto/user_style_sheet.rs +++ b/src/auto/user_style_sheet.rs @@ -7,11 +7,10 @@ use UserContentInjectedFrames; #[cfg(any(feature = "v2_6", feature = "dox"))] use UserStyleLevel; use ffi; +#[cfg(any(feature = "v2_6", feature = "dox"))] +use glib::GString; +#[cfg(any(feature = "v2_6", feature = "dox"))] use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/src/auto/versions.txt b/src/auto/versions.txt index 6875f574..695e80f6 100644 --- a/src/auto/versions.txt +++ b/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c385982) -from gir-files (https://github.com/gtk-rs/gir-files @ a08aa4c) +Generated by gir (https://github.com/gtk-rs/gir @ 2f0a317) +from gir-files (https://github.com/gtk-rs/gir-files @ 62f3bf0) diff --git a/src/auto/web_context.rs b/src/auto/web_context.rs index dd180b40..50121e46 100644 --- a/src/auto/web_context.rs +++ b/src/auto/web_context.rs @@ -21,25 +21,27 @@ use ffi; use futures_core; use gio; use gio_ffi; +#[cfg(any(feature = "v2_4", feature = "dox"))] use glib; +use glib::GString; #[cfg(any(feature = "v2_8", feature = "dox"))] use glib::StaticType; #[cfg(any(feature = "v2_8", feature = "dox"))] use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct WebContext(Object); + pub struct WebContext(Object); match fn { get_type => || ffi::webkit_web_context_get_type(), @@ -64,10 +66,10 @@ impl WebContext { } #[cfg(any(feature = "v2_10", feature = "dox"))] - pub fn new_with_website_data_manager(manager: &WebsiteDataManager) -> WebContext { + pub fn new_with_website_data_manager>(manager: &P) -> WebContext { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::webkit_web_context_new_with_website_data_manager(manager.to_glib_none().0)) + from_glib_full(ffi::webkit_web_context_new_with_website_data_manager(manager.as_ref().to_glib_none().0)) } } @@ -86,9 +88,11 @@ impl Default for WebContext { } } -pub trait WebContextExt: Sized { +pub const NONE_WEB_CONTEXT: Option<&WebContext> = None; + +pub trait WebContextExt: 'static { #[cfg(any(feature = "v2_6", feature = "dox"))] - fn allow_tls_certificate_for_host(&self, certificate: &gio::TlsCertificate, host: &str); + fn allow_tls_certificate_for_host>(&self, certificate: &P, host: &str); fn clear_cache(&self); @@ -100,12 +104,12 @@ pub trait WebContextExt: Sized { fn get_favicon_database(&self) -> Option; - fn get_favicon_database_directory(&self) -> Option; + fn get_favicon_database_directory(&self) -> Option; - fn get_plugins<'a, P: Into>, Q: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: P, callback: Q); + fn get_plugins<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: Q, callback: R); #[cfg(feature = "futures")] - fn get_plugins_future(&self) -> Box_), Error = (Self, Error)>>; + fn get_plugins_future(&self) -> Box_), Error = (Self, Error)>> where Self: Sized + Clone; #[cfg(any(feature = "v2_4", feature = "dox"))] fn get_process_model(&self) -> ProcessModel; @@ -114,7 +118,7 @@ pub trait WebContextExt: Sized { fn get_spell_checking_enabled(&self) -> bool; - fn get_spell_checking_languages(&self) -> Vec; + fn get_spell_checking_languages(&self) -> Vec; fn get_tls_errors_policy(&self) -> TLSErrorsPolicy; @@ -170,7 +174,7 @@ pub trait WebContextExt: Sized { #[cfg_attr(feature = "v2_10", deprecated)] #[cfg(any(feature = "v2_8", feature = "dox"))] - fn get_property_local_storage_directory(&self) -> Option; + fn get_property_local_storage_directory(&self) -> Option; //#[cfg(any(feature = "v2_18", feature = "dox"))] //fn connect_automation_started(&self, f: F) -> SignalHandlerId; @@ -184,70 +188,69 @@ pub trait WebContextExt: Sized { fn connect_initialize_web_extensions(&self, f: F) -> SignalHandlerId; } -impl + IsA + Clone + 'static> WebContextExt for O { +impl> WebContextExt for O { #[cfg(any(feature = "v2_6", feature = "dox"))] - fn allow_tls_certificate_for_host(&self, certificate: &gio::TlsCertificate, host: &str) { + fn allow_tls_certificate_for_host>(&self, certificate: &P, host: &str) { unsafe { - ffi::webkit_web_context_allow_tls_certificate_for_host(self.to_glib_none().0, certificate.to_glib_none().0, host.to_glib_none().0); + ffi::webkit_web_context_allow_tls_certificate_for_host(self.as_ref().to_glib_none().0, certificate.as_ref().to_glib_none().0, host.to_glib_none().0); } } fn clear_cache(&self) { unsafe { - ffi::webkit_web_context_clear_cache(self.to_glib_none().0); + ffi::webkit_web_context_clear_cache(self.as_ref().to_glib_none().0); } } fn download_uri(&self, uri: &str) -> Option { unsafe { - from_glib_full(ffi::webkit_web_context_download_uri(self.to_glib_none().0, uri.to_glib_none().0)) + from_glib_full(ffi::webkit_web_context_download_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0)) } } fn get_cache_model(&self) -> CacheModel { unsafe { - from_glib(ffi::webkit_web_context_get_cache_model(self.to_glib_none().0)) + from_glib(ffi::webkit_web_context_get_cache_model(self.as_ref().to_glib_none().0)) } } fn get_cookie_manager(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_context_get_cookie_manager(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_context_get_cookie_manager(self.as_ref().to_glib_none().0)) } } fn get_favicon_database(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_context_get_favicon_database(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_context_get_favicon_database(self.as_ref().to_glib_none().0)) } } - fn get_favicon_database_directory(&self) -> Option { + fn get_favicon_database_directory(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_context_get_favicon_database_directory(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_context_get_favicon_database_directory(self.as_ref().to_glib_none().0)) } } - fn get_plugins<'a, P: Into>, Q: FnOnce(Result, Error>) + Send + 'static>(&self, cancellable: P, callback: Q) { + 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 cancellable = cancellable.to_glib_none(); - 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) + 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) { 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.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + 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 _); } } #[cfg(feature = "futures")] - fn get_plugins_future(&self) -> Box_), Error = (Self, Error)>> { + fn get_plugins_future(&self) -> Box_), Error = (Self, Error)>> where Self: Sized + Clone { use gio::GioFuture; use fragile::Fragile; @@ -271,72 +274,72 @@ impl + IsA + Clone + 'static> WebContex #[cfg(any(feature = "v2_4", feature = "dox"))] fn get_process_model(&self) -> ProcessModel { unsafe { - from_glib(ffi::webkit_web_context_get_process_model(self.to_glib_none().0)) + from_glib(ffi::webkit_web_context_get_process_model(self.as_ref().to_glib_none().0)) } } fn get_security_manager(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_context_get_security_manager(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_context_get_security_manager(self.as_ref().to_glib_none().0)) } } fn get_spell_checking_enabled(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_context_get_spell_checking_enabled(self.to_glib_none().0)) + from_glib(ffi::webkit_web_context_get_spell_checking_enabled(self.as_ref().to_glib_none().0)) } } - fn get_spell_checking_languages(&self) -> Vec { + fn get_spell_checking_languages(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::webkit_web_context_get_spell_checking_languages(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::webkit_web_context_get_spell_checking_languages(self.as_ref().to_glib_none().0)) } } fn get_tls_errors_policy(&self) -> TLSErrorsPolicy { unsafe { - from_glib(ffi::webkit_web_context_get_tls_errors_policy(self.to_glib_none().0)) + from_glib(ffi::webkit_web_context_get_tls_errors_policy(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_10", feature = "dox"))] fn get_web_process_count_limit(&self) -> u32 { unsafe { - ffi::webkit_web_context_get_web_process_count_limit(self.to_glib_none().0) + ffi::webkit_web_context_get_web_process_count_limit(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v2_10", feature = "dox"))] fn get_website_data_manager(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_context_get_website_data_manager(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_context_get_website_data_manager(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn initialize_notification_permissions(&self, allowed_origins: &[&SecurityOrigin], disallowed_origins: &[&SecurityOrigin]) { unsafe { - ffi::webkit_web_context_initialize_notification_permissions(self.to_glib_none().0, allowed_origins.to_glib_none().0, disallowed_origins.to_glib_none().0); + ffi::webkit_web_context_initialize_notification_permissions(self.as_ref().to_glib_none().0, allowed_origins.to_glib_none().0, disallowed_origins.to_glib_none().0); } } #[cfg(any(feature = "v2_18", feature = "dox"))] fn is_automation_allowed(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_context_is_automation_allowed(self.to_glib_none().0)) + from_glib(ffi::webkit_web_context_is_automation_allowed(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn is_ephemeral(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_context_is_ephemeral(self.to_glib_none().0)) + from_glib(ffi::webkit_web_context_is_ephemeral(self.as_ref().to_glib_none().0)) } } fn prefetch_dns(&self, hostname: &str) { unsafe { - ffi::webkit_web_context_prefetch_dns(self.to_glib_none().0, hostname.to_glib_none().0); + ffi::webkit_web_context_prefetch_dns(self.as_ref().to_glib_none().0, hostname.to_glib_none().0); } } @@ -346,93 +349,92 @@ impl + IsA + Clone + 'static> WebContex fn set_additional_plugins_directory(&self, directory: &str) { unsafe { - ffi::webkit_web_context_set_additional_plugins_directory(self.to_glib_none().0, directory.to_glib_none().0); + ffi::webkit_web_context_set_additional_plugins_directory(self.as_ref().to_glib_none().0, directory.to_glib_none().0); } } #[cfg(any(feature = "v2_18", feature = "dox"))] fn set_automation_allowed(&self, allowed: bool) { unsafe { - ffi::webkit_web_context_set_automation_allowed(self.to_glib_none().0, allowed.to_glib()); + ffi::webkit_web_context_set_automation_allowed(self.as_ref().to_glib_none().0, allowed.to_glib()); } } fn set_cache_model(&self, cache_model: CacheModel) { unsafe { - ffi::webkit_web_context_set_cache_model(self.to_glib_none().0, cache_model.to_glib()); + ffi::webkit_web_context_set_cache_model(self.as_ref().to_glib_none().0, cache_model.to_glib()); } } fn set_disk_cache_directory(&self, directory: &str) { unsafe { - ffi::webkit_web_context_set_disk_cache_directory(self.to_glib_none().0, directory.to_glib_none().0); + ffi::webkit_web_context_set_disk_cache_directory(self.as_ref().to_glib_none().0, directory.to_glib_none().0); } } fn set_favicon_database_directory<'a, P: Into>>(&self, path: P) { let path = path.into(); - let path = path.to_glib_none(); unsafe { - ffi::webkit_web_context_set_favicon_database_directory(self.to_glib_none().0, path.0); + ffi::webkit_web_context_set_favicon_database_directory(self.as_ref().to_glib_none().0, path.to_glib_none().0); } } fn set_preferred_languages(&self, languages: &[&str]) { unsafe { - ffi::webkit_web_context_set_preferred_languages(self.to_glib_none().0, languages.to_glib_none().0); + ffi::webkit_web_context_set_preferred_languages(self.as_ref().to_glib_none().0, languages.to_glib_none().0); } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn set_process_model(&self, process_model: ProcessModel) { unsafe { - ffi::webkit_web_context_set_process_model(self.to_glib_none().0, process_model.to_glib()); + ffi::webkit_web_context_set_process_model(self.as_ref().to_glib_none().0, process_model.to_glib()); } } fn set_spell_checking_enabled(&self, enabled: bool) { unsafe { - ffi::webkit_web_context_set_spell_checking_enabled(self.to_glib_none().0, enabled.to_glib()); + ffi::webkit_web_context_set_spell_checking_enabled(self.as_ref().to_glib_none().0, enabled.to_glib()); } } fn set_spell_checking_languages(&self, languages: &[&str]) { unsafe { - ffi::webkit_web_context_set_spell_checking_languages(self.to_glib_none().0, languages.to_glib_none().0); + ffi::webkit_web_context_set_spell_checking_languages(self.as_ref().to_glib_none().0, languages.to_glib_none().0); } } fn set_tls_errors_policy(&self, policy: TLSErrorsPolicy) { unsafe { - ffi::webkit_web_context_set_tls_errors_policy(self.to_glib_none().0, policy.to_glib()); + ffi::webkit_web_context_set_tls_errors_policy(self.as_ref().to_glib_none().0, policy.to_glib()); } } fn set_web_extensions_directory(&self, directory: &str) { unsafe { - ffi::webkit_web_context_set_web_extensions_directory(self.to_glib_none().0, directory.to_glib_none().0); + ffi::webkit_web_context_set_web_extensions_directory(self.as_ref().to_glib_none().0, directory.to_glib_none().0); } } #[cfg(any(feature = "v2_4", feature = "dox"))] fn set_web_extensions_initialization_user_data(&self, user_data: &glib::Variant) { unsafe { - ffi::webkit_web_context_set_web_extensions_initialization_user_data(self.to_glib_none().0, user_data.to_glib_none().0); + ffi::webkit_web_context_set_web_extensions_initialization_user_data(self.as_ref().to_glib_none().0, user_data.to_glib_none().0); } } #[cfg(any(feature = "v2_10", feature = "dox"))] fn set_web_process_count_limit(&self, limit: u32) { unsafe { - ffi::webkit_web_context_set_web_process_count_limit(self.to_glib_none().0, limit); + ffi::webkit_web_context_set_web_process_count_limit(self.as_ref().to_glib_none().0, limit); } } #[cfg(any(feature = "v2_8", feature = "dox"))] - fn get_property_local_storage_directory(&self) -> Option { + fn get_property_local_storage_directory(&self) -> Option { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "local-storage-directory".to_glib_none().0, value.to_glib_none_mut().0); + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"local-storage-directory\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -445,7 +447,7 @@ impl + IsA + Clone + 'static> WebContex fn connect_download_started(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "download-started", + 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 _) } } @@ -454,7 +456,7 @@ impl + IsA + Clone + 'static> WebContex fn connect_initialize_notification_permissions(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "initialize-notification-permissions", + 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 _) } } @@ -463,7 +465,7 @@ impl + IsA + Clone + 'static> WebContex fn connect_initialize_web_extensions(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "initialize-web-extensions", + 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 _) } } @@ -472,19 +474,25 @@ impl + IsA + Clone + 'static> WebContex 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); - f(&WebContext::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(download)) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebContext::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebContext::from_glib_borrow(this).downcast_unchecked()) + f(&WebContext::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for WebContext { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "WebContext") + } } diff --git a/src/auto/web_inspector.rs b/src/auto/web_inspector.rs index e190bdca..c5b95d6d 100644 --- a/src/auto/web_inspector.rs +++ b/src/auto/web_inspector.rs @@ -4,28 +4,28 @@ use WebViewBase; use ffi; -use glib; -use glib::object::Downcast; +use glib::GString; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; -use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; -use std::ptr; glib_wrapper! { - pub struct WebInspector(Object); + pub struct WebInspector(Object); match fn { get_type => || ffi::webkit_web_inspector_get_type(), } } -pub trait WebInspectorExt { +pub const NONE_WEB_INSPECTOR: Option<&WebInspector> = None; + +pub trait WebInspectorExt: 'static { fn attach(&self); fn close(&self); @@ -37,7 +37,7 @@ pub trait WebInspectorExt { #[cfg(any(feature = "v2_8", feature = "dox"))] fn get_can_attach(&self) -> bool; - fn get_inspected_uri(&self) -> Option; + fn get_inspected_uri(&self) -> Option; fn get_web_view(&self) -> Option; @@ -63,66 +63,66 @@ pub trait WebInspectorExt { fn connect_property_inspected_uri_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA> WebInspectorExt for O { +impl> WebInspectorExt for O { fn attach(&self) { unsafe { - ffi::webkit_web_inspector_attach(self.to_glib_none().0); + ffi::webkit_web_inspector_attach(self.as_ref().to_glib_none().0); } } fn close(&self) { unsafe { - ffi::webkit_web_inspector_close(self.to_glib_none().0); + ffi::webkit_web_inspector_close(self.as_ref().to_glib_none().0); } } fn detach(&self) { unsafe { - ffi::webkit_web_inspector_detach(self.to_glib_none().0); + ffi::webkit_web_inspector_detach(self.as_ref().to_glib_none().0); } } fn get_attached_height(&self) -> u32 { unsafe { - ffi::webkit_web_inspector_get_attached_height(self.to_glib_none().0) + ffi::webkit_web_inspector_get_attached_height(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn get_can_attach(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_inspector_get_can_attach(self.to_glib_none().0)) + from_glib(ffi::webkit_web_inspector_get_can_attach(self.as_ref().to_glib_none().0)) } } - fn get_inspected_uri(&self) -> Option { + fn get_inspected_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_inspector_get_inspected_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_inspector_get_inspected_uri(self.as_ref().to_glib_none().0)) } } fn get_web_view(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_inspector_get_web_view(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_inspector_get_web_view(self.as_ref().to_glib_none().0)) } } fn is_attached(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_inspector_is_attached(self.to_glib_none().0)) + from_glib(ffi::webkit_web_inspector_is_attached(self.as_ref().to_glib_none().0)) } } fn show(&self) { unsafe { - ffi::webkit_web_inspector_show(self.to_glib_none().0); + ffi::webkit_web_inspector_show(self.as_ref().to_glib_none().0); } } fn connect_attach bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "attach", + 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 _) } } @@ -130,7 +130,7 @@ impl + IsA> WebInspectorExt for O { fn connect_bring_to_front bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "bring-to-front", + 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 _) } } @@ -138,7 +138,7 @@ impl + IsA> WebInspectorExt for O { fn connect_closed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "closed", + 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 _) } } @@ -146,7 +146,7 @@ impl + IsA> WebInspectorExt for O { fn connect_detach bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "detach", + 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 _) } } @@ -154,7 +154,7 @@ impl + IsA> WebInspectorExt for O { fn connect_open_window bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "open-window", + 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 _) } } @@ -162,7 +162,7 @@ impl + IsA> WebInspectorExt for O { fn connect_property_attached_height_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::attached-height", + 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 _) } } @@ -171,7 +171,7 @@ impl + IsA> WebInspectorExt for O { fn connect_property_can_attach_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::can-attach", + 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 _) } } @@ -179,7 +179,7 @@ impl + IsA> WebInspectorExt for O { fn connect_property_inspected_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::inspected-uri", + 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 _) } } @@ -188,48 +188,54 @@ impl + IsA> WebInspectorExt for O { unsafe extern "C" fn attach_trampoline

(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) -> glib_ffi::gboolean where P: IsA { let f: &&(Fn(&P) -> bool + 'static) = transmute(f); - f(&WebInspector::from_glib_borrow(this).downcast_unchecked()).to_glib() + 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 where P: IsA { let f: &&(Fn(&P) -> bool + 'static) = transmute(f); - f(&WebInspector::from_glib_borrow(this).downcast_unchecked()).to_glib() + f(&WebInspector::from_glib_borrow(this).unsafe_cast()).to_glib() } unsafe extern "C" fn closed_trampoline

(this: *mut ffi::WebKitWebInspector, f: glib_ffi::gpointer) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebInspector::from_glib_borrow(this).downcast_unchecked()) + 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 where P: IsA { let f: &&(Fn(&P) -> bool + 'static) = transmute(f); - f(&WebInspector::from_glib_borrow(this).downcast_unchecked()).to_glib() + 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 where P: IsA { let f: &&(Fn(&P) -> bool + 'static) = transmute(f); - f(&WebInspector::from_glib_borrow(this).downcast_unchecked()).to_glib() + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebInspector::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebInspector::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebInspector::from_glib_borrow(this).downcast_unchecked()) + f(&WebInspector::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for WebInspector { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "WebInspector") + } } diff --git a/src/auto/web_resource.rs b/src/auto/web_resource.rs index 5b32acfa..fec28efa 100644 --- a/src/auto/web_resource.rs +++ b/src/auto/web_resource.rs @@ -10,36 +10,38 @@ use ffi; use futures_core; use gio; use gio_ffi; -use glib; -use glib::object::Downcast; +use glib::GString; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use std::boxed::Box as Box_; -use std::mem; +use std::fmt; use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct WebResource(Object); + pub struct WebResource(Object); match fn { get_type => || ffi::webkit_web_resource_get_type(), } } -pub trait WebResourceExt: Sized { - fn get_data<'a, P: Into>, Q: FnOnce(Result<(Vec, usize), Error>) + Send + 'static>(&self, cancellable: P, callback: Q); +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); #[cfg(feature = "futures")] - fn get_data_future(&self) -> Box_, usize)), Error = (Self, Error)>>; + fn get_data_future(&self) -> Box_, usize)), Error = (Self, Error)>> where Self: Sized + Clone; fn get_response(&self) -> Option; - fn get_uri(&self) -> Option; + fn get_uri(&self) -> Option; fn connect_failed(&self, f: F) -> SignalHandlerId; @@ -57,28 +59,27 @@ pub trait WebResourceExt: Sized { fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA + Clone + 'static> WebResourceExt for O { - fn get_data<'a, P: Into>, Q: FnOnce(Result<(Vec, usize), Error>) + Send + 'static>(&self, cancellable: P, callback: Q) { +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 cancellable = cancellable.to_glib_none(); - 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) + 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) { let mut error = ptr::null_mut(); - let mut length = mem::uninitialized(); + let mut length = ::std::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.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + 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 _); } } #[cfg(feature = "futures")] - fn get_data_future(&self) -> Box_, usize)), Error = (Self, Error)>> { + fn get_data_future(&self) -> Box_, usize)), Error = (Self, Error)>> where Self: Sized + Clone { use gio::GioFuture; use fragile::Fragile; @@ -101,20 +102,20 @@ impl + IsA + Clone + 'static> WebResou fn get_response(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_resource_get_response(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_resource_get_response(self.as_ref().to_glib_none().0)) } } - fn get_uri(&self) -> Option { + fn get_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_resource_get_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_resource_get_uri(self.as_ref().to_glib_none().0)) } } fn connect_failed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "failed", + 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 _) } } @@ -123,7 +124,7 @@ impl + IsA + Clone + 'static> WebResou fn connect_failed_with_tls_errors(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "failed-with-tls-errors", + 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 _) } } @@ -131,7 +132,7 @@ impl + IsA + Clone + 'static> WebResou fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "finished", + 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 _) } } @@ -139,7 +140,7 @@ impl + IsA + Clone + 'static> WebResou fn connect_received_data(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "received-data", + 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 _) } } @@ -147,7 +148,7 @@ impl + IsA + Clone + 'static> WebResou fn connect_sent_request(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "sent-request", + 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 _) } } @@ -155,7 +156,7 @@ impl + IsA + Clone + 'static> WebResou fn connect_property_response_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::response", + 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 _) } } @@ -163,7 +164,7 @@ impl + IsA + Clone + 'static> WebResou fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::uri", + 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 _) } } @@ -172,42 +173,48 @@ impl + IsA + Clone + 'static> WebResou 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); - f(&WebResource::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(error)) + 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) where P: IsA { let f: &&(Fn(&P, &gio::TlsCertificate, gio::TlsCertificateFlags) + 'static) = transmute(f); - f(&WebResource::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(certificate), from_glib(errors)) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebResource::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P, u64) + 'static) = transmute(f); - f(&WebResource::from_glib_borrow(this).downcast_unchecked(), data_length) + 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) where P: IsA { let f: &&(Fn(&P, &URIRequest, &URIResponse) + 'static) = transmute(f); - f(&WebResource::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(request), &from_glib_borrow(redirected_response)) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebResource::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebResource::from_glib_borrow(this).downcast_unchecked()) + f(&WebResource::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for WebResource { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "WebResource") + } } diff --git a/src/auto/web_view.rs b/src/auto/web_view.rs index 7ad09383..3bef6fd1 100644 --- a/src/auto/web_view.rs +++ b/src/auto/web_view.rs @@ -52,31 +52,31 @@ use gdk; use gdk_ffi; use gio; use gio_ffi; +#[cfg(any(feature = "v2_6", feature = "dox"))] use glib; +use glib::GString; use glib::StaticType; use glib::Value; -use glib::object::Downcast; +use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; -use glib::signal::connect; +use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use gobject_ffi; use gtk; +#[cfg(any(feature = "v2_6", feature = "dox"))] use gtk_ffi; use java_script_core; use libc; use std::boxed::Box as Box_; +use std::fmt; use std::mem; use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct WebView(Object): [ - WebViewBase, - gtk::Container => gtk_ffi::GtkContainer, - gtk::Widget => gtk_ffi::GtkWidget, - ]; + pub struct WebView(Object) @extends WebViewBase, gtk::Container, gtk::Widget; match fn { get_type => || ffi::webkit_web_view_get_type(), @@ -87,38 +87,38 @@ impl WebView { pub fn new() -> WebView { assert_initialized_main_thread!(); unsafe { - gtk::Widget::from_glib_none(ffi::webkit_web_view_new()).downcast_unchecked() + gtk::Widget::from_glib_none(ffi::webkit_web_view_new()).unsafe_cast() } } - pub fn new_with_context(context: &WebContext) -> WebView { + pub fn new_with_context>(context: &P) -> WebView { skip_assert_initialized!(); unsafe { - gtk::Widget::from_glib_none(ffi::webkit_web_view_new_with_context(context.to_glib_none().0)).downcast_unchecked() + gtk::Widget::from_glib_none(ffi::webkit_web_view_new_with_context(context.as_ref().to_glib_none().0)).unsafe_cast() } } #[cfg(any(feature = "v2_4", feature = "dox"))] - pub fn new_with_related_view(web_view: &WebView) -> WebView { + pub fn new_with_related_view>(web_view: &P) -> WebView { skip_assert_initialized!(); unsafe { - gtk::Widget::from_glib_full(ffi::webkit_web_view_new_with_related_view(web_view.to_glib_none().0)).downcast_unchecked() + gtk::Widget::from_glib_full(ffi::webkit_web_view_new_with_related_view(web_view.as_ref().to_glib_none().0)).unsafe_cast() } } #[cfg(any(feature = "v2_6", feature = "dox"))] - pub fn new_with_settings(settings: &Settings) -> WebView { + pub fn new_with_settings>(settings: &P) -> WebView { skip_assert_initialized!(); unsafe { - gtk::Widget::from_glib_none(ffi::webkit_web_view_new_with_settings(settings.to_glib_none().0)).downcast_unchecked() + gtk::Widget::from_glib_none(ffi::webkit_web_view_new_with_settings(settings.as_ref().to_glib_none().0)).unsafe_cast() } } #[cfg(any(feature = "v2_6", feature = "dox"))] - pub fn new_with_user_content_manager(user_content_manager: &UserContentManager) -> WebView { + pub fn new_with_user_content_manager>(user_content_manager: &P) -> WebView { skip_assert_initialized!(); unsafe { - gtk::Widget::from_glib_none(ffi::webkit_web_view_new_with_user_content_manager(user_content_manager.to_glib_none().0)).downcast_unchecked() + gtk::Widget::from_glib_none(ffi::webkit_web_view_new_with_user_content_manager(user_content_manager.as_ref().to_glib_none().0)).unsafe_cast() } } } @@ -129,11 +129,13 @@ impl Default for WebView { } } -pub trait WebViewExt: Sized { - fn can_execute_editing_command<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, command: &str, cancellable: P, callback: Q); +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); #[cfg(feature = "futures")] - fn can_execute_editing_command_future(&self, command: &str) -> Box_>; + fn can_execute_editing_command_future(&self, command: &str) -> Box_> where Self: Sized + Clone; fn can_go_back(&self) -> bool; @@ -155,7 +157,7 @@ pub trait WebViewExt: Sized { fn get_context(&self) -> Option; - fn get_custom_charset(&self) -> Option; + fn get_custom_charset(&self) -> Option; #[cfg(any(feature = "v2_10", feature = "dox"))] fn get_editor_state(&self) -> Option; @@ -179,16 +181,16 @@ pub trait WebViewExt: Sized { fn get_settings(&self) -> Option; - fn get_snapshot<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, region: SnapshotRegion, options: SnapshotOptions, cancellable: P, callback: Q); + fn get_snapshot<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, region: SnapshotRegion, options: SnapshotOptions, cancellable: Q, callback: R); #[cfg(feature = "futures")] - fn get_snapshot_future(&self, region: SnapshotRegion, options: SnapshotOptions) -> Box_>; + fn get_snapshot_future(&self, region: SnapshotRegion, options: SnapshotOptions) -> Box_> where Self: Sized + Clone; - fn get_title(&self) -> Option; + fn get_title(&self) -> Option; fn get_tls_info(&self) -> Option<(gio::TlsCertificate, gio::TlsCertificateFlags)>; - fn get_uri(&self) -> Option; + fn get_uri(&self) -> Option; #[cfg(any(feature = "v2_6", feature = "dox"))] fn get_user_content_manager(&self) -> Option; @@ -204,7 +206,7 @@ pub trait WebViewExt: Sized { fn go_forward(&self); - fn go_to_back_forward_list_item(&self, list_item: &BackForwardListItem); + fn go_to_back_forward_list_item>(&self, list_item: &P); #[cfg(any(feature = "v2_18", feature = "dox"))] fn is_controlled_by_automation(&self) -> bool; @@ -228,7 +230,7 @@ pub trait WebViewExt: Sized { fn load_plain_text(&self, plain_text: &str); - fn load_request(&self, request: &URIRequest); + fn load_request>(&self, request: &P); fn load_uri(&self, uri: &str); @@ -239,25 +241,25 @@ pub trait WebViewExt: Sized { #[cfg(any(feature = "v2_12", feature = "dox"))] fn restore_session_state(&self, state: &WebViewSessionState); - fn run_javascript<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, script: &str, cancellable: P, callback: Q); + fn run_javascript<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, script: &str, cancellable: Q, callback: R); #[cfg(feature = "futures")] - fn run_javascript_future(&self, script: &str) -> Box_>; + fn run_javascript_future(&self, script: &str) -> Box_> where Self: Sized + Clone; - fn run_javascript_from_gresource<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, resource: &str, cancellable: P, callback: Q); + fn run_javascript_from_gresource<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, resource: &str, cancellable: Q, callback: R); #[cfg(feature = "futures")] - fn run_javascript_from_gresource_future(&self, resource: &str) -> Box_>; + fn run_javascript_from_gresource_future(&self, resource: &str) -> Box_> where Self: Sized + Clone; - //fn save<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, save_mode: SaveMode, cancellable: P, callback: Q); + //fn save<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, save_mode: SaveMode, cancellable: Q, callback: R); //#[cfg(feature = "futures")] - //fn save_future(&self, save_mode: SaveMode) -> Box_>; + //fn save_future(&self, save_mode: SaveMode) -> Box_> where Self: Sized + Clone; - //fn save_to_file<'a, P: IsA, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, file: &P, save_mode: SaveMode, cancellable: Q, callback: R); + //fn save_to_file<'a, P: IsA, Q: IsA + 'a, R: Into>, S: FnOnce(Result<(), Error>) + Send + 'static>(&self, file: &P, save_mode: SaveMode, cancellable: R, callback: S); //#[cfg(feature = "futures")] - //fn save_to_file_future + Clone + 'static>(&self, file: &P, save_mode: SaveMode) -> Box_>; + //fn save_to_file_future + Clone + 'static>(&self, file: &P, save_mode: SaveMode) -> Box_> where Self: Sized + Clone; #[cfg(any(feature = "v2_8", feature = "dox"))] fn set_background_color(&self, rgba: &gdk::RGBA); @@ -267,7 +269,7 @@ pub trait WebViewExt: Sized { #[cfg(any(feature = "v2_8", feature = "dox"))] fn set_editable(&self, editable: bool); - fn set_settings(&self, settings: &Settings); + fn set_settings>(&self, settings: &P); fn set_zoom_level(&self, zoom_level: f64); @@ -374,27 +376,26 @@ pub trait WebViewExt: Sized { fn connect_property_zoom_level_notify(&self, f: F) -> SignalHandlerId; } -impl + IsA + Clone + 'static> WebViewExt for O { - fn can_execute_editing_command<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, command: &str, cancellable: P, callback: Q) { +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 cancellable = cancellable.to_glib_none(); - 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) + 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) { 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.to_glib_none().0, command.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + 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 _); } } #[cfg(feature = "futures")] - fn can_execute_editing_command_future(&self, command: &str) -> Box_> { + fn can_execute_editing_command_future(&self, command: &str) -> Box_> where Self: Sized + Clone { use gio::GioFuture; use fragile::Fragile; @@ -419,44 +420,44 @@ impl + IsA + Clone + 'static> WebViewExt f fn can_go_back(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_view_can_go_back(self.to_glib_none().0)) + from_glib(ffi::webkit_web_view_can_go_back(self.as_ref().to_glib_none().0)) } } fn can_go_forward(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_view_can_go_forward(self.to_glib_none().0)) + from_glib(ffi::webkit_web_view_can_go_forward(self.as_ref().to_glib_none().0)) } } fn can_show_mime_type(&self, mime_type: &str) -> bool { unsafe { - from_glib(ffi::webkit_web_view_can_show_mime_type(self.to_glib_none().0, mime_type.to_glib_none().0)) + from_glib(ffi::webkit_web_view_can_show_mime_type(self.as_ref().to_glib_none().0, mime_type.to_glib_none().0)) } } fn download_uri(&self, uri: &str) -> Option { unsafe { - from_glib_full(ffi::webkit_web_view_download_uri(self.to_glib_none().0, uri.to_glib_none().0)) + from_glib_full(ffi::webkit_web_view_download_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0)) } } fn execute_editing_command(&self, command: &str) { unsafe { - ffi::webkit_web_view_execute_editing_command(self.to_glib_none().0, command.to_glib_none().0); + ffi::webkit_web_view_execute_editing_command(self.as_ref().to_glib_none().0, command.to_glib_none().0); } } #[cfg(any(feature = "v2_10", feature = "dox"))] fn execute_editing_command_with_argument(&self, command: &str, argument: &str) { unsafe { - ffi::webkit_web_view_execute_editing_command_with_argument(self.to_glib_none().0, command.to_glib_none().0, argument.to_glib_none().0); + ffi::webkit_web_view_execute_editing_command_with_argument(self.as_ref().to_glib_none().0, command.to_glib_none().0, argument.to_glib_none().0); } } fn get_back_forward_list(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_back_forward_list(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_back_forward_list(self.as_ref().to_glib_none().0)) } } @@ -464,105 +465,104 @@ impl + IsA + Clone + 'static> WebViewExt f fn get_background_color(&self) -> gdk::RGBA { unsafe { let mut rgba = gdk::RGBA::uninitialized(); - ffi::webkit_web_view_get_background_color(self.to_glib_none().0, rgba.to_glib_none_mut().0); + ffi::webkit_web_view_get_background_color(self.as_ref().to_glib_none().0, rgba.to_glib_none_mut().0); rgba } } fn get_context(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_context(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_context(self.as_ref().to_glib_none().0)) } } - fn get_custom_charset(&self) -> Option { + fn get_custom_charset(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_custom_charset(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_custom_charset(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_10", feature = "dox"))] fn get_editor_state(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_editor_state(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_editor_state(self.as_ref().to_glib_none().0)) } } fn get_estimated_load_progress(&self) -> f64 { unsafe { - ffi::webkit_web_view_get_estimated_load_progress(self.to_glib_none().0) + ffi::webkit_web_view_get_estimated_load_progress(self.as_ref().to_glib_none().0) } } fn get_favicon(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_favicon(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_favicon(self.as_ref().to_glib_none().0)) } } fn get_find_controller(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_find_controller(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_find_controller(self.as_ref().to_glib_none().0)) } } fn get_inspector(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_inspector(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_inspector(self.as_ref().to_glib_none().0)) } } fn get_javascript_global_context(&self) -> Option { unsafe { - from_glib_full(ffi::webkit_web_view_get_javascript_global_context(self.to_glib_none().0)) + from_glib_full(ffi::webkit_web_view_get_javascript_global_context(self.as_ref().to_glib_none().0)) } } fn get_main_resource(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_main_resource(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_main_resource(self.as_ref().to_glib_none().0)) } } fn get_page_id(&self) -> u64 { unsafe { - ffi::webkit_web_view_get_page_id(self.to_glib_none().0) + ffi::webkit_web_view_get_page_id(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v2_12", feature = "dox"))] fn get_session_state(&self) -> Option { unsafe { - from_glib_full(ffi::webkit_web_view_get_session_state(self.to_glib_none().0)) + from_glib_full(ffi::webkit_web_view_get_session_state(self.as_ref().to_glib_none().0)) } } fn get_settings(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_settings(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_settings(self.as_ref().to_glib_none().0)) } } - fn get_snapshot<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, region: SnapshotRegion, options: SnapshotOptions, cancellable: P, callback: Q) { + 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 cancellable = cancellable.to_glib_none(); - 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) + 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) { 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.to_glib_none().0, region.to_glib(), options.to_glib(), cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + 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 _); } } #[cfg(feature = "futures")] - fn get_snapshot_future(&self, region: SnapshotRegion, options: SnapshotOptions) -> Box_> { + fn get_snapshot_future(&self, region: SnapshotRegion, options: SnapshotOptions) -> Box_> where Self: Sized + Clone { use gio::GioFuture; use fragile::Fragile; @@ -585,9 +585,9 @@ impl + IsA + Clone + 'static> WebViewExt f }) } - fn get_title(&self) -> Option { + fn get_title(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_title(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_title(self.as_ref().to_glib_none().0)) } } @@ -595,180 +595,174 @@ impl + IsA + Clone + 'static> WebViewExt f unsafe { let mut certificate = ptr::null_mut(); let mut errors = mem::uninitialized(); - let ret = from_glib(ffi::webkit_web_view_get_tls_info(self.to_glib_none().0, &mut certificate, &mut errors)); + let ret = from_glib(ffi::webkit_web_view_get_tls_info(self.as_ref().to_glib_none().0, &mut certificate, &mut errors)); if ret { Some((from_glib_none(certificate), from_glib(errors))) } else { None } } } - fn get_uri(&self) -> Option { + fn get_uri(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_uri(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_uri(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_6", feature = "dox"))] fn get_user_content_manager(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_user_content_manager(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_user_content_manager(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_website_data_manager(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_website_data_manager(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_website_data_manager(self.as_ref().to_glib_none().0)) } } fn get_window_properties(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_web_view_get_window_properties(self.to_glib_none().0)) + from_glib_none(ffi::webkit_web_view_get_window_properties(self.as_ref().to_glib_none().0)) } } fn get_zoom_level(&self) -> f64 { unsafe { - ffi::webkit_web_view_get_zoom_level(self.to_glib_none().0) + ffi::webkit_web_view_get_zoom_level(self.as_ref().to_glib_none().0) } } fn go_back(&self) { unsafe { - ffi::webkit_web_view_go_back(self.to_glib_none().0); + ffi::webkit_web_view_go_back(self.as_ref().to_glib_none().0); } } fn go_forward(&self) { unsafe { - ffi::webkit_web_view_go_forward(self.to_glib_none().0); + ffi::webkit_web_view_go_forward(self.as_ref().to_glib_none().0); } } - fn go_to_back_forward_list_item(&self, list_item: &BackForwardListItem) { + fn go_to_back_forward_list_item>(&self, list_item: &P) { unsafe { - ffi::webkit_web_view_go_to_back_forward_list_item(self.to_glib_none().0, list_item.to_glib_none().0); + ffi::webkit_web_view_go_to_back_forward_list_item(self.as_ref().to_glib_none().0, list_item.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_18", feature = "dox"))] fn is_controlled_by_automation(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_view_is_controlled_by_automation(self.to_glib_none().0)) + from_glib(ffi::webkit_web_view_is_controlled_by_automation(self.as_ref().to_glib_none().0)) } } fn is_editable(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_view_is_editable(self.to_glib_none().0)) + from_glib(ffi::webkit_web_view_is_editable(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn is_ephemeral(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_view_is_ephemeral(self.to_glib_none().0)) + from_glib(ffi::webkit_web_view_is_ephemeral(self.as_ref().to_glib_none().0)) } } fn is_loading(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_view_is_loading(self.to_glib_none().0)) + from_glib(ffi::webkit_web_view_is_loading(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn is_playing_audio(&self) -> bool { unsafe { - from_glib(ffi::webkit_web_view_is_playing_audio(self.to_glib_none().0)) + from_glib(ffi::webkit_web_view_is_playing_audio(self.as_ref().to_glib_none().0)) } } fn load_alternate_html<'a, P: Into>>(&self, content: &str, content_uri: &str, base_uri: P) { let base_uri = base_uri.into(); - let base_uri = base_uri.to_glib_none(); unsafe { - ffi::webkit_web_view_load_alternate_html(self.to_glib_none().0, content.to_glib_none().0, content_uri.to_glib_none().0, base_uri.0); + 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 mime_type = mime_type.to_glib_none(); let encoding = encoding.into(); - let encoding = encoding.to_glib_none(); let base_uri = base_uri.into(); - let base_uri = base_uri.to_glib_none(); unsafe { - ffi::webkit_web_view_load_bytes(self.to_glib_none().0, bytes.to_glib_none().0, mime_type.0, encoding.0, base_uri.0); + 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(); - let base_uri = base_uri.to_glib_none(); unsafe { - ffi::webkit_web_view_load_html(self.to_glib_none().0, content.to_glib_none().0, base_uri.0); + ffi::webkit_web_view_load_html(self.as_ref().to_glib_none().0, content.to_glib_none().0, base_uri.to_glib_none().0); } } fn load_plain_text(&self, plain_text: &str) { unsafe { - ffi::webkit_web_view_load_plain_text(self.to_glib_none().0, plain_text.to_glib_none().0); + ffi::webkit_web_view_load_plain_text(self.as_ref().to_glib_none().0, plain_text.to_glib_none().0); } } - fn load_request(&self, request: &URIRequest) { + fn load_request>(&self, request: &P) { unsafe { - ffi::webkit_web_view_load_request(self.to_glib_none().0, request.to_glib_none().0); + ffi::webkit_web_view_load_request(self.as_ref().to_glib_none().0, request.as_ref().to_glib_none().0); } } fn load_uri(&self, uri: &str) { unsafe { - ffi::webkit_web_view_load_uri(self.to_glib_none().0, uri.to_glib_none().0); + ffi::webkit_web_view_load_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0); } } fn reload(&self) { unsafe { - ffi::webkit_web_view_reload(self.to_glib_none().0); + ffi::webkit_web_view_reload(self.as_ref().to_glib_none().0); } } fn reload_bypass_cache(&self) { unsafe { - ffi::webkit_web_view_reload_bypass_cache(self.to_glib_none().0); + ffi::webkit_web_view_reload_bypass_cache(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_12", feature = "dox"))] fn restore_session_state(&self, state: &WebViewSessionState) { unsafe { - ffi::webkit_web_view_restore_session_state(self.to_glib_none().0, state.to_glib_none().0); + ffi::webkit_web_view_restore_session_state(self.as_ref().to_glib_none().0, state.to_glib_none().0); } } - fn run_javascript<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, script: &str, cancellable: P, callback: Q) { + 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 cancellable = cancellable.to_glib_none(); - 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) + 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) { 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.to_glib_none().0, script.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + 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 _); } } #[cfg(feature = "futures")] - fn run_javascript_future(&self, script: &str) -> Box_> { + fn run_javascript_future(&self, script: &str) -> Box_> where Self: Sized + Clone { use gio::GioFuture; use fragile::Fragile; @@ -791,26 +785,25 @@ impl + IsA + Clone + 'static> WebViewExt f }) } - fn run_javascript_from_gresource<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, resource: &str, cancellable: P, callback: Q) { + 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 cancellable = cancellable.to_glib_none(); - 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) + 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) { 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.to_glib_none().0, resource.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + 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 _); } } #[cfg(feature = "futures")] - fn run_javascript_from_gresource_future(&self, resource: &str) -> Box_> { + fn run_javascript_from_gresource_future(&self, resource: &str) -> Box_> where Self: Sized + Clone { use gio::GioFuture; use fragile::Fragile; @@ -833,12 +826,12 @@ impl + IsA + Clone + 'static> WebViewExt f }) } - //fn save<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(&self, save_mode: SaveMode, cancellable: P, callback: Q) { + //fn save<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result) + Send + 'static>(&self, save_mode: SaveMode, cancellable: Q, callback: R) { // unsafe { TODO: call ffi::webkit_web_view_save() } //} //#[cfg(feature = "futures")] - //fn save_future(&self, save_mode: SaveMode) -> Box_> { + //fn save_future(&self, save_mode: SaveMode) -> Box_> where Self: Sized + Clone { //use gio::GioFuture; //use fragile::Fragile; @@ -860,12 +853,12 @@ impl + IsA + Clone + 'static> WebViewExt f //}) //} - //fn save_to_file<'a, P: IsA, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, file: &P, save_mode: SaveMode, cancellable: Q, callback: R) { + //fn save_to_file<'a, P: IsA, Q: IsA + 'a, R: Into>, S: FnOnce(Result<(), Error>) + Send + 'static>(&self, file: &P, save_mode: SaveMode, cancellable: R, callback: S) { // unsafe { TODO: call ffi::webkit_web_view_save_to_file() } //} //#[cfg(feature = "futures")] - //fn save_to_file_future + Clone + 'static>(&self, file: &P, save_mode: SaveMode) -> Box_> { + //fn save_to_file_future + Clone + 'static>(&self, file: &P, save_mode: SaveMode) -> Box_> where Self: Sized + Clone { //use gio::GioFuture; //use fragile::Fragile; @@ -892,47 +885,46 @@ impl + IsA + Clone + 'static> WebViewExt f #[cfg(any(feature = "v2_8", feature = "dox"))] fn set_background_color(&self, rgba: &gdk::RGBA) { unsafe { - ffi::webkit_web_view_set_background_color(self.to_glib_none().0, rgba.to_glib_none().0); + ffi::webkit_web_view_set_background_color(self.as_ref().to_glib_none().0, rgba.to_glib_none().0); } } fn set_custom_charset<'a, P: Into>>(&self, charset: P) { let charset = charset.into(); - let charset = charset.to_glib_none(); unsafe { - ffi::webkit_web_view_set_custom_charset(self.to_glib_none().0, charset.0); + ffi::webkit_web_view_set_custom_charset(self.as_ref().to_glib_none().0, charset.to_glib_none().0); } } #[cfg(any(feature = "v2_8", feature = "dox"))] fn set_editable(&self, editable: bool) { unsafe { - ffi::webkit_web_view_set_editable(self.to_glib_none().0, editable.to_glib()); + ffi::webkit_web_view_set_editable(self.as_ref().to_glib_none().0, editable.to_glib()); } } - fn set_settings(&self, settings: &Settings) { + fn set_settings>(&self, settings: &P) { unsafe { - ffi::webkit_web_view_set_settings(self.to_glib_none().0, settings.to_glib_none().0); + ffi::webkit_web_view_set_settings(self.as_ref().to_glib_none().0, settings.as_ref().to_glib_none().0); } } fn set_zoom_level(&self, zoom_level: f64) { unsafe { - ffi::webkit_web_view_set_zoom_level(self.to_glib_none().0, zoom_level); + ffi::webkit_web_view_set_zoom_level(self.as_ref().to_glib_none().0, zoom_level); } } fn stop_loading(&self) { unsafe { - ffi::webkit_web_view_stop_loading(self.to_glib_none().0); + ffi::webkit_web_view_stop_loading(self.as_ref().to_glib_none().0); } } #[cfg(any(feature = "v2_12", feature = "dox"))] fn try_close(&self) { unsafe { - ffi::webkit_web_view_try_close(self.to_glib_none().0); + ffi::webkit_web_view_try_close(self.as_ref().to_glib_none().0); } } @@ -940,7 +932,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn get_property_editable(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "editable".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"editable\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -949,7 +941,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn get_property_is_controlled_by_automation(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "is-controlled-by-automation".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"is-controlled-by-automation\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -958,7 +950,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn get_property_is_ephemeral(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "is-ephemeral".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"is-ephemeral\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -966,7 +958,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn get_property_is_loading(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "is-loading".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"is-loading\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -975,7 +967,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn get_property_is_playing_audio(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "is-playing-audio".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"is-playing-audio\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } @@ -983,7 +975,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn get_property_web_context(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "web-context".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"web-context\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get() } } @@ -992,7 +984,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_authenticate bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "authenticate", + 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 _) } } @@ -1000,7 +992,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_close(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "close", + 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 _) } } @@ -1008,7 +1000,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_context_menu bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "context-menu", + 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 _) } } @@ -1016,7 +1008,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_context_menu_dismissed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "context-menu-dismissed", + 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 _) } } @@ -1025,7 +1017,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_create Option + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ Option + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "create", + 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 _) } } @@ -1033,7 +1025,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_decide_policy bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "decide-policy", + 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 _) } } @@ -1041,7 +1033,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_enter_fullscreen bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "enter-fullscreen", + 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 _) } } @@ -1049,7 +1041,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_insecure_content_detected(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "insecure-content-detected", + 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 _) } } @@ -1057,7 +1049,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_leave_fullscreen bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "leave-fullscreen", + 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 _) } } @@ -1065,7 +1057,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_load_changed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "load-changed", + 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 _) } } @@ -1073,7 +1065,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_load_failed bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "load-failed", + 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 _) } } @@ -1082,7 +1074,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_load_failed_with_tls_errors bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "load-failed-with-tls-errors", + 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 _) } } @@ -1090,7 +1082,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_mouse_target_changed(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "mouse-target-changed", + 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 _) } } @@ -1098,7 +1090,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_permission_request bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "permission-request", + 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 _) } } @@ -1106,7 +1098,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_print bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "print", + 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 _) } } @@ -1114,7 +1106,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_ready_to_show(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "ready-to-show", + 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 _) } } @@ -1122,7 +1114,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_resource_load_started(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "resource-load-started", + 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 _) } } @@ -1130,7 +1122,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_run_as_modal(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "run-as-modal", + 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 _) } } @@ -1139,7 +1131,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_run_color_chooser bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "run-color-chooser", + 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 _) } } @@ -1147,7 +1139,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_run_file_chooser bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "run-file-chooser", + 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 _) } } @@ -1155,7 +1147,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_script_dialog bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "script-dialog", + 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 _) } } @@ -1164,7 +1156,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_show_notification bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "show-notification", + 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 _) } } @@ -1177,7 +1169,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_submit_form(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "submit-form", + 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 _) } } @@ -1185,7 +1177,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_web_process_crashed bool + 'static>(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ bool + 'static>> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "web-process-crashed", + 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 _) } } @@ -1199,7 +1191,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_property_editable_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::editable", + 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 _) } } @@ -1207,7 +1199,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_property_estimated_load_progress_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::estimated-load-progress", + 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 _) } } @@ -1215,7 +1207,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_property_favicon_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::favicon", + 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 _) } } @@ -1223,7 +1215,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_property_is_loading_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::is-loading", + 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 _) } } @@ -1232,7 +1224,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_property_is_playing_audio_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::is-playing-audio", + 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 _) } } @@ -1241,7 +1233,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_property_settings_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::settings", + 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 _) } } @@ -1249,7 +1241,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_property_title_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::title", + 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 _) } } @@ -1257,7 +1249,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::uri", + 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 _) } } @@ -1265,7 +1257,7 @@ impl + IsA + Clone + 'static> WebViewExt f fn connect_property_zoom_level_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); - connect(self.to_glib_none().0, "notify::zoom-level", + 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 _) } } @@ -1275,204 +1267,210 @@ impl + IsA + Clone + 'static> WebViewExt f unsafe extern "C" fn authenticate_trampoline

(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); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(request)).to_glib() + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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 where P: IsA { let f: &&(Fn(&P, &ContextMenu, &gdk::Event, &HitTestResult) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(context_menu), &from_glib_none(event), &from_glib_borrow(hit_test_result)).to_glib() + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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 where P: IsA { let f: &&(Fn(&P, &NavigationAction) -> Option + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(navigation_action)).to_glib_full() + 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 where P: IsA { let f: &&(Fn(&P, &PolicyDecision, PolicyDecisionType) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(decision), from_glib(decision_type)).to_glib() + 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 where P: IsA { let f: &&(Fn(&P) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()).to_glib() + 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) where P: IsA { let f: &&(Fn(&P, InsecureContentEvent) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), from_glib(event)) + 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 where P: IsA { let f: &&(Fn(&P) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()).to_glib() + 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) where P: IsA { let f: &&(Fn(&P, LoadEvent) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), from_glib(load_event)) + 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 where P: IsA { let f: &&(Fn(&P, LoadEvent, &str, &Error) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), from_glib(load_event), &String::from_glib_none(failing_uri), &from_glib_borrow(error)).to_glib() + 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 where P: IsA { let f: &&(Fn(&P, &str, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(failing_uri), &from_glib_borrow(certificate), from_glib(errors)).to_glib() + 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) where P: IsA { let f: &&(Fn(&P, &HitTestResult, u32) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(hit_test_result), modifiers) + 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 where P: IsA { let f: &&(Fn(&P, &PermissionRequest) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(request)).to_glib() + 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 where P: IsA { let f: &&(Fn(&P, &PrintOperation) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(print_operation)).to_glib() + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P, &WebResource, &URIRequest) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(resource), &from_glib_borrow(request)) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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 where P: IsA { let f: &&(Fn(&P, &ColorChooserRequest) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(request)).to_glib() + 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 where P: IsA { let f: &&(Fn(&P, &FileChooserRequest) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(request)).to_glib() + 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 where P: IsA { let f: &&(Fn(&P, &ScriptDialog) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(dialog)).to_glib() + 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 where P: IsA { let f: &&(Fn(&P, &Notification) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(notification)).to_glib() + 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) where P: IsA { let f: &&(Fn(&P, &FormSubmissionRequest) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(request)) + 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 where P: IsA { let f: &&(Fn(&P) -> bool + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()).to_glib() + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + 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) where P: IsA { let f: &&(Fn(&P) + 'static) = transmute(f); - f(&WebView::from_glib_borrow(this).downcast_unchecked()) + f(&WebView::from_glib_borrow(this).unsafe_cast()) +} + +impl fmt::Display for WebView { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "WebView") + } } diff --git a/src/auto/web_view_base.rs b/src/auto/web_view_base.rs index abfd38d7..dd177e40 100644 --- a/src/auto/web_view_base.rs +++ b/src/auto/web_view_base.rs @@ -4,18 +4,11 @@ use ffi; use glib::translate::*; -use glib_ffi; -use gobject_ffi; use gtk; -use gtk_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct WebViewBase(Object): [ - gtk::Container => gtk_ffi::GtkContainer, - gtk::Widget => gtk_ffi::GtkWidget, - ]; + pub struct WebViewBase(Object) @extends gtk::Container, gtk::Widget; match fn { get_type => || ffi::webkit_web_view_base_get_type(), @@ -23,3 +16,11 @@ glib_wrapper! { } impl WebViewBase {} + +pub const NONE_WEB_VIEW_BASE: Option<&WebViewBase> = None; + +impl fmt::Display for WebViewBase { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "WebViewBase") + } +} diff --git a/src/auto/web_view_session_state.rs b/src/auto/web_view_session_state.rs index 1fb5f60e..4dc76f7e 100644 --- a/src/auto/web_view_session_state.rs +++ b/src/auto/web_view_session_state.rs @@ -5,11 +5,8 @@ use ffi; #[cfg(any(feature = "v2_12", feature = "dox"))] use glib; +#[cfg(any(feature = "v2_12", feature = "dox"))] use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/src/auto/website_data_manager.rs b/src/auto/website_data_manager.rs index 09ddf869..4b1cc1ed 100644 --- a/src/auto/website_data_manager.rs +++ b/src/auto/website_data_manager.rs @@ -5,20 +5,20 @@ #[cfg(any(feature = "v2_16", feature = "dox"))] use CookieManager; use ffi; -use glib; +#[cfg(any(feature = "v2_10", feature = "dox"))] +use glib::GString; #[cfg(any(feature = "v2_16", feature = "dox"))] use glib::StaticType; #[cfg(any(feature = "v2_16", feature = "dox"))] use glib::Value; use glib::object::IsA; use glib::translate::*; -use glib_ffi; +#[cfg(any(feature = "v2_16", feature = "dox"))] use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct WebsiteDataManager(Object); + pub struct WebsiteDataManager(Object); match fn { get_type => || ffi::webkit_website_data_manager_get_type(), @@ -40,68 +40,70 @@ impl WebsiteDataManager { } } -pub trait WebsiteDataManagerExt { +pub const NONE_WEBSITE_DATA_MANAGER: Option<&WebsiteDataManager> = None; + +pub trait WebsiteDataManagerExt: 'static { //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn clear<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan, cancellable: P, callback: Q); + //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); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn clear_future(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan) -> Box_>; + //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: Into>, Q: FnOnce(Result, Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: P, callback: Q); + //fn fetch<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Q, callback: R); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn fetch_future(&self, types: WebsiteDataTypes) -> Box_), Error = (Self, Error)>>; + //fn fetch_future(&self, types: WebsiteDataTypes) -> Box_), Error = (Self, Error)>> where Self: Sized + Clone; #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_base_cache_directory(&self) -> Option; + fn get_base_cache_directory(&self) -> Option; #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_base_data_directory(&self) -> Option; + fn get_base_data_directory(&self) -> Option; #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_cookie_manager(&self) -> Option; #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_disk_cache_directory(&self) -> Option; + fn get_disk_cache_directory(&self) -> Option; #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_indexeddb_directory(&self) -> Option; + fn get_indexeddb_directory(&self) -> Option; #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_local_storage_directory(&self) -> Option; + fn get_local_storage_directory(&self) -> Option; #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_offline_application_cache_directory(&self) -> Option; + fn get_offline_application_cache_directory(&self) -> Option; #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_websql_directory(&self) -> Option; + fn get_websql_directory(&self) -> Option; #[cfg(any(feature = "v2_16", feature = "dox"))] fn is_ephemeral(&self) -> bool; //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn remove<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, website_data: /*Ignored*/&[&WebsiteData], cancellable: P, callback: Q); + //fn remove<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, website_data: /*Ignored*/&[&WebsiteData], cancellable: Q, callback: R); //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn remove_future(&self, types: WebsiteDataTypes, website_data: /*Ignored*/&[&WebsiteData]) -> Box_>; + //fn remove_future(&self, types: WebsiteDataTypes, website_data: /*Ignored*/&[&WebsiteData]) -> Box_> where Self: Sized + Clone; #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_property_is_ephemeral(&self) -> bool; } -impl + IsA> WebsiteDataManagerExt for O { +impl> WebsiteDataManagerExt for O { //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn clear<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan, cancellable: P, callback: Q) { + //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) { // unsafe { TODO: call ffi::webkit_website_data_manager_clear() } //} //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn clear_future(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan) -> Box_> { + //fn clear_future(&self, types: WebsiteDataTypes, timespan: /*Ignored*/glib::TimeSpan) -> Box_> where Self: Sized + Clone { //use gio::GioFuture; //use fragile::Fragile; @@ -125,13 +127,13 @@ impl + IsA> WebsiteDataManagerE //} //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn fetch<'a, P: Into>, Q: FnOnce(Result, Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: P, callback: Q) { + //fn fetch<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result, Error>) + Send + 'static>(&self, types: WebsiteDataTypes, cancellable: Q, callback: R) { // unsafe { TODO: call ffi::webkit_website_data_manager_fetch() } //} //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn fetch_future(&self, types: WebsiteDataTypes) -> Box_), Error = (Self, Error)>> { + //fn fetch_future(&self, types: WebsiteDataTypes) -> Box_), Error = (Self, Error)>> where Self: Sized + Clone { //use gio::GioFuture; //use fragile::Fragile; @@ -154,76 +156,76 @@ impl + IsA> WebsiteDataManagerE //} #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_base_cache_directory(&self) -> Option { + fn get_base_cache_directory(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_website_data_manager_get_base_cache_directory(self.to_glib_none().0)) + from_glib_none(ffi::webkit_website_data_manager_get_base_cache_directory(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_base_data_directory(&self) -> Option { + fn get_base_data_directory(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_website_data_manager_get_base_data_directory(self.to_glib_none().0)) + from_glib_none(ffi::webkit_website_data_manager_get_base_data_directory(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn get_cookie_manager(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_website_data_manager_get_cookie_manager(self.to_glib_none().0)) + from_glib_none(ffi::webkit_website_data_manager_get_cookie_manager(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_disk_cache_directory(&self) -> Option { + fn get_disk_cache_directory(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_website_data_manager_get_disk_cache_directory(self.to_glib_none().0)) + from_glib_none(ffi::webkit_website_data_manager_get_disk_cache_directory(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_indexeddb_directory(&self) -> Option { + fn get_indexeddb_directory(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_website_data_manager_get_indexeddb_directory(self.to_glib_none().0)) + from_glib_none(ffi::webkit_website_data_manager_get_indexeddb_directory(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_local_storage_directory(&self) -> Option { + fn get_local_storage_directory(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_website_data_manager_get_local_storage_directory(self.to_glib_none().0)) + from_glib_none(ffi::webkit_website_data_manager_get_local_storage_directory(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_offline_application_cache_directory(&self) -> Option { + fn get_offline_application_cache_directory(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_website_data_manager_get_offline_application_cache_directory(self.to_glib_none().0)) + from_glib_none(ffi::webkit_website_data_manager_get_offline_application_cache_directory(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_10", feature = "dox"))] - fn get_websql_directory(&self) -> Option { + fn get_websql_directory(&self) -> Option { unsafe { - from_glib_none(ffi::webkit_website_data_manager_get_websql_directory(self.to_glib_none().0)) + from_glib_none(ffi::webkit_website_data_manager_get_websql_directory(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v2_16", feature = "dox"))] fn is_ephemeral(&self) -> bool { unsafe { - from_glib(ffi::webkit_website_data_manager_is_ephemeral(self.to_glib_none().0)) + from_glib(ffi::webkit_website_data_manager_is_ephemeral(self.as_ref().to_glib_none().0)) } } //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn remove<'a, P: Into>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, website_data: /*Ignored*/&[&WebsiteData], cancellable: P, callback: Q) { + //fn remove<'a, P: IsA + 'a, Q: Into>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, types: WebsiteDataTypes, website_data: /*Ignored*/&[&WebsiteData], cancellable: Q, callback: R) { // unsafe { TODO: call ffi::webkit_website_data_manager_remove() } //} //#[cfg(feature = "futures")] //#[cfg(any(feature = "v2_16", feature = "dox"))] - //fn remove_future(&self, types: WebsiteDataTypes, website_data: /*Ignored*/&[&WebsiteData]) -> Box_> { + //fn remove_future(&self, types: WebsiteDataTypes, website_data: /*Ignored*/&[&WebsiteData]) -> Box_> where Self: Sized + Clone { //use gio::GioFuture; //use fragile::Fragile; @@ -251,8 +253,14 @@ impl + IsA> WebsiteDataManagerE fn get_property_is_ephemeral(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); - gobject_ffi::g_object_get_property(self.to_glib_none().0, "is-ephemeral".to_glib_none().0, value.to_glib_none_mut().0); + gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"is-ephemeral\0".as_ptr() as *const _, value.to_glib_none_mut().0); value.get().unwrap() } } } + +impl fmt::Display for WebsiteDataManager { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "WebsiteDataManager") + } +} diff --git a/src/auto/window_properties.rs b/src/auto/window_properties.rs index 409cdff7..01f3ccf5 100644 --- a/src/auto/window_properties.rs +++ b/src/auto/window_properties.rs @@ -6,20 +6,19 @@ use ffi; use gdk; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; -use std::mem; -use std::ptr; +use std::fmt; glib_wrapper! { - pub struct WindowProperties(Object); + pub struct WindowProperties(Object); match fn { get_type => || ffi::webkit_window_properties_get_type(), } } -pub trait WindowPropertiesExt { +pub const NONE_WINDOW_PROPERTIES: Option<&WindowProperties> = None; + +pub trait WindowPropertiesExt: 'static { fn get_fullscreen(&self) -> bool; fn get_geometry(&self) -> gdk::Rectangle; @@ -40,51 +39,57 @@ pub trait WindowPropertiesExt { impl> WindowPropertiesExt for O { fn get_fullscreen(&self) -> bool { unsafe { - from_glib(ffi::webkit_window_properties_get_fullscreen(self.to_glib_none().0)) + from_glib(ffi::webkit_window_properties_get_fullscreen(self.as_ref().to_glib_none().0)) } } fn get_geometry(&self) -> gdk::Rectangle { unsafe { let mut geometry = gdk::Rectangle::uninitialized(); - ffi::webkit_window_properties_get_geometry(self.to_glib_none().0, geometry.to_glib_none_mut().0); + ffi::webkit_window_properties_get_geometry(self.as_ref().to_glib_none().0, geometry.to_glib_none_mut().0); geometry } } fn get_locationbar_visible(&self) -> bool { unsafe { - from_glib(ffi::webkit_window_properties_get_locationbar_visible(self.to_glib_none().0)) + from_glib(ffi::webkit_window_properties_get_locationbar_visible(self.as_ref().to_glib_none().0)) } } fn get_menubar_visible(&self) -> bool { unsafe { - from_glib(ffi::webkit_window_properties_get_menubar_visible(self.to_glib_none().0)) + from_glib(ffi::webkit_window_properties_get_menubar_visible(self.as_ref().to_glib_none().0)) } } fn get_resizable(&self) -> bool { unsafe { - from_glib(ffi::webkit_window_properties_get_resizable(self.to_glib_none().0)) + from_glib(ffi::webkit_window_properties_get_resizable(self.as_ref().to_glib_none().0)) } } fn get_scrollbars_visible(&self) -> bool { unsafe { - from_glib(ffi::webkit_window_properties_get_scrollbars_visible(self.to_glib_none().0)) + from_glib(ffi::webkit_window_properties_get_scrollbars_visible(self.as_ref().to_glib_none().0)) } } fn get_statusbar_visible(&self) -> bool { unsafe { - from_glib(ffi::webkit_window_properties_get_statusbar_visible(self.to_glib_none().0)) + from_glib(ffi::webkit_window_properties_get_statusbar_visible(self.as_ref().to_glib_none().0)) } } fn get_toolbar_visible(&self) -> bool { unsafe { - from_glib(ffi::webkit_window_properties_get_toolbar_visible(self.to_glib_none().0)) + from_glib(ffi::webkit_window_properties_get_toolbar_visible(self.as_ref().to_glib_none().0)) } } } + +impl fmt::Display for WindowProperties { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "WindowProperties") + } +} diff --git a/src/web_view.rs b/src/web_view.rs index 2f2e0ffb..a4ce27d1 100644 --- a/src/web_view.rs +++ b/src/web_view.rs @@ -24,10 +24,11 @@ use std::ffi::CString; use std::ptr; use ffi; -use glib::object::Downcast; use glib::signal::connect; use glib::StaticType; use glib::translate::{FromGlibPtrNone, ToGlib, ToGlibPtr, from_glib_full}; +use glib::object::Cast; +use glib::object::IsA; use gobject_ffi; use gtk; use libc::c_void; @@ -39,15 +40,15 @@ use UserContentManager; impl WebView { #[cfg(feature = "v2_6")] - pub fn new_with_context_and_user_content_manager(context: &WebContext, user_content_manager: &UserContentManager) -> Self { + pub fn new_with_context_and_user_content_manager, Q: IsA>(context: &P, user_content_manager: &Q) -> Self { assert_initialized_main_thread!(); let user_content_manager_property = CString::new("user-content-manager").unwrap(); let web_context_property = CString::new("web-context").unwrap(); - let glib_user_content_manager: *mut gobject_ffi::GObject = user_content_manager.to_glib_none().0; - let glib_context: *mut gobject_ffi::GObject = context.to_glib_none().0; + let glib_user_content_manager: *mut ffi::WebKitUserContentManager = user_content_manager.as_ref().to_glib_none().0; + let glib_context: *mut ffi::WebKitWebContext = context.as_ref().to_glib_none().0; let null: *mut gobject_ffi::GObject = ptr::null_mut(); unsafe { - gtk::Widget::from_glib_none(gobject_ffi::g_object_new(WebView::static_type().to_glib(), user_content_manager_property.as_ptr(), glib_user_content_manager, web_context_property.as_ptr(), glib_context, null) as *mut _).downcast_unchecked() + gtk::Widget::from_glib_none(gobject_ffi::g_object_new(WebView::static_type().to_glib(), user_content_manager_property.as_ptr(), glib_user_content_manager, web_context_property.as_ptr(), glib_context, null) as *mut _).unsafe_cast() } } }