gio/auto/
proxy_address_enumerator.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, ProxyResolver, SocketAddressEnumerator, SocketConnectable};
6use glib::{
7    prelude::*,
8    signal::{connect_raw, SignalHandlerId},
9    translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14    #[doc(alias = "GProxyAddressEnumerator")]
15    pub struct ProxyAddressEnumerator(Object<ffi::GProxyAddressEnumerator, ffi::GProxyAddressEnumeratorClass>) @extends SocketAddressEnumerator;
16
17    match fn {
18        type_ => || ffi::g_proxy_address_enumerator_get_type(),
19    }
20}
21
22impl ProxyAddressEnumerator {
23    pub const NONE: Option<&'static ProxyAddressEnumerator> = None;
24}
25
26pub trait ProxyAddressEnumeratorExt: IsA<ProxyAddressEnumerator> + 'static {
27    fn connectable(&self) -> Option<SocketConnectable> {
28        ObjectExt::property(self.as_ref(), "connectable")
29    }
30
31    #[doc(alias = "default-port")]
32    fn default_port(&self) -> u32 {
33        ObjectExt::property(self.as_ref(), "default-port")
34    }
35
36    #[doc(alias = "proxy-resolver")]
37    fn proxy_resolver(&self) -> Option<ProxyResolver> {
38        ObjectExt::property(self.as_ref(), "proxy-resolver")
39    }
40
41    #[doc(alias = "proxy-resolver")]
42    fn set_proxy_resolver<P: IsA<ProxyResolver>>(&self, proxy_resolver: Option<&P>) {
43        ObjectExt::set_property(self.as_ref(), "proxy-resolver", proxy_resolver)
44    }
45
46    fn uri(&self) -> Option<glib::GString> {
47        ObjectExt::property(self.as_ref(), "uri")
48    }
49
50    #[doc(alias = "proxy-resolver")]
51    fn connect_proxy_resolver_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
52        unsafe extern "C" fn notify_proxy_resolver_trampoline<
53            P: IsA<ProxyAddressEnumerator>,
54            F: Fn(&P) + 'static,
55        >(
56            this: *mut ffi::GProxyAddressEnumerator,
57            _param_spec: glib::ffi::gpointer,
58            f: glib::ffi::gpointer,
59        ) {
60            let f: &F = &*(f as *const F);
61            f(ProxyAddressEnumerator::from_glib_borrow(this).unsafe_cast_ref())
62        }
63        unsafe {
64            let f: Box_<F> = Box_::new(f);
65            connect_raw(
66                self.as_ptr() as *mut _,
67                c"notify::proxy-resolver".as_ptr() as *const _,
68                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
69                    notify_proxy_resolver_trampoline::<Self, F> as *const (),
70                )),
71                Box_::into_raw(f),
72            )
73        }
74    }
75}
76
77impl<O: IsA<ProxyAddressEnumerator>> ProxyAddressEnumeratorExt for O {}