Skip to main content

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    Auth, HTTPVersion, MessageFlags, MessageHeaders, MessageMetrics, MessagePriority, Multipart,
8    Status, ffi,
9};
10use glib::{
11    object::ObjectType as _,
12    prelude::*,
13    signal::{SignalHandlerId, connect_raw},
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            unsafe {
472                let f: &F = &*(f as *const F);
473                f(
474                    &from_glib_borrow(this),
475                    &from_glib_borrow(tls_peer_certificate),
476                    from_glib(tls_peer_errors),
477                )
478                .into_glib()
479            }
480        }
481        unsafe {
482            let f: Box_<F> = Box_::new(f);
483            connect_raw(
484                self.as_ptr() as *mut _,
485                c"accept-certificate".as_ptr(),
486                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
487                    accept_certificate_trampoline::<F> as *const (),
488                )),
489                Box_::into_raw(f),
490            )
491        }
492    }
493
494    #[doc(alias = "authenticate")]
495    pub fn connect_authenticate<F: Fn(&Self, &Auth, bool) -> bool + 'static>(
496        &self,
497        f: F,
498    ) -> SignalHandlerId {
499        unsafe extern "C" fn authenticate_trampoline<
500            F: Fn(&Message, &Auth, bool) -> bool + 'static,
501        >(
502            this: *mut ffi::SoupMessage,
503            auth: *mut ffi::SoupAuth,
504            retrying: glib::ffi::gboolean,
505            f: glib::ffi::gpointer,
506        ) -> glib::ffi::gboolean {
507            unsafe {
508                let f: &F = &*(f as *const F);
509                f(
510                    &from_glib_borrow(this),
511                    &from_glib_borrow(auth),
512                    from_glib(retrying),
513                )
514                .into_glib()
515            }
516        }
517        unsafe {
518            let f: Box_<F> = Box_::new(f);
519            connect_raw(
520                self.as_ptr() as *mut _,
521                c"authenticate".as_ptr(),
522                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
523                    authenticate_trampoline::<F> as *const (),
524                )),
525                Box_::into_raw(f),
526            )
527        }
528    }
529
530    //#[doc(alias = "content-sniffed")]
531    //pub fn connect_content_sniffed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
532    //    Empty ctype params: *.HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }
533    //}
534
535    #[doc(alias = "finished")]
536    pub fn connect_finished<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
537        unsafe extern "C" fn finished_trampoline<F: Fn(&Message) + 'static>(
538            this: *mut ffi::SoupMessage,
539            f: glib::ffi::gpointer,
540        ) {
541            unsafe {
542                let f: &F = &*(f as *const F);
543                f(&from_glib_borrow(this))
544            }
545        }
546        unsafe {
547            let f: Box_<F> = Box_::new(f);
548            connect_raw(
549                self.as_ptr() as *mut _,
550                c"finished".as_ptr(),
551                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
552                    finished_trampoline::<F> as *const (),
553                )),
554                Box_::into_raw(f),
555            )
556        }
557    }
558
559    #[doc(alias = "got-body")]
560    pub fn connect_got_body<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
561        unsafe extern "C" fn got_body_trampoline<F: Fn(&Message) + 'static>(
562            this: *mut ffi::SoupMessage,
563            f: glib::ffi::gpointer,
564        ) {
565            unsafe {
566                let f: &F = &*(f as *const F);
567                f(&from_glib_borrow(this))
568            }
569        }
570        unsafe {
571            let f: Box_<F> = Box_::new(f);
572            connect_raw(
573                self.as_ptr() as *mut _,
574                c"got-body".as_ptr(),
575                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
576                    got_body_trampoline::<F> as *const (),
577                )),
578                Box_::into_raw(f),
579            )
580        }
581    }
582
583    #[cfg(feature = "v3_4")]
584    #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))]
585    #[doc(alias = "got-body-data")]
586    pub fn connect_got_body_data<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
587        unsafe extern "C" fn got_body_data_trampoline<F: Fn(&Message, u32) + 'static>(
588            this: *mut ffi::SoupMessage,
589            chunk_size: std::ffi::c_uint,
590            f: glib::ffi::gpointer,
591        ) {
592            unsafe {
593                let f: &F = &*(f as *const F);
594                f(&from_glib_borrow(this), chunk_size)
595            }
596        }
597        unsafe {
598            let f: Box_<F> = Box_::new(f);
599            connect_raw(
600                self.as_ptr() as *mut _,
601                c"got-body-data".as_ptr(),
602                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
603                    got_body_data_trampoline::<F> as *const (),
604                )),
605                Box_::into_raw(f),
606            )
607        }
608    }
609
610    #[doc(alias = "got-headers")]
611    pub fn connect_got_headers<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
612        unsafe extern "C" fn got_headers_trampoline<F: Fn(&Message) + 'static>(
613            this: *mut ffi::SoupMessage,
614            f: glib::ffi::gpointer,
615        ) {
616            unsafe {
617                let f: &F = &*(f as *const F);
618                f(&from_glib_borrow(this))
619            }
620        }
621        unsafe {
622            let f: Box_<F> = Box_::new(f);
623            connect_raw(
624                self.as_ptr() as *mut _,
625                c"got-headers".as_ptr(),
626                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
627                    got_headers_trampoline::<F> as *const (),
628                )),
629                Box_::into_raw(f),
630            )
631        }
632    }
633
634    #[doc(alias = "got-informational")]
635    pub fn connect_got_informational<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
636        unsafe extern "C" fn got_informational_trampoline<F: Fn(&Message) + 'static>(
637            this: *mut ffi::SoupMessage,
638            f: glib::ffi::gpointer,
639        ) {
640            unsafe {
641                let f: &F = &*(f as *const F);
642                f(&from_glib_borrow(this))
643            }
644        }
645        unsafe {
646            let f: Box_<F> = Box_::new(f);
647            connect_raw(
648                self.as_ptr() as *mut _,
649                c"got-informational".as_ptr(),
650                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
651                    got_informational_trampoline::<F> as *const (),
652                )),
653                Box_::into_raw(f),
654            )
655        }
656    }
657
658    #[doc(alias = "hsts-enforced")]
659    pub fn connect_hsts_enforced<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
660        unsafe extern "C" fn hsts_enforced_trampoline<F: Fn(&Message) + 'static>(
661            this: *mut ffi::SoupMessage,
662            f: glib::ffi::gpointer,
663        ) {
664            unsafe {
665                let f: &F = &*(f as *const F);
666                f(&from_glib_borrow(this))
667            }
668        }
669        unsafe {
670            let f: Box_<F> = Box_::new(f);
671            connect_raw(
672                self.as_ptr() as *mut _,
673                c"hsts-enforced".as_ptr(),
674                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
675                    hsts_enforced_trampoline::<F> as *const (),
676                )),
677                Box_::into_raw(f),
678            )
679        }
680    }
681
682    #[doc(alias = "network-event")]
683    pub fn connect_network_event<F: Fn(&Self, gio::SocketClientEvent, &gio::IOStream) + 'static>(
684        &self,
685        f: F,
686    ) -> SignalHandlerId {
687        unsafe extern "C" fn network_event_trampoline<
688            F: Fn(&Message, gio::SocketClientEvent, &gio::IOStream) + 'static,
689        >(
690            this: *mut ffi::SoupMessage,
691            event: gio::ffi::GSocketClientEvent,
692            connection: *mut gio::ffi::GIOStream,
693            f: glib::ffi::gpointer,
694        ) {
695            unsafe {
696                let f: &F = &*(f as *const F);
697                f(
698                    &from_glib_borrow(this),
699                    from_glib(event),
700                    &from_glib_borrow(connection),
701                )
702            }
703        }
704        unsafe {
705            let f: Box_<F> = Box_::new(f);
706            connect_raw(
707                self.as_ptr() as *mut _,
708                c"network-event".as_ptr(),
709                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
710                    network_event_trampoline::<F> as *const (),
711                )),
712                Box_::into_raw(f),
713            )
714        }
715    }
716
717    #[doc(alias = "request-certificate")]
718    pub fn connect_request_certificate<
719        F: Fn(&Self, &gio::TlsClientConnection) -> bool + 'static,
720    >(
721        &self,
722        f: F,
723    ) -> SignalHandlerId {
724        unsafe extern "C" fn request_certificate_trampoline<
725            F: Fn(&Message, &gio::TlsClientConnection) -> bool + 'static,
726        >(
727            this: *mut ffi::SoupMessage,
728            tls_connection: *mut gio::ffi::GTlsClientConnection,
729            f: glib::ffi::gpointer,
730        ) -> glib::ffi::gboolean {
731            unsafe {
732                let f: &F = &*(f as *const F);
733                f(&from_glib_borrow(this), &from_glib_borrow(tls_connection)).into_glib()
734            }
735        }
736        unsafe {
737            let f: Box_<F> = Box_::new(f);
738            connect_raw(
739                self.as_ptr() as *mut _,
740                c"request-certificate".as_ptr(),
741                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
742                    request_certificate_trampoline::<F> as *const (),
743                )),
744                Box_::into_raw(f),
745            )
746        }
747    }
748
749    #[doc(alias = "request-certificate-password")]
750    pub fn connect_request_certificate_password<
751        F: Fn(&Self, &gio::TlsPassword) -> bool + 'static,
752    >(
753        &self,
754        f: F,
755    ) -> SignalHandlerId {
756        unsafe extern "C" fn request_certificate_password_trampoline<
757            F: Fn(&Message, &gio::TlsPassword) -> bool + 'static,
758        >(
759            this: *mut ffi::SoupMessage,
760            tls_password: *mut gio::ffi::GTlsPassword,
761            f: glib::ffi::gpointer,
762        ) -> glib::ffi::gboolean {
763            unsafe {
764                let f: &F = &*(f as *const F);
765                f(&from_glib_borrow(this), &from_glib_borrow(tls_password)).into_glib()
766            }
767        }
768        unsafe {
769            let f: Box_<F> = Box_::new(f);
770            connect_raw(
771                self.as_ptr() as *mut _,
772                c"request-certificate-password".as_ptr(),
773                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
774                    request_certificate_password_trampoline::<F> as *const (),
775                )),
776                Box_::into_raw(f),
777            )
778        }
779    }
780
781    #[doc(alias = "restarted")]
782    pub fn connect_restarted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
783        unsafe extern "C" fn restarted_trampoline<F: Fn(&Message) + 'static>(
784            this: *mut ffi::SoupMessage,
785            f: glib::ffi::gpointer,
786        ) {
787            unsafe {
788                let f: &F = &*(f as *const F);
789                f(&from_glib_borrow(this))
790            }
791        }
792        unsafe {
793            let f: Box_<F> = Box_::new(f);
794            connect_raw(
795                self.as_ptr() as *mut _,
796                c"restarted".as_ptr(),
797                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
798                    restarted_trampoline::<F> as *const (),
799                )),
800                Box_::into_raw(f),
801            )
802        }
803    }
804
805    #[doc(alias = "starting")]
806    pub fn connect_starting<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
807        unsafe extern "C" fn starting_trampoline<F: Fn(&Message) + 'static>(
808            this: *mut ffi::SoupMessage,
809            f: glib::ffi::gpointer,
810        ) {
811            unsafe {
812                let f: &F = &*(f as *const F);
813                f(&from_glib_borrow(this))
814            }
815        }
816        unsafe {
817            let f: Box_<F> = Box_::new(f);
818            connect_raw(
819                self.as_ptr() as *mut _,
820                c"starting".as_ptr(),
821                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
822                    starting_trampoline::<F> as *const (),
823                )),
824                Box_::into_raw(f),
825            )
826        }
827    }
828
829    #[doc(alias = "wrote-body")]
830    pub fn connect_wrote_body<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
831        unsafe extern "C" fn wrote_body_trampoline<F: Fn(&Message) + 'static>(
832            this: *mut ffi::SoupMessage,
833            f: glib::ffi::gpointer,
834        ) {
835            unsafe {
836                let f: &F = &*(f as *const F);
837                f(&from_glib_borrow(this))
838            }
839        }
840        unsafe {
841            let f: Box_<F> = Box_::new(f);
842            connect_raw(
843                self.as_ptr() as *mut _,
844                c"wrote-body".as_ptr(),
845                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
846                    wrote_body_trampoline::<F> as *const (),
847                )),
848                Box_::into_raw(f),
849            )
850        }
851    }
852
853    #[doc(alias = "wrote-body-data")]
854    pub fn connect_wrote_body_data<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
855        unsafe extern "C" fn wrote_body_data_trampoline<F: Fn(&Message, u32) + 'static>(
856            this: *mut ffi::SoupMessage,
857            chunk_size: std::ffi::c_uint,
858            f: glib::ffi::gpointer,
859        ) {
860            unsafe {
861                let f: &F = &*(f as *const F);
862                f(&from_glib_borrow(this), chunk_size)
863            }
864        }
865        unsafe {
866            let f: Box_<F> = Box_::new(f);
867            connect_raw(
868                self.as_ptr() as *mut _,
869                c"wrote-body-data".as_ptr(),
870                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
871                    wrote_body_data_trampoline::<F> as *const (),
872                )),
873                Box_::into_raw(f),
874            )
875        }
876    }
877
878    #[doc(alias = "wrote-headers")]
879    pub fn connect_wrote_headers<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
880        unsafe extern "C" fn wrote_headers_trampoline<F: Fn(&Message) + 'static>(
881            this: *mut ffi::SoupMessage,
882            f: glib::ffi::gpointer,
883        ) {
884            unsafe {
885                let f: &F = &*(f as *const F);
886                f(&from_glib_borrow(this))
887            }
888        }
889        unsafe {
890            let f: Box_<F> = Box_::new(f);
891            connect_raw(
892                self.as_ptr() as *mut _,
893                c"wrote-headers".as_ptr(),
894                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
895                    wrote_headers_trampoline::<F> as *const (),
896                )),
897                Box_::into_raw(f),
898            )
899        }
900    }
901
902    #[doc(alias = "first-party")]
903    pub fn connect_first_party_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
904        unsafe extern "C" fn notify_first_party_trampoline<F: Fn(&Message) + 'static>(
905            this: *mut ffi::SoupMessage,
906            _param_spec: glib::ffi::gpointer,
907            f: glib::ffi::gpointer,
908        ) {
909            unsafe {
910                let f: &F = &*(f as *const F);
911                f(&from_glib_borrow(this))
912            }
913        }
914        unsafe {
915            let f: Box_<F> = Box_::new(f);
916            connect_raw(
917                self.as_ptr() as *mut _,
918                c"notify::first-party".as_ptr(),
919                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
920                    notify_first_party_trampoline::<F> as *const (),
921                )),
922                Box_::into_raw(f),
923            )
924        }
925    }
926
927    #[doc(alias = "flags")]
928    pub fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
929        unsafe extern "C" fn notify_flags_trampoline<F: Fn(&Message) + 'static>(
930            this: *mut ffi::SoupMessage,
931            _param_spec: glib::ffi::gpointer,
932            f: glib::ffi::gpointer,
933        ) {
934            unsafe {
935                let f: &F = &*(f as *const F);
936                f(&from_glib_borrow(this))
937            }
938        }
939        unsafe {
940            let f: Box_<F> = Box_::new(f);
941            connect_raw(
942                self.as_ptr() as *mut _,
943                c"notify::flags".as_ptr(),
944                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
945                    notify_flags_trampoline::<F> as *const (),
946                )),
947                Box_::into_raw(f),
948            )
949        }
950    }
951
952    #[doc(alias = "http-version")]
953    pub fn connect_http_version_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
954        unsafe extern "C" fn notify_http_version_trampoline<F: Fn(&Message) + 'static>(
955            this: *mut ffi::SoupMessage,
956            _param_spec: glib::ffi::gpointer,
957            f: glib::ffi::gpointer,
958        ) {
959            unsafe {
960                let f: &F = &*(f as *const F);
961                f(&from_glib_borrow(this))
962            }
963        }
964        unsafe {
965            let f: Box_<F> = Box_::new(f);
966            connect_raw(
967                self.as_ptr() as *mut _,
968                c"notify::http-version".as_ptr(),
969                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
970                    notify_http_version_trampoline::<F> as *const (),
971                )),
972                Box_::into_raw(f),
973            )
974        }
975    }
976
977    #[doc(alias = "is-options-ping")]
978    pub fn connect_is_options_ping_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
979        unsafe extern "C" fn notify_is_options_ping_trampoline<F: Fn(&Message) + 'static>(
980            this: *mut ffi::SoupMessage,
981            _param_spec: glib::ffi::gpointer,
982            f: glib::ffi::gpointer,
983        ) {
984            unsafe {
985                let f: &F = &*(f as *const F);
986                f(&from_glib_borrow(this))
987            }
988        }
989        unsafe {
990            let f: Box_<F> = Box_::new(f);
991            connect_raw(
992                self.as_ptr() as *mut _,
993                c"notify::is-options-ping".as_ptr(),
994                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
995                    notify_is_options_ping_trampoline::<F> as *const (),
996                )),
997                Box_::into_raw(f),
998            )
999        }
1000    }
1001
1002    #[doc(alias = "is-top-level-navigation")]
1003    pub fn connect_is_top_level_navigation_notify<F: Fn(&Self) + 'static>(
1004        &self,
1005        f: F,
1006    ) -> SignalHandlerId {
1007        unsafe extern "C" fn notify_is_top_level_navigation_trampoline<
1008            F: Fn(&Message) + 'static,
1009        >(
1010            this: *mut ffi::SoupMessage,
1011            _param_spec: glib::ffi::gpointer,
1012            f: glib::ffi::gpointer,
1013        ) {
1014            unsafe {
1015                let f: &F = &*(f as *const F);
1016                f(&from_glib_borrow(this))
1017            }
1018        }
1019        unsafe {
1020            let f: Box_<F> = Box_::new(f);
1021            connect_raw(
1022                self.as_ptr() as *mut _,
1023                c"notify::is-top-level-navigation".as_ptr(),
1024                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1025                    notify_is_top_level_navigation_trampoline::<F> as *const (),
1026                )),
1027                Box_::into_raw(f),
1028            )
1029        }
1030    }
1031
1032    #[doc(alias = "method")]
1033    pub fn connect_method_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1034        unsafe extern "C" fn notify_method_trampoline<F: Fn(&Message) + 'static>(
1035            this: *mut ffi::SoupMessage,
1036            _param_spec: glib::ffi::gpointer,
1037            f: glib::ffi::gpointer,
1038        ) {
1039            unsafe {
1040                let f: &F = &*(f as *const F);
1041                f(&from_glib_borrow(this))
1042            }
1043        }
1044        unsafe {
1045            let f: Box_<F> = Box_::new(f);
1046            connect_raw(
1047                self.as_ptr() as *mut _,
1048                c"notify::method".as_ptr(),
1049                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1050                    notify_method_trampoline::<F> as *const (),
1051                )),
1052                Box_::into_raw(f),
1053            )
1054        }
1055    }
1056
1057    #[doc(alias = "priority")]
1058    pub fn connect_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1059        unsafe extern "C" fn notify_priority_trampoline<F: Fn(&Message) + 'static>(
1060            this: *mut ffi::SoupMessage,
1061            _param_spec: glib::ffi::gpointer,
1062            f: glib::ffi::gpointer,
1063        ) {
1064            unsafe {
1065                let f: &F = &*(f as *const F);
1066                f(&from_glib_borrow(this))
1067            }
1068        }
1069        unsafe {
1070            let f: Box_<F> = Box_::new(f);
1071            connect_raw(
1072                self.as_ptr() as *mut _,
1073                c"notify::priority".as_ptr(),
1074                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1075                    notify_priority_trampoline::<F> as *const (),
1076                )),
1077                Box_::into_raw(f),
1078            )
1079        }
1080    }
1081
1082    #[doc(alias = "reason-phrase")]
1083    pub fn connect_reason_phrase_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1084        unsafe extern "C" fn notify_reason_phrase_trampoline<F: Fn(&Message) + 'static>(
1085            this: *mut ffi::SoupMessage,
1086            _param_spec: glib::ffi::gpointer,
1087            f: glib::ffi::gpointer,
1088        ) {
1089            unsafe {
1090                let f: &F = &*(f as *const F);
1091                f(&from_glib_borrow(this))
1092            }
1093        }
1094        unsafe {
1095            let f: Box_<F> = Box_::new(f);
1096            connect_raw(
1097                self.as_ptr() as *mut _,
1098                c"notify::reason-phrase".as_ptr(),
1099                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1100                    notify_reason_phrase_trampoline::<F> as *const (),
1101                )),
1102                Box_::into_raw(f),
1103            )
1104        }
1105    }
1106
1107    #[doc(alias = "remote-address")]
1108    pub fn connect_remote_address_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1109        unsafe extern "C" fn notify_remote_address_trampoline<F: Fn(&Message) + 'static>(
1110            this: *mut ffi::SoupMessage,
1111            _param_spec: glib::ffi::gpointer,
1112            f: glib::ffi::gpointer,
1113        ) {
1114            unsafe {
1115                let f: &F = &*(f as *const F);
1116                f(&from_glib_borrow(this))
1117            }
1118        }
1119        unsafe {
1120            let f: Box_<F> = Box_::new(f);
1121            connect_raw(
1122                self.as_ptr() as *mut _,
1123                c"notify::remote-address".as_ptr(),
1124                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1125                    notify_remote_address_trampoline::<F> as *const (),
1126                )),
1127                Box_::into_raw(f),
1128            )
1129        }
1130    }
1131
1132    #[doc(alias = "request-headers")]
1133    pub fn connect_request_headers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1134        unsafe extern "C" fn notify_request_headers_trampoline<F: Fn(&Message) + 'static>(
1135            this: *mut ffi::SoupMessage,
1136            _param_spec: glib::ffi::gpointer,
1137            f: glib::ffi::gpointer,
1138        ) {
1139            unsafe {
1140                let f: &F = &*(f as *const F);
1141                f(&from_glib_borrow(this))
1142            }
1143        }
1144        unsafe {
1145            let f: Box_<F> = Box_::new(f);
1146            connect_raw(
1147                self.as_ptr() as *mut _,
1148                c"notify::request-headers".as_ptr(),
1149                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1150                    notify_request_headers_trampoline::<F> as *const (),
1151                )),
1152                Box_::into_raw(f),
1153            )
1154        }
1155    }
1156
1157    #[doc(alias = "response-headers")]
1158    pub fn connect_response_headers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1159        unsafe extern "C" fn notify_response_headers_trampoline<F: Fn(&Message) + 'static>(
1160            this: *mut ffi::SoupMessage,
1161            _param_spec: glib::ffi::gpointer,
1162            f: glib::ffi::gpointer,
1163        ) {
1164            unsafe {
1165                let f: &F = &*(f as *const F);
1166                f(&from_glib_borrow(this))
1167            }
1168        }
1169        unsafe {
1170            let f: Box_<F> = Box_::new(f);
1171            connect_raw(
1172                self.as_ptr() as *mut _,
1173                c"notify::response-headers".as_ptr(),
1174                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1175                    notify_response_headers_trampoline::<F> as *const (),
1176                )),
1177                Box_::into_raw(f),
1178            )
1179        }
1180    }
1181
1182    #[doc(alias = "site-for-cookies")]
1183    pub fn connect_site_for_cookies_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1184        unsafe extern "C" fn notify_site_for_cookies_trampoline<F: Fn(&Message) + 'static>(
1185            this: *mut ffi::SoupMessage,
1186            _param_spec: glib::ffi::gpointer,
1187            f: glib::ffi::gpointer,
1188        ) {
1189            unsafe {
1190                let f: &F = &*(f as *const F);
1191                f(&from_glib_borrow(this))
1192            }
1193        }
1194        unsafe {
1195            let f: Box_<F> = Box_::new(f);
1196            connect_raw(
1197                self.as_ptr() as *mut _,
1198                c"notify::site-for-cookies".as_ptr(),
1199                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1200                    notify_site_for_cookies_trampoline::<F> as *const (),
1201                )),
1202                Box_::into_raw(f),
1203            )
1204        }
1205    }
1206
1207    #[doc(alias = "status-code")]
1208    pub fn connect_status_code_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1209        unsafe extern "C" fn notify_status_code_trampoline<F: Fn(&Message) + 'static>(
1210            this: *mut ffi::SoupMessage,
1211            _param_spec: glib::ffi::gpointer,
1212            f: glib::ffi::gpointer,
1213        ) {
1214            unsafe {
1215                let f: &F = &*(f as *const F);
1216                f(&from_glib_borrow(this))
1217            }
1218        }
1219        unsafe {
1220            let f: Box_<F> = Box_::new(f);
1221            connect_raw(
1222                self.as_ptr() as *mut _,
1223                c"notify::status-code".as_ptr(),
1224                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1225                    notify_status_code_trampoline::<F> as *const (),
1226                )),
1227                Box_::into_raw(f),
1228            )
1229        }
1230    }
1231
1232    #[doc(alias = "tls-ciphersuite-name")]
1233    pub fn connect_tls_ciphersuite_name_notify<F: Fn(&Self) + 'static>(
1234        &self,
1235        f: F,
1236    ) -> SignalHandlerId {
1237        unsafe extern "C" fn notify_tls_ciphersuite_name_trampoline<F: Fn(&Message) + 'static>(
1238            this: *mut ffi::SoupMessage,
1239            _param_spec: glib::ffi::gpointer,
1240            f: glib::ffi::gpointer,
1241        ) {
1242            unsafe {
1243                let f: &F = &*(f as *const F);
1244                f(&from_glib_borrow(this))
1245            }
1246        }
1247        unsafe {
1248            let f: Box_<F> = Box_::new(f);
1249            connect_raw(
1250                self.as_ptr() as *mut _,
1251                c"notify::tls-ciphersuite-name".as_ptr(),
1252                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1253                    notify_tls_ciphersuite_name_trampoline::<F> as *const (),
1254                )),
1255                Box_::into_raw(f),
1256            )
1257        }
1258    }
1259
1260    #[doc(alias = "tls-peer-certificate")]
1261    pub fn connect_tls_peer_certificate_notify<F: Fn(&Self) + 'static>(
1262        &self,
1263        f: F,
1264    ) -> SignalHandlerId {
1265        unsafe extern "C" fn notify_tls_peer_certificate_trampoline<F: Fn(&Message) + 'static>(
1266            this: *mut ffi::SoupMessage,
1267            _param_spec: glib::ffi::gpointer,
1268            f: glib::ffi::gpointer,
1269        ) {
1270            unsafe {
1271                let f: &F = &*(f as *const F);
1272                f(&from_glib_borrow(this))
1273            }
1274        }
1275        unsafe {
1276            let f: Box_<F> = Box_::new(f);
1277            connect_raw(
1278                self.as_ptr() as *mut _,
1279                c"notify::tls-peer-certificate".as_ptr(),
1280                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1281                    notify_tls_peer_certificate_trampoline::<F> as *const (),
1282                )),
1283                Box_::into_raw(f),
1284            )
1285        }
1286    }
1287
1288    #[doc(alias = "tls-peer-certificate-errors")]
1289    pub fn connect_tls_peer_certificate_errors_notify<F: Fn(&Self) + 'static>(
1290        &self,
1291        f: F,
1292    ) -> SignalHandlerId {
1293        unsafe extern "C" fn notify_tls_peer_certificate_errors_trampoline<
1294            F: Fn(&Message) + 'static,
1295        >(
1296            this: *mut ffi::SoupMessage,
1297            _param_spec: glib::ffi::gpointer,
1298            f: glib::ffi::gpointer,
1299        ) {
1300            unsafe {
1301                let f: &F = &*(f as *const F);
1302                f(&from_glib_borrow(this))
1303            }
1304        }
1305        unsafe {
1306            let f: Box_<F> = Box_::new(f);
1307            connect_raw(
1308                self.as_ptr() as *mut _,
1309                c"notify::tls-peer-certificate-errors".as_ptr(),
1310                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1311                    notify_tls_peer_certificate_errors_trampoline::<F> as *const (),
1312                )),
1313                Box_::into_raw(f),
1314            )
1315        }
1316    }
1317
1318    #[doc(alias = "tls-protocol-version")]
1319    pub fn connect_tls_protocol_version_notify<F: Fn(&Self) + 'static>(
1320        &self,
1321        f: F,
1322    ) -> SignalHandlerId {
1323        unsafe extern "C" fn notify_tls_protocol_version_trampoline<F: Fn(&Message) + 'static>(
1324            this: *mut ffi::SoupMessage,
1325            _param_spec: glib::ffi::gpointer,
1326            f: glib::ffi::gpointer,
1327        ) {
1328            unsafe {
1329                let f: &F = &*(f as *const F);
1330                f(&from_glib_borrow(this))
1331            }
1332        }
1333        unsafe {
1334            let f: Box_<F> = Box_::new(f);
1335            connect_raw(
1336                self.as_ptr() as *mut _,
1337                c"notify::tls-protocol-version".as_ptr(),
1338                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1339                    notify_tls_protocol_version_trampoline::<F> as *const (),
1340                )),
1341                Box_::into_raw(f),
1342            )
1343        }
1344    }
1345
1346    #[doc(alias = "uri")]
1347    pub fn connect_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1348        unsafe extern "C" fn notify_uri_trampoline<F: Fn(&Message) + 'static>(
1349            this: *mut ffi::SoupMessage,
1350            _param_spec: glib::ffi::gpointer,
1351            f: glib::ffi::gpointer,
1352        ) {
1353            unsafe {
1354                let f: &F = &*(f as *const F);
1355                f(&from_glib_borrow(this))
1356            }
1357        }
1358        unsafe {
1359            let f: Box_<F> = Box_::new(f);
1360            connect_raw(
1361                self.as_ptr() as *mut _,
1362                c"notify::uri".as_ptr(),
1363                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1364                    notify_uri_trampoline::<F> as *const (),
1365                )),
1366                Box_::into_raw(f),
1367            )
1368        }
1369    }
1370}
1371
1372// rustdoc-stripper-ignore-next
1373/// A [builder-pattern] type to construct [`Message`] objects.
1374///
1375/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1376#[must_use = "The builder must be built to be used"]
1377pub struct MessageBuilder {
1378    builder: glib::object::ObjectBuilder<'static, Message>,
1379}
1380
1381impl MessageBuilder {
1382    fn new() -> Self {
1383        Self {
1384            builder: glib::object::Object::builder(),
1385        }
1386    }
1387
1388    pub fn first_party(self, first_party: &glib::Uri) -> Self {
1389        Self {
1390            builder: self.builder.property("first-party", first_party.clone()),
1391        }
1392    }
1393
1394    pub fn flags(self, flags: MessageFlags) -> Self {
1395        Self {
1396            builder: self.builder.property("flags", flags),
1397        }
1398    }
1399
1400    pub fn is_options_ping(self, is_options_ping: bool) -> Self {
1401        Self {
1402            builder: self.builder.property("is-options-ping", is_options_ping),
1403        }
1404    }
1405
1406    pub fn is_top_level_navigation(self, is_top_level_navigation: bool) -> Self {
1407        Self {
1408            builder: self
1409                .builder
1410                .property("is-top-level-navigation", is_top_level_navigation),
1411        }
1412    }
1413
1414    pub fn method(self, method: impl Into<glib::GString>) -> Self {
1415        Self {
1416            builder: self.builder.property("method", method.into()),
1417        }
1418    }
1419
1420    pub fn priority(self, priority: MessagePriority) -> Self {
1421        Self {
1422            builder: self.builder.property("priority", priority),
1423        }
1424    }
1425
1426    pub fn site_for_cookies(self, site_for_cookies: &glib::Uri) -> Self {
1427        Self {
1428            builder: self
1429                .builder
1430                .property("site-for-cookies", site_for_cookies.clone()),
1431        }
1432    }
1433
1434    pub fn uri(self, uri: &glib::Uri) -> Self {
1435        Self {
1436            builder: self.builder.property("uri", uri.clone()),
1437        }
1438    }
1439
1440    // rustdoc-stripper-ignore-next
1441    /// Build the [`Message`].
1442    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1443    pub fn build(self) -> Message {
1444        assert_initialized_main_thread!();
1445        self.builder.build()
1446    }
1447}