soup/auto/
message.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{
7    ffi, Auth, HTTPVersion, MessageFlags, MessageHeaders, MessageMetrics, MessagePriority,
8    Multipart, Status,
9};
10use glib::{
11    object::ObjectType as _,
12    prelude::*,
13    signal::{connect_raw, SignalHandlerId},
14    translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19    #[doc(alias = "SoupMessage")]
20    pub struct Message(Object<ffi::SoupMessage, ffi::SoupMessageClass>);
21
22    match fn {
23        type_ => || ffi::soup_message_get_type(),
24    }
25}
26
27impl Message {
28    #[doc(alias = "soup_message_new")]
29    pub fn new(method: &str, uri_string: &str) -> Result<Message, glib::BoolError> {
30        assert_initialized_main_thread!();
31        unsafe {
32            Option::<_>::from_glib_full(ffi::soup_message_new(
33                method.to_glib_none().0,
34                uri_string.to_glib_none().0,
35            ))
36            .ok_or_else(|| glib::bool_error!("Invalid URL"))
37        }
38    }
39
40    #[doc(alias = "soup_message_new_from_encoded_form")]
41    #[doc(alias = "new_from_encoded_form")]
42    pub fn from_encoded_form(
43        method: &str,
44        uri_string: &str,
45        encoded_form: glib::GString,
46    ) -> Result<Message, glib::BoolError> {
47        assert_initialized_main_thread!();
48        unsafe {
49            Option::<_>::from_glib_full(ffi::soup_message_new_from_encoded_form(
50                method.to_glib_none().0,
51                uri_string.to_glib_none().0,
52                encoded_form.into_glib_ptr(),
53            ))
54            .ok_or_else(|| glib::bool_error!("Invalid URL"))
55        }
56    }
57
58    #[doc(alias = "soup_message_new_from_multipart")]
59    #[doc(alias = "new_from_multipart")]
60    pub fn from_multipart(
61        uri_string: &str,
62        multipart: &mut Multipart,
63    ) -> Result<Message, glib::BoolError> {
64        assert_initialized_main_thread!();
65        unsafe {
66            Option::<_>::from_glib_full(ffi::soup_message_new_from_multipart(
67                uri_string.to_glib_none().0,
68                multipart.to_glib_none_mut().0,
69            ))
70            .ok_or_else(|| glib::bool_error!("Invalid URL"))
71        }
72    }
73
74    #[doc(alias = "soup_message_new_from_uri")]
75    #[doc(alias = "new_from_uri")]
76    pub fn from_uri(method: &str, uri: &glib::Uri) -> Message {
77        assert_initialized_main_thread!();
78        unsafe {
79            from_glib_full(ffi::soup_message_new_from_uri(
80                method.to_glib_none().0,
81                uri.to_glib_none().0,
82            ))
83        }
84    }
85
86    #[doc(alias = "soup_message_new_options_ping")]
87    pub fn new_options_ping(base_uri: &glib::Uri) -> Message {
88        assert_initialized_main_thread!();
89        unsafe {
90            from_glib_full(ffi::soup_message_new_options_ping(
91                base_uri.to_glib_none().0,
92            ))
93        }
94    }
95
96    // rustdoc-stripper-ignore-next
97    /// Creates a new builder-pattern struct instance to construct [`Message`] objects.
98    ///
99    /// This method returns an instance of [`MessageBuilder`](crate::builders::MessageBuilder) which can be used to create [`Message`] objects.
100    pub fn builder() -> MessageBuilder {
101        MessageBuilder::new()
102    }
103
104    #[doc(alias = "soup_message_add_flags")]
105    pub fn add_flags(&self, flags: MessageFlags) {
106        unsafe {
107            ffi::soup_message_add_flags(self.to_glib_none().0, flags.into_glib());
108        }
109    }
110
111    //#[doc(alias = "soup_message_add_header_handler")]
112    //pub fn add_header_handler<P: Fn() + 'static>(&self, signal: &str, header: &str, callback: P, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> u32 {
113    //    unsafe { TODO: call ffi:soup_message_add_header_handler() }
114    //}
115
116    //#[doc(alias = "soup_message_add_status_code_handler")]
117    //pub fn add_status_code_handler<P: Fn() + 'static>(&self, signal: &str, status_code: u32, callback: P, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> u32 {
118    //    unsafe { TODO: call ffi:soup_message_add_status_code_handler() }
119    //}
120
121    #[doc(alias = "soup_message_disable_feature")]
122    pub fn disable_feature(&self, feature_type: glib::types::Type) {
123        unsafe {
124            ffi::soup_message_disable_feature(self.to_glib_none().0, feature_type.into_glib());
125        }
126    }
127
128    #[doc(alias = "soup_message_get_connection_id")]
129    #[doc(alias = "get_connection_id")]
130    pub fn connection_id(&self) -> u64 {
131        unsafe { ffi::soup_message_get_connection_id(self.to_glib_none().0) }
132    }
133
134    #[doc(alias = "soup_message_get_first_party")]
135    #[doc(alias = "get_first_party")]
136    #[doc(alias = "first-party")]
137    pub fn first_party(&self) -> Option<glib::Uri> {
138        unsafe { from_glib_none(ffi::soup_message_get_first_party(self.to_glib_none().0)) }
139    }
140
141    #[doc(alias = "soup_message_get_flags")]
142    #[doc(alias = "get_flags")]
143    pub fn flags(&self) -> MessageFlags {
144        unsafe { from_glib(ffi::soup_message_get_flags(self.to_glib_none().0)) }
145    }
146
147    #[cfg(feature = "v3_4")]
148    #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))]
149    #[doc(alias = "soup_message_get_force_http1")]
150    #[doc(alias = "get_force_http1")]
151    pub fn is_force_http1(&self) -> bool {
152        unsafe { from_glib(ffi::soup_message_get_force_http1(self.to_glib_none().0)) }
153    }
154
155    #[doc(alias = "soup_message_get_http_version")]
156    #[doc(alias = "get_http_version")]
157    #[doc(alias = "http-version")]
158    pub fn http_version(&self) -> HTTPVersion {
159        unsafe { from_glib(ffi::soup_message_get_http_version(self.to_glib_none().0)) }
160    }
161
162    #[doc(alias = "soup_message_get_is_options_ping")]
163    #[doc(alias = "get_is_options_ping")]
164    #[doc(alias = "is-options-ping")]
165    pub fn is_options_ping(&self) -> bool {
166        unsafe { from_glib(ffi::soup_message_get_is_options_ping(self.to_glib_none().0)) }
167    }
168
169    #[doc(alias = "soup_message_get_is_top_level_navigation")]
170    #[doc(alias = "get_is_top_level_navigation")]
171    #[doc(alias = "is-top-level-navigation")]
172    pub fn is_top_level_navigation(&self) -> bool {
173        unsafe {
174            from_glib(ffi::soup_message_get_is_top_level_navigation(
175                self.to_glib_none().0,
176            ))
177        }
178    }
179
180    #[doc(alias = "soup_message_get_method")]
181    #[doc(alias = "get_method")]
182    pub fn method(&self) -> Option<glib::GString> {
183        unsafe { from_glib_none(ffi::soup_message_get_method(self.to_glib_none().0)) }
184    }
185
186    #[doc(alias = "soup_message_get_metrics")]
187    #[doc(alias = "get_metrics")]
188    pub fn metrics(&self) -> Option<MessageMetrics> {
189        unsafe { from_glib_none(ffi::soup_message_get_metrics(self.to_glib_none().0)) }
190    }
191
192    #[doc(alias = "soup_message_get_priority")]
193    #[doc(alias = "get_priority")]
194    pub fn priority(&self) -> MessagePriority {
195        unsafe { from_glib(ffi::soup_message_get_priority(self.to_glib_none().0)) }
196    }
197
198    #[doc(alias = "soup_message_get_reason_phrase")]
199    #[doc(alias = "get_reason_phrase")]
200    #[doc(alias = "reason-phrase")]
201    pub fn reason_phrase(&self) -> Option<glib::GString> {
202        unsafe { from_glib_none(ffi::soup_message_get_reason_phrase(self.to_glib_none().0)) }
203    }
204
205    #[doc(alias = "soup_message_get_remote_address")]
206    #[doc(alias = "get_remote_address")]
207    #[doc(alias = "remote-address")]
208    pub fn remote_address(&self) -> Option<gio::SocketAddress> {
209        unsafe { from_glib_none(ffi::soup_message_get_remote_address(self.to_glib_none().0)) }
210    }
211
212    #[doc(alias = "soup_message_get_request_headers")]
213    #[doc(alias = "get_request_headers")]
214    #[doc(alias = "request-headers")]
215    pub fn request_headers(&self) -> Option<MessageHeaders> {
216        unsafe { from_glib_none(ffi::soup_message_get_request_headers(self.to_glib_none().0)) }
217    }
218
219    #[doc(alias = "soup_message_get_response_headers")]
220    #[doc(alias = "get_response_headers")]
221    #[doc(alias = "response-headers")]
222    pub fn response_headers(&self) -> Option<MessageHeaders> {
223        unsafe {
224            from_glib_none(ffi::soup_message_get_response_headers(
225                self.to_glib_none().0,
226            ))
227        }
228    }
229
230    #[doc(alias = "soup_message_get_status")]
231    #[doc(alias = "get_status")]
232    pub fn status(&self) -> Status {
233        unsafe { from_glib(ffi::soup_message_get_status(self.to_glib_none().0)) }
234    }
235
236    #[doc(alias = "soup_message_get_tls_ciphersuite_name")]
237    #[doc(alias = "get_tls_ciphersuite_name")]
238    #[doc(alias = "tls-ciphersuite-name")]
239    pub fn tls_ciphersuite_name(&self) -> Option<glib::GString> {
240        unsafe {
241            from_glib_none(ffi::soup_message_get_tls_ciphersuite_name(
242                self.to_glib_none().0,
243            ))
244        }
245    }
246
247    #[doc(alias = "soup_message_get_tls_peer_certificate")]
248    #[doc(alias = "get_tls_peer_certificate")]
249    #[doc(alias = "tls-peer-certificate")]
250    pub fn tls_peer_certificate(&self) -> Option<gio::TlsCertificate> {
251        unsafe {
252            from_glib_none(ffi::soup_message_get_tls_peer_certificate(
253                self.to_glib_none().0,
254            ))
255        }
256    }
257
258    #[doc(alias = "soup_message_get_tls_peer_certificate_errors")]
259    #[doc(alias = "get_tls_peer_certificate_errors")]
260    #[doc(alias = "tls-peer-certificate-errors")]
261    pub fn tls_peer_certificate_errors(&self) -> gio::TlsCertificateFlags {
262        unsafe {
263            from_glib(ffi::soup_message_get_tls_peer_certificate_errors(
264                self.to_glib_none().0,
265            ))
266        }
267    }
268
269    #[doc(alias = "soup_message_get_tls_protocol_version")]
270    #[doc(alias = "get_tls_protocol_version")]
271    #[doc(alias = "tls-protocol-version")]
272    pub fn tls_protocol_version(&self) -> gio::TlsProtocolVersion {
273        unsafe {
274            from_glib(ffi::soup_message_get_tls_protocol_version(
275                self.to_glib_none().0,
276            ))
277        }
278    }
279
280    #[doc(alias = "soup_message_get_uri")]
281    #[doc(alias = "get_uri")]
282    #[doc(alias = "method")]
283    pub fn uri(&self) -> Option<glib::Uri> {
284        unsafe { from_glib_none(ffi::soup_message_get_uri(self.to_glib_none().0)) }
285    }
286
287    #[doc(alias = "soup_message_is_feature_disabled")]
288    pub fn is_feature_disabled(&self, feature_type: glib::types::Type) -> bool {
289        unsafe {
290            from_glib(ffi::soup_message_is_feature_disabled(
291                self.to_glib_none().0,
292                feature_type.into_glib(),
293            ))
294        }
295    }
296
297    #[doc(alias = "soup_message_is_keepalive")]
298    pub fn is_keepalive(&self) -> bool {
299        unsafe { from_glib(ffi::soup_message_is_keepalive(self.to_glib_none().0)) }
300    }
301
302    #[doc(alias = "soup_message_query_flags")]
303    pub fn query_flags(&self, flags: MessageFlags) -> bool {
304        unsafe {
305            from_glib(ffi::soup_message_query_flags(
306                self.to_glib_none().0,
307                flags.into_glib(),
308            ))
309        }
310    }
311
312    #[doc(alias = "soup_message_remove_flags")]
313    pub fn remove_flags(&self, flags: MessageFlags) {
314        unsafe {
315            ffi::soup_message_remove_flags(self.to_glib_none().0, flags.into_glib());
316        }
317    }
318
319    #[doc(alias = "soup_message_set_first_party")]
320    #[doc(alias = "first-party")]
321    pub fn set_first_party(&self, first_party: &glib::Uri) {
322        unsafe {
323            ffi::soup_message_set_first_party(self.to_glib_none().0, first_party.to_glib_none().0);
324        }
325    }
326
327    #[doc(alias = "soup_message_set_flags")]
328    #[doc(alias = "flags")]
329    pub fn set_flags(&self, flags: MessageFlags) {
330        unsafe {
331            ffi::soup_message_set_flags(self.to_glib_none().0, flags.into_glib());
332        }
333    }
334
335    #[cfg(feature = "v3_4")]
336    #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))]
337    #[doc(alias = "soup_message_set_force_http1")]
338    pub fn set_force_http1(&self, value: bool) {
339        unsafe {
340            ffi::soup_message_set_force_http1(self.to_glib_none().0, value.into_glib());
341        }
342    }
343
344    #[doc(alias = "soup_message_set_is_options_ping")]
345    #[doc(alias = "is-options-ping")]
346    pub fn set_is_options_ping(&self, is_options_ping: bool) {
347        unsafe {
348            ffi::soup_message_set_is_options_ping(
349                self.to_glib_none().0,
350                is_options_ping.into_glib(),
351            );
352        }
353    }
354
355    #[doc(alias = "soup_message_set_is_top_level_navigation")]
356    #[doc(alias = "is-top-level-navigation")]
357    pub fn set_is_top_level_navigation(&self, is_top_level_navigation: bool) {
358        unsafe {
359            ffi::soup_message_set_is_top_level_navigation(
360                self.to_glib_none().0,
361                is_top_level_navigation.into_glib(),
362            );
363        }
364    }
365
366    #[doc(alias = "soup_message_set_method")]
367    #[doc(alias = "method")]
368    pub fn set_method(&self, method: &str) {
369        unsafe {
370            ffi::soup_message_set_method(self.to_glib_none().0, method.to_glib_none().0);
371        }
372    }
373
374    #[doc(alias = "soup_message_set_priority")]
375    #[doc(alias = "priority")]
376    pub fn set_priority(&self, priority: MessagePriority) {
377        unsafe {
378            ffi::soup_message_set_priority(self.to_glib_none().0, priority.into_glib());
379        }
380    }
381
382    #[doc(alias = "soup_message_set_request_body")]
383    pub fn set_request_body(
384        &self,
385        content_type: Option<&str>,
386        stream: Option<&impl IsA<gio::InputStream>>,
387        content_length: isize,
388    ) {
389        unsafe {
390            ffi::soup_message_set_request_body(
391                self.to_glib_none().0,
392                content_type.to_glib_none().0,
393                stream.map(|p| p.as_ref()).to_glib_none().0,
394                content_length,
395            );
396        }
397    }
398
399    #[doc(alias = "soup_message_set_request_body_from_bytes")]
400    pub fn set_request_body_from_bytes(
401        &self,
402        content_type: Option<&str>,
403        bytes: Option<&glib::Bytes>,
404    ) {
405        unsafe {
406            ffi::soup_message_set_request_body_from_bytes(
407                self.to_glib_none().0,
408                content_type.to_glib_none().0,
409                bytes.to_glib_none().0,
410            );
411        }
412    }
413
414    #[doc(alias = "soup_message_set_tls_client_certificate")]
415    pub fn set_tls_client_certificate(&self, certificate: Option<&impl IsA<gio::TlsCertificate>>) {
416        unsafe {
417            ffi::soup_message_set_tls_client_certificate(
418                self.to_glib_none().0,
419                certificate.map(|p| p.as_ref()).to_glib_none().0,
420            );
421        }
422    }
423
424    #[doc(alias = "soup_message_set_uri")]
425    #[doc(alias = "method")]
426    pub fn set_uri(&self, uri: &glib::Uri) {
427        unsafe {
428            ffi::soup_message_set_uri(self.to_glib_none().0, uri.to_glib_none().0);
429        }
430    }
431
432    #[doc(alias = "soup_message_tls_client_certificate_password_request_complete")]
433    pub fn tls_client_certificate_password_request_complete(&self) {
434        unsafe {
435            ffi::soup_message_tls_client_certificate_password_request_complete(
436                self.to_glib_none().0,
437            );
438        }
439    }
440
441    #[doc(alias = "site-for-cookies")]
442    pub fn site_for_cookies(&self) -> Option<glib::Uri> {
443        ObjectExt::property(self, "site-for-cookies")
444    }
445
446    #[doc(alias = "site-for-cookies")]
447    pub fn set_site_for_cookies(&self, site_for_cookies: Option<&glib::Uri>) {
448        ObjectExt::set_property(self, "site-for-cookies", site_for_cookies)
449    }
450
451    #[doc(alias = "status-code")]
452    pub fn status_code(&self) -> u32 {
453        ObjectExt::property(self, "status-code")
454    }
455
456    #[doc(alias = "accept-certificate")]
457    pub fn connect_accept_certificate<
458        F: Fn(&Self, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static,
459    >(
460        &self,
461        f: F,
462    ) -> SignalHandlerId {
463        unsafe extern "C" fn accept_certificate_trampoline<
464            F: Fn(&Message, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static,
465        >(
466            this: *mut ffi::SoupMessage,
467            tls_peer_certificate: *mut gio::ffi::GTlsCertificate,
468            tls_peer_errors: gio::ffi::GTlsCertificateFlags,
469            f: glib::ffi::gpointer,
470        ) -> glib::ffi::gboolean {
471            let f: &F = &*(f as *const F);
472            f(
473                &from_glib_borrow(this),
474                &from_glib_borrow(tls_peer_certificate),
475                from_glib(tls_peer_errors),
476            )
477            .into_glib()
478        }
479        unsafe {
480            let f: Box_<F> = Box_::new(f);
481            connect_raw(
482                self.as_ptr() as *mut _,
483                c"accept-certificate".as_ptr() as *const _,
484                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
485                    accept_certificate_trampoline::<F> as *const (),
486                )),
487                Box_::into_raw(f),
488            )
489        }
490    }
491
492    #[doc(alias = "authenticate")]
493    pub fn connect_authenticate<F: Fn(&Self, &Auth, bool) -> bool + 'static>(
494        &self,
495        f: F,
496    ) -> SignalHandlerId {
497        unsafe extern "C" fn authenticate_trampoline<
498            F: Fn(&Message, &Auth, bool) -> bool + 'static,
499        >(
500            this: *mut ffi::SoupMessage,
501            auth: *mut ffi::SoupAuth,
502            retrying: glib::ffi::gboolean,
503            f: glib::ffi::gpointer,
504        ) -> glib::ffi::gboolean {
505            let f: &F = &*(f as *const F);
506            f(
507                &from_glib_borrow(this),
508                &from_glib_borrow(auth),
509                from_glib(retrying),
510            )
511            .into_glib()
512        }
513        unsafe {
514            let f: Box_<F> = Box_::new(f);
515            connect_raw(
516                self.as_ptr() as *mut _,
517                c"authenticate".as_ptr() as *const _,
518                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
519                    authenticate_trampoline::<F> as *const (),
520                )),
521                Box_::into_raw(f),
522            )
523        }
524    }
525
526    //#[doc(alias = "content-sniffed")]
527    //pub fn connect_content_sniffed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
528    //    Empty ctype params: *.HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }
529    //}
530
531    #[doc(alias = "finished")]
532    pub fn connect_finished<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
533        unsafe extern "C" fn finished_trampoline<F: Fn(&Message) + 'static>(
534            this: *mut ffi::SoupMessage,
535            f: glib::ffi::gpointer,
536        ) {
537            let f: &F = &*(f as *const F);
538            f(&from_glib_borrow(this))
539        }
540        unsafe {
541            let f: Box_<F> = Box_::new(f);
542            connect_raw(
543                self.as_ptr() as *mut _,
544                c"finished".as_ptr() as *const _,
545                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
546                    finished_trampoline::<F> as *const (),
547                )),
548                Box_::into_raw(f),
549            )
550        }
551    }
552
553    #[doc(alias = "got-body")]
554    pub fn connect_got_body<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
555        unsafe extern "C" fn got_body_trampoline<F: Fn(&Message) + 'static>(
556            this: *mut ffi::SoupMessage,
557            f: glib::ffi::gpointer,
558        ) {
559            let f: &F = &*(f as *const F);
560            f(&from_glib_borrow(this))
561        }
562        unsafe {
563            let f: Box_<F> = Box_::new(f);
564            connect_raw(
565                self.as_ptr() as *mut _,
566                c"got-body".as_ptr() as *const _,
567                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
568                    got_body_trampoline::<F> as *const (),
569                )),
570                Box_::into_raw(f),
571            )
572        }
573    }
574
575    #[cfg(feature = "v3_4")]
576    #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))]
577    #[doc(alias = "got-body-data")]
578    pub fn connect_got_body_data<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
579        unsafe extern "C" fn got_body_data_trampoline<F: Fn(&Message, u32) + 'static>(
580            this: *mut ffi::SoupMessage,
581            chunk_size: std::ffi::c_uint,
582            f: glib::ffi::gpointer,
583        ) {
584            let f: &F = &*(f as *const F);
585            f(&from_glib_borrow(this), chunk_size)
586        }
587        unsafe {
588            let f: Box_<F> = Box_::new(f);
589            connect_raw(
590                self.as_ptr() as *mut _,
591                c"got-body-data".as_ptr() as *const _,
592                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
593                    got_body_data_trampoline::<F> as *const (),
594                )),
595                Box_::into_raw(f),
596            )
597        }
598    }
599
600    #[doc(alias = "got-headers")]
601    pub fn connect_got_headers<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
602        unsafe extern "C" fn got_headers_trampoline<F: Fn(&Message) + 'static>(
603            this: *mut ffi::SoupMessage,
604            f: glib::ffi::gpointer,
605        ) {
606            let f: &F = &*(f as *const F);
607            f(&from_glib_borrow(this))
608        }
609        unsafe {
610            let f: Box_<F> = Box_::new(f);
611            connect_raw(
612                self.as_ptr() as *mut _,
613                c"got-headers".as_ptr() as *const _,
614                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
615                    got_headers_trampoline::<F> as *const (),
616                )),
617                Box_::into_raw(f),
618            )
619        }
620    }
621
622    #[doc(alias = "got-informational")]
623    pub fn connect_got_informational<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
624        unsafe extern "C" fn got_informational_trampoline<F: Fn(&Message) + 'static>(
625            this: *mut ffi::SoupMessage,
626            f: glib::ffi::gpointer,
627        ) {
628            let f: &F = &*(f as *const F);
629            f(&from_glib_borrow(this))
630        }
631        unsafe {
632            let f: Box_<F> = Box_::new(f);
633            connect_raw(
634                self.as_ptr() as *mut _,
635                c"got-informational".as_ptr() as *const _,
636                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
637                    got_informational_trampoline::<F> as *const (),
638                )),
639                Box_::into_raw(f),
640            )
641        }
642    }
643
644    #[doc(alias = "hsts-enforced")]
645    pub fn connect_hsts_enforced<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
646        unsafe extern "C" fn hsts_enforced_trampoline<F: Fn(&Message) + 'static>(
647            this: *mut ffi::SoupMessage,
648            f: glib::ffi::gpointer,
649        ) {
650            let f: &F = &*(f as *const F);
651            f(&from_glib_borrow(this))
652        }
653        unsafe {
654            let f: Box_<F> = Box_::new(f);
655            connect_raw(
656                self.as_ptr() as *mut _,
657                c"hsts-enforced".as_ptr() as *const _,
658                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
659                    hsts_enforced_trampoline::<F> as *const (),
660                )),
661                Box_::into_raw(f),
662            )
663        }
664    }
665
666    #[doc(alias = "network-event")]
667    pub fn connect_network_event<F: Fn(&Self, gio::SocketClientEvent, &gio::IOStream) + 'static>(
668        &self,
669        f: F,
670    ) -> SignalHandlerId {
671        unsafe extern "C" fn network_event_trampoline<
672            F: Fn(&Message, gio::SocketClientEvent, &gio::IOStream) + 'static,
673        >(
674            this: *mut ffi::SoupMessage,
675            event: gio::ffi::GSocketClientEvent,
676            connection: *mut gio::ffi::GIOStream,
677            f: glib::ffi::gpointer,
678        ) {
679            let f: &F = &*(f as *const F);
680            f(
681                &from_glib_borrow(this),
682                from_glib(event),
683                &from_glib_borrow(connection),
684            )
685        }
686        unsafe {
687            let f: Box_<F> = Box_::new(f);
688            connect_raw(
689                self.as_ptr() as *mut _,
690                c"network-event".as_ptr() as *const _,
691                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
692                    network_event_trampoline::<F> as *const (),
693                )),
694                Box_::into_raw(f),
695            )
696        }
697    }
698
699    #[doc(alias = "request-certificate")]
700    pub fn connect_request_certificate<
701        F: Fn(&Self, &gio::TlsClientConnection) -> bool + 'static,
702    >(
703        &self,
704        f: F,
705    ) -> SignalHandlerId {
706        unsafe extern "C" fn request_certificate_trampoline<
707            F: Fn(&Message, &gio::TlsClientConnection) -> bool + 'static,
708        >(
709            this: *mut ffi::SoupMessage,
710            tls_connection: *mut gio::ffi::GTlsClientConnection,
711            f: glib::ffi::gpointer,
712        ) -> glib::ffi::gboolean {
713            let f: &F = &*(f as *const F);
714            f(&from_glib_borrow(this), &from_glib_borrow(tls_connection)).into_glib()
715        }
716        unsafe {
717            let f: Box_<F> = Box_::new(f);
718            connect_raw(
719                self.as_ptr() as *mut _,
720                c"request-certificate".as_ptr() as *const _,
721                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
722                    request_certificate_trampoline::<F> as *const (),
723                )),
724                Box_::into_raw(f),
725            )
726        }
727    }
728
729    #[doc(alias = "request-certificate-password")]
730    pub fn connect_request_certificate_password<
731        F: Fn(&Self, &gio::TlsPassword) -> bool + 'static,
732    >(
733        &self,
734        f: F,
735    ) -> SignalHandlerId {
736        unsafe extern "C" fn request_certificate_password_trampoline<
737            F: Fn(&Message, &gio::TlsPassword) -> bool + 'static,
738        >(
739            this: *mut ffi::SoupMessage,
740            tls_password: *mut gio::ffi::GTlsPassword,
741            f: glib::ffi::gpointer,
742        ) -> glib::ffi::gboolean {
743            let f: &F = &*(f as *const F);
744            f(&from_glib_borrow(this), &from_glib_borrow(tls_password)).into_glib()
745        }
746        unsafe {
747            let f: Box_<F> = Box_::new(f);
748            connect_raw(
749                self.as_ptr() as *mut _,
750                c"request-certificate-password".as_ptr() as *const _,
751                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
752                    request_certificate_password_trampoline::<F> as *const (),
753                )),
754                Box_::into_raw(f),
755            )
756        }
757    }
758
759    #[doc(alias = "restarted")]
760    pub fn connect_restarted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
761        unsafe extern "C" fn restarted_trampoline<F: Fn(&Message) + 'static>(
762            this: *mut ffi::SoupMessage,
763            f: glib::ffi::gpointer,
764        ) {
765            let f: &F = &*(f as *const F);
766            f(&from_glib_borrow(this))
767        }
768        unsafe {
769            let f: Box_<F> = Box_::new(f);
770            connect_raw(
771                self.as_ptr() as *mut _,
772                c"restarted".as_ptr() as *const _,
773                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
774                    restarted_trampoline::<F> as *const (),
775                )),
776                Box_::into_raw(f),
777            )
778        }
779    }
780
781    #[doc(alias = "starting")]
782    pub fn connect_starting<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
783        unsafe extern "C" fn starting_trampoline<F: Fn(&Message) + 'static>(
784            this: *mut ffi::SoupMessage,
785            f: glib::ffi::gpointer,
786        ) {
787            let f: &F = &*(f as *const F);
788            f(&from_glib_borrow(this))
789        }
790        unsafe {
791            let f: Box_<F> = Box_::new(f);
792            connect_raw(
793                self.as_ptr() as *mut _,
794                c"starting".as_ptr() as *const _,
795                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
796                    starting_trampoline::<F> as *const (),
797                )),
798                Box_::into_raw(f),
799            )
800        }
801    }
802
803    #[doc(alias = "wrote-body")]
804    pub fn connect_wrote_body<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
805        unsafe extern "C" fn wrote_body_trampoline<F: Fn(&Message) + 'static>(
806            this: *mut ffi::SoupMessage,
807            f: glib::ffi::gpointer,
808        ) {
809            let f: &F = &*(f as *const F);
810            f(&from_glib_borrow(this))
811        }
812        unsafe {
813            let f: Box_<F> = Box_::new(f);
814            connect_raw(
815                self.as_ptr() as *mut _,
816                c"wrote-body".as_ptr() as *const _,
817                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
818                    wrote_body_trampoline::<F> as *const (),
819                )),
820                Box_::into_raw(f),
821            )
822        }
823    }
824
825    #[doc(alias = "wrote-body-data")]
826    pub fn connect_wrote_body_data<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
827        unsafe extern "C" fn wrote_body_data_trampoline<F: Fn(&Message, u32) + 'static>(
828            this: *mut ffi::SoupMessage,
829            chunk_size: std::ffi::c_uint,
830            f: glib::ffi::gpointer,
831        ) {
832            let f: &F = &*(f as *const F);
833            f(&from_glib_borrow(this), chunk_size)
834        }
835        unsafe {
836            let f: Box_<F> = Box_::new(f);
837            connect_raw(
838                self.as_ptr() as *mut _,
839                c"wrote-body-data".as_ptr() as *const _,
840                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
841                    wrote_body_data_trampoline::<F> as *const (),
842                )),
843                Box_::into_raw(f),
844            )
845        }
846    }
847
848    #[doc(alias = "wrote-headers")]
849    pub fn connect_wrote_headers<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
850        unsafe extern "C" fn wrote_headers_trampoline<F: Fn(&Message) + 'static>(
851            this: *mut ffi::SoupMessage,
852            f: glib::ffi::gpointer,
853        ) {
854            let f: &F = &*(f as *const F);
855            f(&from_glib_borrow(this))
856        }
857        unsafe {
858            let f: Box_<F> = Box_::new(f);
859            connect_raw(
860                self.as_ptr() as *mut _,
861                c"wrote-headers".as_ptr() as *const _,
862                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
863                    wrote_headers_trampoline::<F> as *const (),
864                )),
865                Box_::into_raw(f),
866            )
867        }
868    }
869
870    #[doc(alias = "first-party")]
871    pub fn connect_first_party_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
872        unsafe extern "C" fn notify_first_party_trampoline<F: Fn(&Message) + 'static>(
873            this: *mut ffi::SoupMessage,
874            _param_spec: glib::ffi::gpointer,
875            f: glib::ffi::gpointer,
876        ) {
877            let f: &F = &*(f as *const F);
878            f(&from_glib_borrow(this))
879        }
880        unsafe {
881            let f: Box_<F> = Box_::new(f);
882            connect_raw(
883                self.as_ptr() as *mut _,
884                c"notify::first-party".as_ptr() as *const _,
885                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
886                    notify_first_party_trampoline::<F> as *const (),
887                )),
888                Box_::into_raw(f),
889            )
890        }
891    }
892
893    #[doc(alias = "flags")]
894    pub fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
895        unsafe extern "C" fn notify_flags_trampoline<F: Fn(&Message) + 'static>(
896            this: *mut ffi::SoupMessage,
897            _param_spec: glib::ffi::gpointer,
898            f: glib::ffi::gpointer,
899        ) {
900            let f: &F = &*(f as *const F);
901            f(&from_glib_borrow(this))
902        }
903        unsafe {
904            let f: Box_<F> = Box_::new(f);
905            connect_raw(
906                self.as_ptr() as *mut _,
907                c"notify::flags".as_ptr() as *const _,
908                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
909                    notify_flags_trampoline::<F> as *const (),
910                )),
911                Box_::into_raw(f),
912            )
913        }
914    }
915
916    #[doc(alias = "http-version")]
917    pub fn connect_http_version_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
918        unsafe extern "C" fn notify_http_version_trampoline<F: Fn(&Message) + 'static>(
919            this: *mut ffi::SoupMessage,
920            _param_spec: glib::ffi::gpointer,
921            f: glib::ffi::gpointer,
922        ) {
923            let f: &F = &*(f as *const F);
924            f(&from_glib_borrow(this))
925        }
926        unsafe {
927            let f: Box_<F> = Box_::new(f);
928            connect_raw(
929                self.as_ptr() as *mut _,
930                c"notify::http-version".as_ptr() as *const _,
931                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
932                    notify_http_version_trampoline::<F> as *const (),
933                )),
934                Box_::into_raw(f),
935            )
936        }
937    }
938
939    #[doc(alias = "is-options-ping")]
940    pub fn connect_is_options_ping_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
941        unsafe extern "C" fn notify_is_options_ping_trampoline<F: Fn(&Message) + 'static>(
942            this: *mut ffi::SoupMessage,
943            _param_spec: glib::ffi::gpointer,
944            f: glib::ffi::gpointer,
945        ) {
946            let f: &F = &*(f as *const F);
947            f(&from_glib_borrow(this))
948        }
949        unsafe {
950            let f: Box_<F> = Box_::new(f);
951            connect_raw(
952                self.as_ptr() as *mut _,
953                c"notify::is-options-ping".as_ptr() as *const _,
954                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
955                    notify_is_options_ping_trampoline::<F> as *const (),
956                )),
957                Box_::into_raw(f),
958            )
959        }
960    }
961
962    #[doc(alias = "is-top-level-navigation")]
963    pub fn connect_is_top_level_navigation_notify<F: Fn(&Self) + 'static>(
964        &self,
965        f: F,
966    ) -> SignalHandlerId {
967        unsafe extern "C" fn notify_is_top_level_navigation_trampoline<
968            F: Fn(&Message) + 'static,
969        >(
970            this: *mut ffi::SoupMessage,
971            _param_spec: glib::ffi::gpointer,
972            f: glib::ffi::gpointer,
973        ) {
974            let f: &F = &*(f as *const F);
975            f(&from_glib_borrow(this))
976        }
977        unsafe {
978            let f: Box_<F> = Box_::new(f);
979            connect_raw(
980                self.as_ptr() as *mut _,
981                c"notify::is-top-level-navigation".as_ptr() as *const _,
982                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
983                    notify_is_top_level_navigation_trampoline::<F> as *const (),
984                )),
985                Box_::into_raw(f),
986            )
987        }
988    }
989
990    #[doc(alias = "method")]
991    pub fn connect_method_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
992        unsafe extern "C" fn notify_method_trampoline<F: Fn(&Message) + 'static>(
993            this: *mut ffi::SoupMessage,
994            _param_spec: glib::ffi::gpointer,
995            f: glib::ffi::gpointer,
996        ) {
997            let f: &F = &*(f as *const F);
998            f(&from_glib_borrow(this))
999        }
1000        unsafe {
1001            let f: Box_<F> = Box_::new(f);
1002            connect_raw(
1003                self.as_ptr() as *mut _,
1004                c"notify::method".as_ptr() as *const _,
1005                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1006                    notify_method_trampoline::<F> as *const (),
1007                )),
1008                Box_::into_raw(f),
1009            )
1010        }
1011    }
1012
1013    #[doc(alias = "priority")]
1014    pub fn connect_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1015        unsafe extern "C" fn notify_priority_trampoline<F: Fn(&Message) + 'static>(
1016            this: *mut ffi::SoupMessage,
1017            _param_spec: glib::ffi::gpointer,
1018            f: glib::ffi::gpointer,
1019        ) {
1020            let f: &F = &*(f as *const F);
1021            f(&from_glib_borrow(this))
1022        }
1023        unsafe {
1024            let f: Box_<F> = Box_::new(f);
1025            connect_raw(
1026                self.as_ptr() as *mut _,
1027                c"notify::priority".as_ptr() as *const _,
1028                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1029                    notify_priority_trampoline::<F> as *const (),
1030                )),
1031                Box_::into_raw(f),
1032            )
1033        }
1034    }
1035
1036    #[doc(alias = "reason-phrase")]
1037    pub fn connect_reason_phrase_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1038        unsafe extern "C" fn notify_reason_phrase_trampoline<F: Fn(&Message) + 'static>(
1039            this: *mut ffi::SoupMessage,
1040            _param_spec: glib::ffi::gpointer,
1041            f: glib::ffi::gpointer,
1042        ) {
1043            let f: &F = &*(f as *const F);
1044            f(&from_glib_borrow(this))
1045        }
1046        unsafe {
1047            let f: Box_<F> = Box_::new(f);
1048            connect_raw(
1049                self.as_ptr() as *mut _,
1050                c"notify::reason-phrase".as_ptr() as *const _,
1051                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1052                    notify_reason_phrase_trampoline::<F> as *const (),
1053                )),
1054                Box_::into_raw(f),
1055            )
1056        }
1057    }
1058
1059    #[doc(alias = "remote-address")]
1060    pub fn connect_remote_address_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1061        unsafe extern "C" fn notify_remote_address_trampoline<F: Fn(&Message) + 'static>(
1062            this: *mut ffi::SoupMessage,
1063            _param_spec: glib::ffi::gpointer,
1064            f: glib::ffi::gpointer,
1065        ) {
1066            let f: &F = &*(f as *const F);
1067            f(&from_glib_borrow(this))
1068        }
1069        unsafe {
1070            let f: Box_<F> = Box_::new(f);
1071            connect_raw(
1072                self.as_ptr() as *mut _,
1073                c"notify::remote-address".as_ptr() as *const _,
1074                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1075                    notify_remote_address_trampoline::<F> as *const (),
1076                )),
1077                Box_::into_raw(f),
1078            )
1079        }
1080    }
1081
1082    #[doc(alias = "request-headers")]
1083    pub fn connect_request_headers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1084        unsafe extern "C" fn notify_request_headers_trampoline<F: Fn(&Message) + 'static>(
1085            this: *mut ffi::SoupMessage,
1086            _param_spec: glib::ffi::gpointer,
1087            f: glib::ffi::gpointer,
1088        ) {
1089            let f: &F = &*(f as *const F);
1090            f(&from_glib_borrow(this))
1091        }
1092        unsafe {
1093            let f: Box_<F> = Box_::new(f);
1094            connect_raw(
1095                self.as_ptr() as *mut _,
1096                c"notify::request-headers".as_ptr() as *const _,
1097                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1098                    notify_request_headers_trampoline::<F> as *const (),
1099                )),
1100                Box_::into_raw(f),
1101            )
1102        }
1103    }
1104
1105    #[doc(alias = "response-headers")]
1106    pub fn connect_response_headers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1107        unsafe extern "C" fn notify_response_headers_trampoline<F: Fn(&Message) + 'static>(
1108            this: *mut ffi::SoupMessage,
1109            _param_spec: glib::ffi::gpointer,
1110            f: glib::ffi::gpointer,
1111        ) {
1112            let f: &F = &*(f as *const F);
1113            f(&from_glib_borrow(this))
1114        }
1115        unsafe {
1116            let f: Box_<F> = Box_::new(f);
1117            connect_raw(
1118                self.as_ptr() as *mut _,
1119                c"notify::response-headers".as_ptr() as *const _,
1120                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1121                    notify_response_headers_trampoline::<F> as *const (),
1122                )),
1123                Box_::into_raw(f),
1124            )
1125        }
1126    }
1127
1128    #[doc(alias = "site-for-cookies")]
1129    pub fn connect_site_for_cookies_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1130        unsafe extern "C" fn notify_site_for_cookies_trampoline<F: Fn(&Message) + 'static>(
1131            this: *mut ffi::SoupMessage,
1132            _param_spec: glib::ffi::gpointer,
1133            f: glib::ffi::gpointer,
1134        ) {
1135            let f: &F = &*(f as *const F);
1136            f(&from_glib_borrow(this))
1137        }
1138        unsafe {
1139            let f: Box_<F> = Box_::new(f);
1140            connect_raw(
1141                self.as_ptr() as *mut _,
1142                c"notify::site-for-cookies".as_ptr() as *const _,
1143                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1144                    notify_site_for_cookies_trampoline::<F> as *const (),
1145                )),
1146                Box_::into_raw(f),
1147            )
1148        }
1149    }
1150
1151    #[doc(alias = "status-code")]
1152    pub fn connect_status_code_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1153        unsafe extern "C" fn notify_status_code_trampoline<F: Fn(&Message) + 'static>(
1154            this: *mut ffi::SoupMessage,
1155            _param_spec: glib::ffi::gpointer,
1156            f: glib::ffi::gpointer,
1157        ) {
1158            let f: &F = &*(f as *const F);
1159            f(&from_glib_borrow(this))
1160        }
1161        unsafe {
1162            let f: Box_<F> = Box_::new(f);
1163            connect_raw(
1164                self.as_ptr() as *mut _,
1165                c"notify::status-code".as_ptr() as *const _,
1166                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1167                    notify_status_code_trampoline::<F> as *const (),
1168                )),
1169                Box_::into_raw(f),
1170            )
1171        }
1172    }
1173
1174    #[doc(alias = "tls-ciphersuite-name")]
1175    pub fn connect_tls_ciphersuite_name_notify<F: Fn(&Self) + 'static>(
1176        &self,
1177        f: F,
1178    ) -> SignalHandlerId {
1179        unsafe extern "C" fn notify_tls_ciphersuite_name_trampoline<F: Fn(&Message) + 'static>(
1180            this: *mut ffi::SoupMessage,
1181            _param_spec: glib::ffi::gpointer,
1182            f: glib::ffi::gpointer,
1183        ) {
1184            let f: &F = &*(f as *const F);
1185            f(&from_glib_borrow(this))
1186        }
1187        unsafe {
1188            let f: Box_<F> = Box_::new(f);
1189            connect_raw(
1190                self.as_ptr() as *mut _,
1191                c"notify::tls-ciphersuite-name".as_ptr() as *const _,
1192                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1193                    notify_tls_ciphersuite_name_trampoline::<F> as *const (),
1194                )),
1195                Box_::into_raw(f),
1196            )
1197        }
1198    }
1199
1200    #[doc(alias = "tls-peer-certificate")]
1201    pub fn connect_tls_peer_certificate_notify<F: Fn(&Self) + 'static>(
1202        &self,
1203        f: F,
1204    ) -> SignalHandlerId {
1205        unsafe extern "C" fn notify_tls_peer_certificate_trampoline<F: Fn(&Message) + 'static>(
1206            this: *mut ffi::SoupMessage,
1207            _param_spec: glib::ffi::gpointer,
1208            f: glib::ffi::gpointer,
1209        ) {
1210            let f: &F = &*(f as *const F);
1211            f(&from_glib_borrow(this))
1212        }
1213        unsafe {
1214            let f: Box_<F> = Box_::new(f);
1215            connect_raw(
1216                self.as_ptr() as *mut _,
1217                c"notify::tls-peer-certificate".as_ptr() as *const _,
1218                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1219                    notify_tls_peer_certificate_trampoline::<F> as *const (),
1220                )),
1221                Box_::into_raw(f),
1222            )
1223        }
1224    }
1225
1226    #[doc(alias = "tls-peer-certificate-errors")]
1227    pub fn connect_tls_peer_certificate_errors_notify<F: Fn(&Self) + 'static>(
1228        &self,
1229        f: F,
1230    ) -> SignalHandlerId {
1231        unsafe extern "C" fn notify_tls_peer_certificate_errors_trampoline<
1232            F: Fn(&Message) + 'static,
1233        >(
1234            this: *mut ffi::SoupMessage,
1235            _param_spec: glib::ffi::gpointer,
1236            f: glib::ffi::gpointer,
1237        ) {
1238            let f: &F = &*(f as *const F);
1239            f(&from_glib_borrow(this))
1240        }
1241        unsafe {
1242            let f: Box_<F> = Box_::new(f);
1243            connect_raw(
1244                self.as_ptr() as *mut _,
1245                c"notify::tls-peer-certificate-errors".as_ptr() as *const _,
1246                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1247                    notify_tls_peer_certificate_errors_trampoline::<F> as *const (),
1248                )),
1249                Box_::into_raw(f),
1250            )
1251        }
1252    }
1253
1254    #[doc(alias = "tls-protocol-version")]
1255    pub fn connect_tls_protocol_version_notify<F: Fn(&Self) + 'static>(
1256        &self,
1257        f: F,
1258    ) -> SignalHandlerId {
1259        unsafe extern "C" fn notify_tls_protocol_version_trampoline<F: Fn(&Message) + 'static>(
1260            this: *mut ffi::SoupMessage,
1261            _param_spec: glib::ffi::gpointer,
1262            f: glib::ffi::gpointer,
1263        ) {
1264            let f: &F = &*(f as *const F);
1265            f(&from_glib_borrow(this))
1266        }
1267        unsafe {
1268            let f: Box_<F> = Box_::new(f);
1269            connect_raw(
1270                self.as_ptr() as *mut _,
1271                c"notify::tls-protocol-version".as_ptr() as *const _,
1272                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1273                    notify_tls_protocol_version_trampoline::<F> as *const (),
1274                )),
1275                Box_::into_raw(f),
1276            )
1277        }
1278    }
1279
1280    #[doc(alias = "uri")]
1281    pub fn connect_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1282        unsafe extern "C" fn notify_uri_trampoline<F: Fn(&Message) + 'static>(
1283            this: *mut ffi::SoupMessage,
1284            _param_spec: glib::ffi::gpointer,
1285            f: glib::ffi::gpointer,
1286        ) {
1287            let f: &F = &*(f as *const F);
1288            f(&from_glib_borrow(this))
1289        }
1290        unsafe {
1291            let f: Box_<F> = Box_::new(f);
1292            connect_raw(
1293                self.as_ptr() as *mut _,
1294                c"notify::uri".as_ptr() as *const _,
1295                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1296                    notify_uri_trampoline::<F> as *const (),
1297                )),
1298                Box_::into_raw(f),
1299            )
1300        }
1301    }
1302}
1303
1304// rustdoc-stripper-ignore-next
1305/// A [builder-pattern] type to construct [`Message`] objects.
1306///
1307/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1308#[must_use = "The builder must be built to be used"]
1309pub struct MessageBuilder {
1310    builder: glib::object::ObjectBuilder<'static, Message>,
1311}
1312
1313impl MessageBuilder {
1314    fn new() -> Self {
1315        Self {
1316            builder: glib::object::Object::builder(),
1317        }
1318    }
1319
1320    pub fn first_party(self, first_party: &glib::Uri) -> Self {
1321        Self {
1322            builder: self.builder.property("first-party", first_party.clone()),
1323        }
1324    }
1325
1326    pub fn flags(self, flags: MessageFlags) -> Self {
1327        Self {
1328            builder: self.builder.property("flags", flags),
1329        }
1330    }
1331
1332    pub fn is_options_ping(self, is_options_ping: bool) -> Self {
1333        Self {
1334            builder: self.builder.property("is-options-ping", is_options_ping),
1335        }
1336    }
1337
1338    pub fn is_top_level_navigation(self, is_top_level_navigation: bool) -> Self {
1339        Self {
1340            builder: self
1341                .builder
1342                .property("is-top-level-navigation", is_top_level_navigation),
1343        }
1344    }
1345
1346    pub fn method(self, method: impl Into<glib::GString>) -> Self {
1347        Self {
1348            builder: self.builder.property("method", method.into()),
1349        }
1350    }
1351
1352    pub fn priority(self, priority: MessagePriority) -> Self {
1353        Self {
1354            builder: self.builder.property("priority", priority),
1355        }
1356    }
1357
1358    pub fn site_for_cookies(self, site_for_cookies: &glib::Uri) -> Self {
1359        Self {
1360            builder: self
1361                .builder
1362                .property("site-for-cookies", site_for_cookies.clone()),
1363        }
1364    }
1365
1366    pub fn uri(self, uri: &glib::Uri) -> Self {
1367        Self {
1368            builder: self.builder.property("uri", uri.clone()),
1369        }
1370    }
1371
1372    // rustdoc-stripper-ignore-next
1373    /// Build the [`Message`].
1374    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1375    pub fn build(self) -> Message {
1376        assert_initialized_main_thread!();
1377        self.builder.build()
1378    }
1379}