gio/auto/
socket_client.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#![allow(deprecated)]
5
6use crate::{
7    ffi, AsyncResult, Cancellable, IOStream, ProxyResolver, SocketAddress, SocketClientEvent,
8    SocketConnectable, SocketConnection, SocketFamily, SocketProtocol, SocketType,
9    TlsCertificateFlags,
10};
11use glib::{
12    object::ObjectType as _,
13    prelude::*,
14    signal::{connect_raw, SignalHandlerId},
15    translate::*,
16};
17use std::{boxed::Box as Box_, pin::Pin};
18
19glib::wrapper! {
20    #[doc(alias = "GSocketClient")]
21    pub struct SocketClient(Object<ffi::GSocketClient, ffi::GSocketClientClass>);
22
23    match fn {
24        type_ => || ffi::g_socket_client_get_type(),
25    }
26}
27
28impl SocketClient {
29    pub const NONE: Option<&'static SocketClient> = None;
30
31    #[doc(alias = "g_socket_client_new")]
32    pub fn new() -> SocketClient {
33        unsafe { from_glib_full(ffi::g_socket_client_new()) }
34    }
35}
36
37impl Default for SocketClient {
38    fn default() -> Self {
39        Self::new()
40    }
41}
42
43pub trait SocketClientExt: IsA<SocketClient> + 'static {
44    #[doc(alias = "g_socket_client_add_application_proxy")]
45    fn add_application_proxy(&self, protocol: &str) {
46        unsafe {
47            ffi::g_socket_client_add_application_proxy(
48                self.as_ref().to_glib_none().0,
49                protocol.to_glib_none().0,
50            );
51        }
52    }
53
54    #[doc(alias = "g_socket_client_connect")]
55    fn connect(
56        &self,
57        connectable: &impl IsA<SocketConnectable>,
58        cancellable: Option<&impl IsA<Cancellable>>,
59    ) -> Result<SocketConnection, glib::Error> {
60        unsafe {
61            let mut error = std::ptr::null_mut();
62            let ret = ffi::g_socket_client_connect(
63                self.as_ref().to_glib_none().0,
64                connectable.as_ref().to_glib_none().0,
65                cancellable.map(|p| p.as_ref()).to_glib_none().0,
66                &mut error,
67            );
68            if error.is_null() {
69                Ok(from_glib_full(ret))
70            } else {
71                Err(from_glib_full(error))
72            }
73        }
74    }
75
76    #[doc(alias = "g_socket_client_connect_async")]
77    fn connect_async<P: FnOnce(Result<SocketConnection, glib::Error>) + 'static>(
78        &self,
79        connectable: &impl IsA<SocketConnectable>,
80        cancellable: Option<&impl IsA<Cancellable>>,
81        callback: P,
82    ) {
83        let main_context = glib::MainContext::ref_thread_default();
84        let is_main_context_owner = main_context.is_owner();
85        let has_acquired_main_context = (!is_main_context_owner)
86            .then(|| main_context.acquire().ok())
87            .flatten();
88        assert!(
89            is_main_context_owner || has_acquired_main_context.is_some(),
90            "Async operations only allowed if the thread is owning the MainContext"
91        );
92
93        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
94            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
95        unsafe extern "C" fn connect_async_trampoline<
96            P: FnOnce(Result<SocketConnection, glib::Error>) + 'static,
97        >(
98            _source_object: *mut glib::gobject_ffi::GObject,
99            res: *mut crate::ffi::GAsyncResult,
100            user_data: glib::ffi::gpointer,
101        ) {
102            let mut error = std::ptr::null_mut();
103            let ret =
104                ffi::g_socket_client_connect_finish(_source_object as *mut _, res, &mut error);
105            let result = if error.is_null() {
106                Ok(from_glib_full(ret))
107            } else {
108                Err(from_glib_full(error))
109            };
110            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
111                Box_::from_raw(user_data as *mut _);
112            let callback: P = callback.into_inner();
113            callback(result);
114        }
115        let callback = connect_async_trampoline::<P>;
116        unsafe {
117            ffi::g_socket_client_connect_async(
118                self.as_ref().to_glib_none().0,
119                connectable.as_ref().to_glib_none().0,
120                cancellable.map(|p| p.as_ref()).to_glib_none().0,
121                Some(callback),
122                Box_::into_raw(user_data) as *mut _,
123            );
124        }
125    }
126
127    fn connect_future(
128        &self,
129        connectable: &(impl IsA<SocketConnectable> + Clone + 'static),
130    ) -> Pin<Box_<dyn std::future::Future<Output = Result<SocketConnection, glib::Error>> + 'static>>
131    {
132        let connectable = connectable.clone();
133        Box_::pin(crate::GioFuture::new(
134            self,
135            move |obj, cancellable, send| {
136                obj.connect_async(&connectable, Some(cancellable), move |res| {
137                    send.resolve(res);
138                });
139            },
140        ))
141    }
142
143    #[doc(alias = "g_socket_client_connect_to_host")]
144    fn connect_to_host(
145        &self,
146        host_and_port: &str,
147        default_port: u16,
148        cancellable: Option<&impl IsA<Cancellable>>,
149    ) -> Result<SocketConnection, glib::Error> {
150        unsafe {
151            let mut error = std::ptr::null_mut();
152            let ret = ffi::g_socket_client_connect_to_host(
153                self.as_ref().to_glib_none().0,
154                host_and_port.to_glib_none().0,
155                default_port,
156                cancellable.map(|p| p.as_ref()).to_glib_none().0,
157                &mut error,
158            );
159            if error.is_null() {
160                Ok(from_glib_full(ret))
161            } else {
162                Err(from_glib_full(error))
163            }
164        }
165    }
166
167    #[doc(alias = "g_socket_client_connect_to_host_async")]
168    fn connect_to_host_async<P: FnOnce(Result<SocketConnection, glib::Error>) + 'static>(
169        &self,
170        host_and_port: &str,
171        default_port: u16,
172        cancellable: Option<&impl IsA<Cancellable>>,
173        callback: P,
174    ) {
175        let main_context = glib::MainContext::ref_thread_default();
176        let is_main_context_owner = main_context.is_owner();
177        let has_acquired_main_context = (!is_main_context_owner)
178            .then(|| main_context.acquire().ok())
179            .flatten();
180        assert!(
181            is_main_context_owner || has_acquired_main_context.is_some(),
182            "Async operations only allowed if the thread is owning the MainContext"
183        );
184
185        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
186            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
187        unsafe extern "C" fn connect_to_host_async_trampoline<
188            P: FnOnce(Result<SocketConnection, glib::Error>) + 'static,
189        >(
190            _source_object: *mut glib::gobject_ffi::GObject,
191            res: *mut crate::ffi::GAsyncResult,
192            user_data: glib::ffi::gpointer,
193        ) {
194            let mut error = std::ptr::null_mut();
195            let ret = ffi::g_socket_client_connect_to_host_finish(
196                _source_object as *mut _,
197                res,
198                &mut error,
199            );
200            let result = if error.is_null() {
201                Ok(from_glib_full(ret))
202            } else {
203                Err(from_glib_full(error))
204            };
205            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
206                Box_::from_raw(user_data as *mut _);
207            let callback: P = callback.into_inner();
208            callback(result);
209        }
210        let callback = connect_to_host_async_trampoline::<P>;
211        unsafe {
212            ffi::g_socket_client_connect_to_host_async(
213                self.as_ref().to_glib_none().0,
214                host_and_port.to_glib_none().0,
215                default_port,
216                cancellable.map(|p| p.as_ref()).to_glib_none().0,
217                Some(callback),
218                Box_::into_raw(user_data) as *mut _,
219            );
220        }
221    }
222
223    fn connect_to_host_future(
224        &self,
225        host_and_port: &str,
226        default_port: u16,
227    ) -> Pin<Box_<dyn std::future::Future<Output = Result<SocketConnection, glib::Error>> + 'static>>
228    {
229        let host_and_port = String::from(host_and_port);
230        Box_::pin(crate::GioFuture::new(
231            self,
232            move |obj, cancellable, send| {
233                obj.connect_to_host_async(
234                    &host_and_port,
235                    default_port,
236                    Some(cancellable),
237                    move |res| {
238                        send.resolve(res);
239                    },
240                );
241            },
242        ))
243    }
244
245    #[doc(alias = "g_socket_client_connect_to_service")]
246    fn connect_to_service(
247        &self,
248        domain: &str,
249        service: &str,
250        cancellable: Option<&impl IsA<Cancellable>>,
251    ) -> Result<SocketConnection, glib::Error> {
252        unsafe {
253            let mut error = std::ptr::null_mut();
254            let ret = ffi::g_socket_client_connect_to_service(
255                self.as_ref().to_glib_none().0,
256                domain.to_glib_none().0,
257                service.to_glib_none().0,
258                cancellable.map(|p| p.as_ref()).to_glib_none().0,
259                &mut error,
260            );
261            if error.is_null() {
262                Ok(from_glib_full(ret))
263            } else {
264                Err(from_glib_full(error))
265            }
266        }
267    }
268
269    #[doc(alias = "g_socket_client_connect_to_service_async")]
270    fn connect_to_service_async<P: FnOnce(Result<SocketConnection, glib::Error>) + 'static>(
271        &self,
272        domain: &str,
273        service: &str,
274        cancellable: Option<&impl IsA<Cancellable>>,
275        callback: P,
276    ) {
277        let main_context = glib::MainContext::ref_thread_default();
278        let is_main_context_owner = main_context.is_owner();
279        let has_acquired_main_context = (!is_main_context_owner)
280            .then(|| main_context.acquire().ok())
281            .flatten();
282        assert!(
283            is_main_context_owner || has_acquired_main_context.is_some(),
284            "Async operations only allowed if the thread is owning the MainContext"
285        );
286
287        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
288            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
289        unsafe extern "C" fn connect_to_service_async_trampoline<
290            P: FnOnce(Result<SocketConnection, glib::Error>) + 'static,
291        >(
292            _source_object: *mut glib::gobject_ffi::GObject,
293            res: *mut crate::ffi::GAsyncResult,
294            user_data: glib::ffi::gpointer,
295        ) {
296            let mut error = std::ptr::null_mut();
297            let ret = ffi::g_socket_client_connect_to_service_finish(
298                _source_object as *mut _,
299                res,
300                &mut error,
301            );
302            let result = if error.is_null() {
303                Ok(from_glib_full(ret))
304            } else {
305                Err(from_glib_full(error))
306            };
307            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
308                Box_::from_raw(user_data as *mut _);
309            let callback: P = callback.into_inner();
310            callback(result);
311        }
312        let callback = connect_to_service_async_trampoline::<P>;
313        unsafe {
314            ffi::g_socket_client_connect_to_service_async(
315                self.as_ref().to_glib_none().0,
316                domain.to_glib_none().0,
317                service.to_glib_none().0,
318                cancellable.map(|p| p.as_ref()).to_glib_none().0,
319                Some(callback),
320                Box_::into_raw(user_data) as *mut _,
321            );
322        }
323    }
324
325    fn connect_to_service_future(
326        &self,
327        domain: &str,
328        service: &str,
329    ) -> Pin<Box_<dyn std::future::Future<Output = Result<SocketConnection, glib::Error>> + 'static>>
330    {
331        let domain = String::from(domain);
332        let service = String::from(service);
333        Box_::pin(crate::GioFuture::new(
334            self,
335            move |obj, cancellable, send| {
336                obj.connect_to_service_async(&domain, &service, Some(cancellable), move |res| {
337                    send.resolve(res);
338                });
339            },
340        ))
341    }
342
343    #[doc(alias = "g_socket_client_connect_to_uri")]
344    fn connect_to_uri(
345        &self,
346        uri: &str,
347        default_port: u16,
348        cancellable: Option<&impl IsA<Cancellable>>,
349    ) -> Result<SocketConnection, glib::Error> {
350        unsafe {
351            let mut error = std::ptr::null_mut();
352            let ret = ffi::g_socket_client_connect_to_uri(
353                self.as_ref().to_glib_none().0,
354                uri.to_glib_none().0,
355                default_port,
356                cancellable.map(|p| p.as_ref()).to_glib_none().0,
357                &mut error,
358            );
359            if error.is_null() {
360                Ok(from_glib_full(ret))
361            } else {
362                Err(from_glib_full(error))
363            }
364        }
365    }
366
367    #[doc(alias = "g_socket_client_connect_to_uri_async")]
368    fn connect_to_uri_async<P: FnOnce(Result<SocketConnection, glib::Error>) + 'static>(
369        &self,
370        uri: &str,
371        default_port: u16,
372        cancellable: Option<&impl IsA<Cancellable>>,
373        callback: P,
374    ) {
375        let main_context = glib::MainContext::ref_thread_default();
376        let is_main_context_owner = main_context.is_owner();
377        let has_acquired_main_context = (!is_main_context_owner)
378            .then(|| main_context.acquire().ok())
379            .flatten();
380        assert!(
381            is_main_context_owner || has_acquired_main_context.is_some(),
382            "Async operations only allowed if the thread is owning the MainContext"
383        );
384
385        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
386            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
387        unsafe extern "C" fn connect_to_uri_async_trampoline<
388            P: FnOnce(Result<SocketConnection, glib::Error>) + 'static,
389        >(
390            _source_object: *mut glib::gobject_ffi::GObject,
391            res: *mut crate::ffi::GAsyncResult,
392            user_data: glib::ffi::gpointer,
393        ) {
394            let mut error = std::ptr::null_mut();
395            let ret = ffi::g_socket_client_connect_to_uri_finish(
396                _source_object as *mut _,
397                res,
398                &mut error,
399            );
400            let result = if error.is_null() {
401                Ok(from_glib_full(ret))
402            } else {
403                Err(from_glib_full(error))
404            };
405            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
406                Box_::from_raw(user_data as *mut _);
407            let callback: P = callback.into_inner();
408            callback(result);
409        }
410        let callback = connect_to_uri_async_trampoline::<P>;
411        unsafe {
412            ffi::g_socket_client_connect_to_uri_async(
413                self.as_ref().to_glib_none().0,
414                uri.to_glib_none().0,
415                default_port,
416                cancellable.map(|p| p.as_ref()).to_glib_none().0,
417                Some(callback),
418                Box_::into_raw(user_data) as *mut _,
419            );
420        }
421    }
422
423    fn connect_to_uri_future(
424        &self,
425        uri: &str,
426        default_port: u16,
427    ) -> Pin<Box_<dyn std::future::Future<Output = Result<SocketConnection, glib::Error>> + 'static>>
428    {
429        let uri = String::from(uri);
430        Box_::pin(crate::GioFuture::new(
431            self,
432            move |obj, cancellable, send| {
433                obj.connect_to_uri_async(&uri, default_port, Some(cancellable), move |res| {
434                    send.resolve(res);
435                });
436            },
437        ))
438    }
439
440    #[doc(alias = "g_socket_client_get_enable_proxy")]
441    #[doc(alias = "get_enable_proxy")]
442    #[doc(alias = "enable-proxy")]
443    fn enables_proxy(&self) -> bool {
444        unsafe {
445            from_glib(ffi::g_socket_client_get_enable_proxy(
446                self.as_ref().to_glib_none().0,
447            ))
448        }
449    }
450
451    #[doc(alias = "g_socket_client_get_family")]
452    #[doc(alias = "get_family")]
453    fn family(&self) -> SocketFamily {
454        unsafe {
455            from_glib(ffi::g_socket_client_get_family(
456                self.as_ref().to_glib_none().0,
457            ))
458        }
459    }
460
461    #[doc(alias = "g_socket_client_get_local_address")]
462    #[doc(alias = "get_local_address")]
463    #[doc(alias = "local-address")]
464    fn local_address(&self) -> Option<SocketAddress> {
465        unsafe {
466            from_glib_none(ffi::g_socket_client_get_local_address(
467                self.as_ref().to_glib_none().0,
468            ))
469        }
470    }
471
472    #[doc(alias = "g_socket_client_get_protocol")]
473    #[doc(alias = "get_protocol")]
474    fn protocol(&self) -> SocketProtocol {
475        unsafe {
476            from_glib(ffi::g_socket_client_get_protocol(
477                self.as_ref().to_glib_none().0,
478            ))
479        }
480    }
481
482    #[doc(alias = "g_socket_client_get_proxy_resolver")]
483    #[doc(alias = "get_proxy_resolver")]
484    #[doc(alias = "proxy-resolver")]
485    fn proxy_resolver(&self) -> ProxyResolver {
486        unsafe {
487            from_glib_none(ffi::g_socket_client_get_proxy_resolver(
488                self.as_ref().to_glib_none().0,
489            ))
490        }
491    }
492
493    #[doc(alias = "g_socket_client_get_socket_type")]
494    #[doc(alias = "get_socket_type")]
495    fn socket_type(&self) -> SocketType {
496        unsafe {
497            from_glib(ffi::g_socket_client_get_socket_type(
498                self.as_ref().to_glib_none().0,
499            ))
500        }
501    }
502
503    #[doc(alias = "g_socket_client_get_timeout")]
504    #[doc(alias = "get_timeout")]
505    fn timeout(&self) -> u32 {
506        unsafe { ffi::g_socket_client_get_timeout(self.as_ref().to_glib_none().0) }
507    }
508
509    #[doc(alias = "g_socket_client_get_tls")]
510    #[doc(alias = "get_tls")]
511    #[doc(alias = "tls")]
512    fn is_tls(&self) -> bool {
513        unsafe { from_glib(ffi::g_socket_client_get_tls(self.as_ref().to_glib_none().0)) }
514    }
515
516    #[cfg_attr(feature = "v2_72", deprecated = "Since 2.72")]
517    #[allow(deprecated)]
518    #[doc(alias = "g_socket_client_get_tls_validation_flags")]
519    #[doc(alias = "get_tls_validation_flags")]
520    #[doc(alias = "tls-validation-flags")]
521    fn tls_validation_flags(&self) -> TlsCertificateFlags {
522        unsafe {
523            from_glib(ffi::g_socket_client_get_tls_validation_flags(
524                self.as_ref().to_glib_none().0,
525            ))
526        }
527    }
528
529    #[doc(alias = "g_socket_client_set_enable_proxy")]
530    #[doc(alias = "enable-proxy")]
531    fn set_enable_proxy(&self, enable: bool) {
532        unsafe {
533            ffi::g_socket_client_set_enable_proxy(
534                self.as_ref().to_glib_none().0,
535                enable.into_glib(),
536            );
537        }
538    }
539
540    #[doc(alias = "g_socket_client_set_family")]
541    #[doc(alias = "family")]
542    fn set_family(&self, family: SocketFamily) {
543        unsafe {
544            ffi::g_socket_client_set_family(self.as_ref().to_glib_none().0, family.into_glib());
545        }
546    }
547
548    #[doc(alias = "g_socket_client_set_local_address")]
549    #[doc(alias = "local-address")]
550    fn set_local_address(&self, address: Option<&impl IsA<SocketAddress>>) {
551        unsafe {
552            ffi::g_socket_client_set_local_address(
553                self.as_ref().to_glib_none().0,
554                address.map(|p| p.as_ref()).to_glib_none().0,
555            );
556        }
557    }
558
559    #[doc(alias = "g_socket_client_set_protocol")]
560    #[doc(alias = "protocol")]
561    fn set_protocol(&self, protocol: SocketProtocol) {
562        unsafe {
563            ffi::g_socket_client_set_protocol(self.as_ref().to_glib_none().0, protocol.into_glib());
564        }
565    }
566
567    #[doc(alias = "g_socket_client_set_proxy_resolver")]
568    #[doc(alias = "proxy-resolver")]
569    fn set_proxy_resolver(&self, proxy_resolver: Option<&impl IsA<ProxyResolver>>) {
570        unsafe {
571            ffi::g_socket_client_set_proxy_resolver(
572                self.as_ref().to_glib_none().0,
573                proxy_resolver.map(|p| p.as_ref()).to_glib_none().0,
574            );
575        }
576    }
577
578    #[doc(alias = "g_socket_client_set_socket_type")]
579    fn set_socket_type(&self, type_: SocketType) {
580        unsafe {
581            ffi::g_socket_client_set_socket_type(self.as_ref().to_glib_none().0, type_.into_glib());
582        }
583    }
584
585    #[doc(alias = "g_socket_client_set_timeout")]
586    #[doc(alias = "timeout")]
587    fn set_timeout(&self, timeout: u32) {
588        unsafe {
589            ffi::g_socket_client_set_timeout(self.as_ref().to_glib_none().0, timeout);
590        }
591    }
592
593    #[doc(alias = "g_socket_client_set_tls")]
594    #[doc(alias = "tls")]
595    fn set_tls(&self, tls: bool) {
596        unsafe {
597            ffi::g_socket_client_set_tls(self.as_ref().to_glib_none().0, tls.into_glib());
598        }
599    }
600
601    #[cfg_attr(feature = "v2_72", deprecated = "Since 2.72")]
602    #[allow(deprecated)]
603    #[doc(alias = "g_socket_client_set_tls_validation_flags")]
604    #[doc(alias = "tls-validation-flags")]
605    fn set_tls_validation_flags(&self, flags: TlsCertificateFlags) {
606        unsafe {
607            ffi::g_socket_client_set_tls_validation_flags(
608                self.as_ref().to_glib_none().0,
609                flags.into_glib(),
610            );
611        }
612    }
613
614    #[doc(alias = "type")]
615    fn type_(&self) -> SocketType {
616        ObjectExt::property(self.as_ref(), "type")
617    }
618
619    #[doc(alias = "type")]
620    fn set_type(&self, type_: SocketType) {
621        ObjectExt::set_property(self.as_ref(), "type", type_)
622    }
623
624    #[doc(alias = "event")]
625    fn connect_event<
626        F: Fn(&Self, SocketClientEvent, &SocketConnectable, Option<&IOStream>) + 'static,
627    >(
628        &self,
629        f: F,
630    ) -> SignalHandlerId {
631        unsafe extern "C" fn event_trampoline<
632            P: IsA<SocketClient>,
633            F: Fn(&P, SocketClientEvent, &SocketConnectable, Option<&IOStream>) + 'static,
634        >(
635            this: *mut ffi::GSocketClient,
636            event: ffi::GSocketClientEvent,
637            connectable: *mut ffi::GSocketConnectable,
638            connection: *mut ffi::GIOStream,
639            f: glib::ffi::gpointer,
640        ) {
641            let f: &F = &*(f as *const F);
642            f(
643                SocketClient::from_glib_borrow(this).unsafe_cast_ref(),
644                from_glib(event),
645                &from_glib_borrow(connectable),
646                Option::<IOStream>::from_glib_borrow(connection)
647                    .as_ref()
648                    .as_ref(),
649            )
650        }
651        unsafe {
652            let f: Box_<F> = Box_::new(f);
653            connect_raw(
654                self.as_ptr() as *mut _,
655                c"event".as_ptr() as *const _,
656                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
657                    event_trampoline::<Self, F> as *const (),
658                )),
659                Box_::into_raw(f),
660            )
661        }
662    }
663
664    #[doc(alias = "enable-proxy")]
665    fn connect_enable_proxy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
666        unsafe extern "C" fn notify_enable_proxy_trampoline<
667            P: IsA<SocketClient>,
668            F: Fn(&P) + 'static,
669        >(
670            this: *mut ffi::GSocketClient,
671            _param_spec: glib::ffi::gpointer,
672            f: glib::ffi::gpointer,
673        ) {
674            let f: &F = &*(f as *const F);
675            f(SocketClient::from_glib_borrow(this).unsafe_cast_ref())
676        }
677        unsafe {
678            let f: Box_<F> = Box_::new(f);
679            connect_raw(
680                self.as_ptr() as *mut _,
681                c"notify::enable-proxy".as_ptr() as *const _,
682                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
683                    notify_enable_proxy_trampoline::<Self, F> as *const (),
684                )),
685                Box_::into_raw(f),
686            )
687        }
688    }
689
690    #[doc(alias = "family")]
691    fn connect_family_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
692        unsafe extern "C" fn notify_family_trampoline<P: IsA<SocketClient>, F: Fn(&P) + 'static>(
693            this: *mut ffi::GSocketClient,
694            _param_spec: glib::ffi::gpointer,
695            f: glib::ffi::gpointer,
696        ) {
697            let f: &F = &*(f as *const F);
698            f(SocketClient::from_glib_borrow(this).unsafe_cast_ref())
699        }
700        unsafe {
701            let f: Box_<F> = Box_::new(f);
702            connect_raw(
703                self.as_ptr() as *mut _,
704                c"notify::family".as_ptr() as *const _,
705                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
706                    notify_family_trampoline::<Self, F> as *const (),
707                )),
708                Box_::into_raw(f),
709            )
710        }
711    }
712
713    #[doc(alias = "local-address")]
714    fn connect_local_address_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
715        unsafe extern "C" fn notify_local_address_trampoline<
716            P: IsA<SocketClient>,
717            F: Fn(&P) + 'static,
718        >(
719            this: *mut ffi::GSocketClient,
720            _param_spec: glib::ffi::gpointer,
721            f: glib::ffi::gpointer,
722        ) {
723            let f: &F = &*(f as *const F);
724            f(SocketClient::from_glib_borrow(this).unsafe_cast_ref())
725        }
726        unsafe {
727            let f: Box_<F> = Box_::new(f);
728            connect_raw(
729                self.as_ptr() as *mut _,
730                c"notify::local-address".as_ptr() as *const _,
731                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
732                    notify_local_address_trampoline::<Self, F> as *const (),
733                )),
734                Box_::into_raw(f),
735            )
736        }
737    }
738
739    #[doc(alias = "protocol")]
740    fn connect_protocol_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
741        unsafe extern "C" fn notify_protocol_trampoline<
742            P: IsA<SocketClient>,
743            F: Fn(&P) + 'static,
744        >(
745            this: *mut ffi::GSocketClient,
746            _param_spec: glib::ffi::gpointer,
747            f: glib::ffi::gpointer,
748        ) {
749            let f: &F = &*(f as *const F);
750            f(SocketClient::from_glib_borrow(this).unsafe_cast_ref())
751        }
752        unsafe {
753            let f: Box_<F> = Box_::new(f);
754            connect_raw(
755                self.as_ptr() as *mut _,
756                c"notify::protocol".as_ptr() as *const _,
757                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
758                    notify_protocol_trampoline::<Self, F> as *const (),
759                )),
760                Box_::into_raw(f),
761            )
762        }
763    }
764
765    #[doc(alias = "proxy-resolver")]
766    fn connect_proxy_resolver_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
767        unsafe extern "C" fn notify_proxy_resolver_trampoline<
768            P: IsA<SocketClient>,
769            F: Fn(&P) + 'static,
770        >(
771            this: *mut ffi::GSocketClient,
772            _param_spec: glib::ffi::gpointer,
773            f: glib::ffi::gpointer,
774        ) {
775            let f: &F = &*(f as *const F);
776            f(SocketClient::from_glib_borrow(this).unsafe_cast_ref())
777        }
778        unsafe {
779            let f: Box_<F> = Box_::new(f);
780            connect_raw(
781                self.as_ptr() as *mut _,
782                c"notify::proxy-resolver".as_ptr() as *const _,
783                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
784                    notify_proxy_resolver_trampoline::<Self, F> as *const (),
785                )),
786                Box_::into_raw(f),
787            )
788        }
789    }
790
791    #[doc(alias = "timeout")]
792    fn connect_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
793        unsafe extern "C" fn notify_timeout_trampoline<
794            P: IsA<SocketClient>,
795            F: Fn(&P) + 'static,
796        >(
797            this: *mut ffi::GSocketClient,
798            _param_spec: glib::ffi::gpointer,
799            f: glib::ffi::gpointer,
800        ) {
801            let f: &F = &*(f as *const F);
802            f(SocketClient::from_glib_borrow(this).unsafe_cast_ref())
803        }
804        unsafe {
805            let f: Box_<F> = Box_::new(f);
806            connect_raw(
807                self.as_ptr() as *mut _,
808                c"notify::timeout".as_ptr() as *const _,
809                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
810                    notify_timeout_trampoline::<Self, F> as *const (),
811                )),
812                Box_::into_raw(f),
813            )
814        }
815    }
816
817    #[doc(alias = "tls")]
818    fn connect_tls_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
819        unsafe extern "C" fn notify_tls_trampoline<P: IsA<SocketClient>, F: Fn(&P) + 'static>(
820            this: *mut ffi::GSocketClient,
821            _param_spec: glib::ffi::gpointer,
822            f: glib::ffi::gpointer,
823        ) {
824            let f: &F = &*(f as *const F);
825            f(SocketClient::from_glib_borrow(this).unsafe_cast_ref())
826        }
827        unsafe {
828            let f: Box_<F> = Box_::new(f);
829            connect_raw(
830                self.as_ptr() as *mut _,
831                c"notify::tls".as_ptr() as *const _,
832                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
833                    notify_tls_trampoline::<Self, F> as *const (),
834                )),
835                Box_::into_raw(f),
836            )
837        }
838    }
839
840    #[cfg_attr(feature = "v2_72", deprecated = "Since 2.72")]
841    #[doc(alias = "tls-validation-flags")]
842    fn connect_tls_validation_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
843        unsafe extern "C" fn notify_tls_validation_flags_trampoline<
844            P: IsA<SocketClient>,
845            F: Fn(&P) + 'static,
846        >(
847            this: *mut ffi::GSocketClient,
848            _param_spec: glib::ffi::gpointer,
849            f: glib::ffi::gpointer,
850        ) {
851            let f: &F = &*(f as *const F);
852            f(SocketClient::from_glib_borrow(this).unsafe_cast_ref())
853        }
854        unsafe {
855            let f: Box_<F> = Box_::new(f);
856            connect_raw(
857                self.as_ptr() as *mut _,
858                c"notify::tls-validation-flags".as_ptr() as *const _,
859                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
860                    notify_tls_validation_flags_trampoline::<Self, F> as *const (),
861                )),
862                Box_::into_raw(f),
863            )
864        }
865    }
866
867    #[doc(alias = "type")]
868    fn connect_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
869        unsafe extern "C" fn notify_type_trampoline<P: IsA<SocketClient>, F: Fn(&P) + 'static>(
870            this: *mut ffi::GSocketClient,
871            _param_spec: glib::ffi::gpointer,
872            f: glib::ffi::gpointer,
873        ) {
874            let f: &F = &*(f as *const F);
875            f(SocketClient::from_glib_borrow(this).unsafe_cast_ref())
876        }
877        unsafe {
878            let f: Box_<F> = Box_::new(f);
879            connect_raw(
880                self.as_ptr() as *mut _,
881                c"notify::type".as_ptr() as *const _,
882                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
883                    notify_type_trampoline::<Self, F> as *const (),
884                )),
885                Box_::into_raw(f),
886            )
887        }
888    }
889}
890
891impl<O: IsA<SocketClient>> SocketClientExt for O {}