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