webkit2gtk5 0.1.2

Rust bindings for webkit-gtk library
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// from webkit2gtk-gir-files
// DO NOT EDIT

use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct NetworkProxySettings(Boxed<ffi::WebKitNetworkProxySettings>);

    match fn {
        copy => |ptr| ffi::webkit_network_proxy_settings_copy(mut_override(ptr)),
        free => |ptr| ffi::webkit_network_proxy_settings_free(ptr),
        type_ => || ffi::webkit_network_proxy_settings_get_type(),
    }
}

impl NetworkProxySettings {
    #[doc(alias = "webkit_network_proxy_settings_new")]
    pub fn new(default_proxy_uri: Option<&str>, ignore_hosts: &[&str]) -> NetworkProxySettings {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::webkit_network_proxy_settings_new(
                default_proxy_uri.to_glib_none().0,
                ignore_hosts.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "webkit_network_proxy_settings_add_proxy_for_scheme")]
    pub fn add_proxy_for_scheme(&mut self, scheme: &str, proxy_uri: &str) {
        unsafe {
            ffi::webkit_network_proxy_settings_add_proxy_for_scheme(
                self.to_glib_none_mut().0,
                scheme.to_glib_none().0,
                proxy_uri.to_glib_none().0,
            );
        }
    }
}