Skip to content

Commit

Permalink
Regen with gir 7f03627
Browse files Browse the repository at this point in the history
  • Loading branch information
EPashkin committed Mar 24, 2019
1 parent f8cf9de commit 5a5c391
Show file tree
Hide file tree
Showing 35 changed files with 1,036 additions and 901 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Expand Up @@ -20,6 +20,7 @@ travis-ci = { repository = "gtk-rs/webkit2gtk-rs" }
name = "webkit2gtk"

[features]
#default = ["v2_22"]
v2_2 = []
v2_4 = ["v2_2"]
v2_6 = ["v2_4", "webkit2gtk-sys/v2_6"]
Expand All @@ -28,6 +29,9 @@ v2_10 = ["v2_8", "webkit2gtk-sys/v2_10"]
v2_12 = ["v2_10", "webkit2gtk-sys/v2_12"]
v2_14 = ["v2_12", "webkit2gtk-sys/v2_14"]
v2_16 = ["v2_14", "webkit2gtk-sys/v2_16"]
v2_18 = ["v2_16", "webkit2gtk-sys/v2_18"]
v2_20 = ["v2_18", "webkit2gtk-sys/v2_20"]
v2_22 = ["v2_20", "webkit2gtk-sys/v2_22"]

[dependencies]
bitflags = "^1.0"
Expand Down
3 changes: 2 additions & 1 deletion Gir.toml
Expand Up @@ -110,8 +110,9 @@ manual = [
"Gtk.PrintSettings",
"Gtk.Widget",
"Gtk.Window",
"JavaScriptCore.GlobalContext",
"JavaScriptCore.GlobalContextRef",
"JavaScriptCore.Value",
"JavaScriptCore.ValueRef",
"WebKit2.ScriptDialog",
]

Expand Down
8 changes: 4 additions & 4 deletions src/auto/authentication_request.rs
Expand Up @@ -134,17 +134,17 @@ impl<O: IsA<AuthenticationRequest>> AuthenticationRequestExt for O {
#[cfg(any(feature = "v2_2", feature = "dox"))]
fn connect_cancelled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"cancelled\0".as_ptr() as *const _,
transmute(cancelled_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
Some(transmute(cancelled_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
}

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

Expand Down
16 changes: 8 additions & 8 deletions src/auto/color_chooser_request.rs
Expand Up @@ -110,31 +110,31 @@ impl<O: IsA<ColorChooserRequest>> ColorChooserRequestExt for O {
#[cfg(any(feature = "v2_8", feature = "dox"))]
fn connect_finished<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _,
transmute(finished_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
Some(transmute(finished_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}

fn connect_property_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::rgba\0".as_ptr() as *const _,
transmute(notify_rgba_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
Some(transmute(notify_rgba_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
}

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

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

Expand Down
7 changes: 3 additions & 4 deletions src/auto/context_menu_item.rs
Expand Up @@ -24,7 +24,7 @@ impl ContextMenuItem {
//}

//#[cfg(any(feature = "v2_18", feature = "dox"))]
//pub fn new_from_gaction<'a, P: Into<Option<&'a glib::Variant>>>(action: /*Ignored*/&gio::Action, label: &str, target: P) -> ContextMenuItem {
//pub fn new_from_gaction(action: /*Ignored*/&gio::Action, label: &str, target: Option<&glib::Variant>) -> ContextMenuItem {
// unsafe { TODO: call ffi::webkit_context_menu_item_new_from_gaction() }
//}

Expand Down Expand Up @@ -72,7 +72,7 @@ pub trait ContextMenuItemExt: 'static {

fn is_separator(&self) -> bool;

fn set_submenu<'a, P: IsA<ContextMenu> + 'a, Q: Into<Option<&'a P>>>(&self, submenu: Q);
fn set_submenu<P: IsA<ContextMenu>>(&self, submenu: Option<&P>);
}

impl<O: IsA<ContextMenuItem>> ContextMenuItemExt for O {
Expand Down Expand Up @@ -103,8 +103,7 @@ impl<O: IsA<ContextMenuItem>> ContextMenuItemExt for O {
}
}

fn set_submenu<'a, P: IsA<ContextMenu> + 'a, Q: Into<Option<&'a P>>>(&self, submenu: Q) {
let submenu = submenu.into();
fn set_submenu<P: IsA<ContextMenu>>(&self, submenu: Option<&P>) {
unsafe {
ffi::webkit_context_menu_item_set_submenu(self.as_ref().to_glib_none().0, submenu.map(|p| p.as_ref()).to_glib_none().0);
}
Expand Down
112 changes: 55 additions & 57 deletions src/auto/cookie_manager.rs
Expand Up @@ -35,7 +35,7 @@ pub const NONE_COOKIE_MANAGER: Option<&CookieManager> = None;

pub trait CookieManagerExt: 'static {
//#[cfg(any(feature = "v2_20", feature = "dox"))]
//fn add_cookie<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Q, callback: R);
//fn add_cookie<P: IsA<gio::Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Option<&P>, callback: Q);

//#[cfg(feature = "futures")]
//#[cfg(any(feature = "v2_20", feature = "dox"))]
Expand All @@ -45,7 +45,7 @@ pub trait CookieManagerExt: 'static {
fn delete_all_cookies(&self);

//#[cfg(any(feature = "v2_20", feature = "dox"))]
//fn delete_cookie<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Q, callback: R);
//fn delete_cookie<P: IsA<gio::Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Option<&P>, callback: Q);

//#[cfg(feature = "futures")]
//#[cfg(any(feature = "v2_20", feature = "dox"))]
Expand All @@ -54,20 +54,20 @@ pub trait CookieManagerExt: 'static {
#[cfg_attr(feature = "v2_16", deprecated)]
fn delete_cookies_for_domain(&self, domain: &str);

fn get_accept_policy<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result<CookieAcceptPolicy, Error>) + Send + 'static>(&self, cancellable: Q, callback: R);
fn get_accept_policy<P: IsA<gio::Cancellable>, Q: FnOnce(Result<CookieAcceptPolicy, Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q);

#[cfg(feature = "futures")]
fn get_accept_policy_future(&self) -> Box_<futures_core::Future<Item = (Self, CookieAcceptPolicy), Error = (Self, Error)>> where Self: Sized + Clone;

//#[cfg(any(feature = "v2_20", feature = "dox"))]
//fn get_cookies<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result</*Ignored*/Vec<soup::Cookie>, Error>) + Send + 'static>(&self, uri: &str, cancellable: Q, callback: R);
//fn get_cookies<P: IsA<gio::Cancellable>, Q: FnOnce(Result</*Ignored*/Vec<soup::Cookie>, Error>) + Send + 'static>(&self, uri: &str, cancellable: Option<&P>, callback: Q);

//#[cfg(feature = "futures")]
//#[cfg(any(feature = "v2_20", feature = "dox"))]
//fn get_cookies_future(&self, uri: &str) -> Box_<futures_core::Future<Item = (Self, /*Ignored*/Vec<soup::Cookie>), Error = (Self, Error)>> where Self: Sized + Clone;

#[cfg_attr(feature = "v2_16", deprecated)]
fn get_domains_with_cookies<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result<Vec<GString>, Error>) + Send + 'static>(&self, cancellable: Q, callback: R);
fn get_domains_with_cookies<P: IsA<gio::Cancellable>, Q: FnOnce(Result<Vec<GString>, Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q);

#[cfg_attr(feature = "v2_16", deprecated)]
#[cfg(feature = "futures")]
Expand All @@ -82,7 +82,7 @@ pub trait CookieManagerExt: 'static {

impl<O: IsA<CookieManager>> CookieManagerExt for O {
//#[cfg(any(feature = "v2_20", feature = "dox"))]
//fn add_cookie<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Q, callback: R) {
//fn add_cookie<P: IsA<gio::Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Option<&P>, callback: Q) {
// unsafe { TODO: call ffi::webkit_cookie_manager_add_cookie() }
//}

Expand All @@ -98,13 +98,13 @@ impl<O: IsA<CookieManager>> CookieManagerExt for O {
// let send = Fragile::new(send);
// let obj_clone = Fragile::new(obj.clone());
// obj.add_cookie(
// &cookie,
// Some(&cancellable),
// move |res| {
// let obj = obj_clone.into_inner();
// let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
// let _ = send.into_inner().send(res);
// },
// &cookie,
// Some(&cancellable),
// move |res| {
// let obj = obj_clone.into_inner();
// let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
// let _ = send.into_inner().send(res);
// },
// );

// cancellable
Expand All @@ -118,7 +118,7 @@ impl<O: IsA<CookieManager>> CookieManagerExt for O {
}

//#[cfg(any(feature = "v2_20", feature = "dox"))]
//fn delete_cookie<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Q, callback: R) {
//fn delete_cookie<P: IsA<gio::Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cookie: /*Ignored*/&mut soup::Cookie, cancellable: Option<&P>, callback: Q) {
// unsafe { TODO: call ffi::webkit_cookie_manager_delete_cookie() }
//}

Expand All @@ -134,13 +134,13 @@ impl<O: IsA<CookieManager>> CookieManagerExt for O {
// let send = Fragile::new(send);
// let obj_clone = Fragile::new(obj.clone());
// obj.delete_cookie(
// &cookie,
// Some(&cancellable),
// move |res| {
// let obj = obj_clone.into_inner();
// let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
// let _ = send.into_inner().send(res);
// },
// &cookie,
// Some(&cancellable),
// move |res| {
// let obj = obj_clone.into_inner();
// let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
// let _ = send.into_inner().send(res);
// },
// );

// cancellable
Expand All @@ -153,17 +153,16 @@ impl<O: IsA<CookieManager>> CookieManagerExt for O {
}
}

fn get_accept_policy<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result<CookieAcceptPolicy, Error>) + Send + 'static>(&self, cancellable: Q, callback: R) {
let cancellable = cancellable.into();
let user_data: Box<Box<R>> = Box::new(Box::new(callback));
unsafe extern "C" fn get_accept_policy_trampoline<R: FnOnce(Result<CookieAcceptPolicy, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) {
fn get_accept_policy<P: IsA<gio::Cancellable>, Q: FnOnce(Result<CookieAcceptPolicy, Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q) {
let user_data: Box<Q> = Box::new(callback);
unsafe extern "C" fn get_accept_policy_trampoline<Q: FnOnce(Result<CookieAcceptPolicy, 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_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<R>> = Box::from_raw(user_data as *mut _);
let callback: Box<Q> = Box::from_raw(user_data as *mut _);
callback(result);
}
let callback = get_accept_policy_trampoline::<R>;
let callback = get_accept_policy_trampoline::<Q>;
unsafe {
ffi::webkit_cookie_manager_get_accept_policy(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _);
}
Expand All @@ -179,20 +178,20 @@ impl<O: IsA<CookieManager>> CookieManagerExt for O {
let send = Fragile::new(send);
let obj_clone = Fragile::new(obj.clone());
obj.get_accept_policy(
Some(&cancellable),
move |res| {
let obj = obj_clone.into_inner();
let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
let _ = send.into_inner().send(res);
},
Some(&cancellable),
move |res| {
let obj = obj_clone.into_inner();
let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
let _ = send.into_inner().send(res);
},
);

cancellable
})
}

//#[cfg(any(feature = "v2_20", feature = "dox"))]
//fn get_cookies<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result</*Ignored*/Vec<soup::Cookie>, Error>) + Send + 'static>(&self, uri: &str, cancellable: Q, callback: R) {
//fn get_cookies<P: IsA<gio::Cancellable>, Q: FnOnce(Result</*Ignored*/Vec<soup::Cookie>, Error>) + Send + 'static>(&self, uri: &str, cancellable: Option<&P>, callback: Q) {
// unsafe { TODO: call ffi::webkit_cookie_manager_get_cookies() }
//}

Expand All @@ -208,30 +207,29 @@ impl<O: IsA<CookieManager>> CookieManagerExt for O {
// let send = Fragile::new(send);
// let obj_clone = Fragile::new(obj.clone());
// obj.get_cookies(
// &uri,
// Some(&cancellable),
// move |res| {
// let obj = obj_clone.into_inner();
// let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
// let _ = send.into_inner().send(res);
// },
// &uri,
// Some(&cancellable),
// move |res| {
// let obj = obj_clone.into_inner();
// let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
// let _ = send.into_inner().send(res);
// },
// );

// cancellable
//})
//}

fn get_domains_with_cookies<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result<Vec<GString>, Error>) + Send + 'static>(&self, cancellable: Q, callback: R) {
let cancellable = cancellable.into();
let user_data: Box<Box<R>> = Box::new(Box::new(callback));
unsafe extern "C" fn get_domains_with_cookies_trampoline<R: FnOnce(Result<Vec<GString>, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) {
fn get_domains_with_cookies<P: IsA<gio::Cancellable>, Q: FnOnce(Result<Vec<GString>, Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q) {
let user_data: Box<Q> = Box::new(callback);
unsafe extern "C" fn get_domains_with_cookies_trampoline<Q: FnOnce(Result<Vec<GString>, 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<R>> = Box::from_raw(user_data as *mut _);
let callback: Box<Q> = Box::from_raw(user_data as *mut _);
callback(result);
}
let callback = get_domains_with_cookies_trampoline::<R>;
let callback = get_domains_with_cookies_trampoline::<Q>;
unsafe {
ffi::webkit_cookie_manager_get_domains_with_cookies(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _);
}
Expand All @@ -247,12 +245,12 @@ impl<O: IsA<CookieManager>> CookieManagerExt for O {
let send = Fragile::new(send);
let obj_clone = Fragile::new(obj.clone());
obj.get_domains_with_cookies(
Some(&cancellable),
move |res| {
let obj = obj_clone.into_inner();
let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
let _ = send.into_inner().send(res);
},
Some(&cancellable),
move |res| {
let obj = obj_clone.into_inner();
let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
let _ = send.into_inner().send(res);
},
);

cancellable
Expand All @@ -273,16 +271,16 @@ impl<O: IsA<CookieManager>> CookieManagerExt for O {

fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _,
transmute(changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
Some(transmute(changed_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
}

unsafe extern "C" fn changed_trampoline<P>(this: *mut ffi::WebKitCookieManager, f: glib_ffi::gpointer)
unsafe extern "C" fn changed_trampoline<P, F: Fn(&P) + 'static>(this: *mut ffi::WebKitCookieManager, f: glib_ffi::gpointer)
where P: IsA<CookieManager> {
let f: &&(Fn(&P) + 'static) = transmute(f);
let f: &F = &*(f as *const F);
f(&CookieManager::from_glib_borrow(this).unsafe_cast())
}

Expand Down

0 comments on commit 5a5c391

Please sign in to comment.