1use crate::{ffi, Channel, SessionMigration, SessionVerify, URI};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "SpiceSession")]
17 pub struct Session(Object<ffi::SpiceSession, ffi::SpiceSessionClass>);
18
19 match fn {
20 type_ => || ffi::spice_session_get_type(),
21 }
22}
23
24impl Session {
25 #[doc(alias = "spice_session_new")]
26 pub fn new() -> Session {
27 assert_initialized_main_thread!();
28 unsafe { from_glib_full(ffi::spice_session_new()) }
29 }
30
31 #[doc(alias = "spice_session_connect")]
32 pub fn connect(&self) -> bool {
33 unsafe { from_glib(ffi::spice_session_connect(self.to_glib_none().0)) }
34 }
35
36 #[doc(alias = "spice_session_disconnect")]
37 pub fn disconnect(&self) {
38 unsafe {
39 ffi::spice_session_disconnect(self.to_glib_none().0);
40 }
41 }
42
43 #[doc(alias = "spice_session_get_channels")]
44 #[doc(alias = "get_channels")]
45 pub fn channels(&self) -> Vec<Channel> {
46 unsafe {
47 FromGlibPtrContainer::from_glib_container(ffi::spice_session_get_channels(
48 self.to_glib_none().0,
49 ))
50 }
51 }
52
53 #[doc(alias = "spice_session_get_proxy_uri")]
54 #[doc(alias = "get_proxy_uri")]
55 pub fn proxy_uri(&self) -> Option<URI> {
56 unsafe { from_glib_none(ffi::spice_session_get_proxy_uri(self.to_glib_none().0)) }
57 }
58
59 #[doc(alias = "spice_session_get_read_only")]
60 #[doc(alias = "get_read_only")]
61 #[doc(alias = "read-only")]
62 pub fn is_read_only(&self) -> bool {
63 unsafe { from_glib(ffi::spice_session_get_read_only(self.to_glib_none().0)) }
64 }
65
66 #[doc(alias = "spice_session_has_channel_type")]
67 pub fn has_channel_type(&self, type_: i32) -> bool {
68 unsafe {
69 from_glib(ffi::spice_session_has_channel_type(
70 self.to_glib_none().0,
71 type_,
72 ))
73 }
74 }
75
76 #[doc(alias = "spice_session_is_for_migration")]
77 pub fn is_for_migration(&self) -> bool {
78 unsafe { from_glib(ffi::spice_session_is_for_migration(self.to_glib_none().0)) }
79 }
80
81 #[doc(alias = "spice_session_open_fd")]
82 pub fn open_fd(&self, fd: i32) -> bool {
83 unsafe { from_glib(ffi::spice_session_open_fd(self.to_glib_none().0, fd)) }
84 }
85
86 pub fn ca(&self) -> Option<glib::ByteArray> {
87 ObjectExt::property(self, "ca")
88 }
89
90 pub fn set_ca(&self, ca: Option<&glib::ByteArray>) {
91 ObjectExt::set_property(self, "ca", ca)
92 }
93
94 #[doc(alias = "ca-file")]
95 pub fn ca_file(&self) -> Option<glib::GString> {
96 ObjectExt::property(self, "ca-file")
97 }
98
99 #[doc(alias = "ca-file")]
100 pub fn set_ca_file(&self, ca_file: Option<&str>) {
101 ObjectExt::set_property(self, "ca-file", ca_file)
102 }
103
104 #[doc(alias = "cache-size")]
105 pub fn cache_size(&self) -> i32 {
106 ObjectExt::property(self, "cache-size")
107 }
108
109 #[doc(alias = "cache-size")]
110 pub fn set_cache_size(&self, cache_size: i32) {
111 ObjectExt::set_property(self, "cache-size", cache_size)
112 }
113
114 #[doc(alias = "cert-subject")]
115 pub fn cert_subject(&self) -> Option<glib::GString> {
116 ObjectExt::property(self, "cert-subject")
117 }
118
119 #[doc(alias = "cert-subject")]
120 pub fn set_cert_subject(&self, cert_subject: Option<&str>) {
121 ObjectExt::set_property(self, "cert-subject", cert_subject)
122 }
123
124 pub fn ciphers(&self) -> Option<glib::GString> {
125 ObjectExt::property(self, "ciphers")
126 }
127
128 pub fn set_ciphers(&self, ciphers: Option<&str>) {
129 ObjectExt::set_property(self, "ciphers", ciphers)
130 }
131
132 #[doc(alias = "client-sockets")]
133 pub fn is_client_sockets(&self) -> bool {
134 ObjectExt::property(self, "client-sockets")
135 }
136
137 #[doc(alias = "client-sockets")]
138 pub fn set_client_sockets(&self, client_sockets: bool) {
139 ObjectExt::set_property(self, "client-sockets", client_sockets)
140 }
141
142 #[doc(alias = "disable-effects")]
143 pub fn disable_effects(&self) -> Vec<glib::GString> {
144 ObjectExt::property(self, "disable-effects")
145 }
146
147 #[doc(alias = "disable-effects")]
148 pub fn set_disable_effects(&self, disable_effects: &[&str]) {
149 ObjectExt::set_property(self, "disable-effects", disable_effects)
150 }
151
152 #[doc(alias = "enable-audio")]
153 pub fn enables_audio(&self) -> bool {
154 ObjectExt::property(self, "enable-audio")
155 }
156
157 #[doc(alias = "enable-audio")]
158 pub fn set_enable_audio(&self, enable_audio: bool) {
159 ObjectExt::set_property(self, "enable-audio", enable_audio)
160 }
161
162 #[doc(alias = "enable-smartcard")]
163 pub fn enables_smartcard(&self) -> bool {
164 ObjectExt::property(self, "enable-smartcard")
165 }
166
167 #[doc(alias = "enable-smartcard")]
168 pub fn set_enable_smartcard(&self, enable_smartcard: bool) {
169 ObjectExt::set_property(self, "enable-smartcard", enable_smartcard)
170 }
171
172 #[doc(alias = "enable-usbredir")]
173 pub fn enables_usbredir(&self) -> bool {
174 ObjectExt::property(self, "enable-usbredir")
175 }
176
177 #[doc(alias = "enable-usbredir")]
178 pub fn set_enable_usbredir(&self, enable_usbredir: bool) {
179 ObjectExt::set_property(self, "enable-usbredir", enable_usbredir)
180 }
181
182 #[doc(alias = "gl-scanout")]
183 pub fn is_gl_scanout(&self) -> bool {
184 ObjectExt::property(self, "gl-scanout")
185 }
186
187 #[doc(alias = "gl-scanout")]
188 pub fn set_gl_scanout(&self, gl_scanout: bool) {
189 ObjectExt::set_property(self, "gl-scanout", gl_scanout)
190 }
191
192 #[doc(alias = "glz-window-size")]
193 pub fn glz_window_size(&self) -> i32 {
194 ObjectExt::property(self, "glz-window-size")
195 }
196
197 #[doc(alias = "glz-window-size")]
198 pub fn set_glz_window_size(&self, glz_window_size: i32) {
199 ObjectExt::set_property(self, "glz-window-size", glz_window_size)
200 }
201
202 pub fn host(&self) -> Option<glib::GString> {
203 ObjectExt::property(self, "host")
204 }
205
206 pub fn set_host(&self, host: Option<&str>) {
207 ObjectExt::set_property(self, "host", host)
208 }
209
210 #[doc(alias = "inhibit-keyboard-grab")]
211 pub fn is_inhibit_keyboard_grab(&self) -> bool {
212 ObjectExt::property(self, "inhibit-keyboard-grab")
213 }
214
215 #[doc(alias = "inhibit-keyboard-grab")]
216 pub fn set_inhibit_keyboard_grab(&self, inhibit_keyboard_grab: bool) {
217 ObjectExt::set_property(self, "inhibit-keyboard-grab", inhibit_keyboard_grab)
218 }
219
220 #[doc(alias = "migration-state")]
221 pub fn migration_state(&self) -> SessionMigration {
222 ObjectExt::property(self, "migration-state")
223 }
224
225 pub fn name(&self) -> Option<glib::GString> {
226 ObjectExt::property(self, "name")
227 }
228
229 pub fn password(&self) -> Option<glib::GString> {
230 ObjectExt::property(self, "password")
231 }
232
233 pub fn set_password(&self, password: Option<&str>) {
234 ObjectExt::set_property(self, "password", password)
235 }
236
237 pub fn port(&self) -> Option<glib::GString> {
238 ObjectExt::property(self, "port")
239 }
240
241 pub fn set_port(&self, port: Option<&str>) {
242 ObjectExt::set_property(self, "port", port)
243 }
244
245 pub fn protocol(&self) -> i32 {
246 ObjectExt::property(self, "protocol")
247 }
248
249 pub fn set_protocol(&self, protocol: i32) {
250 ObjectExt::set_property(self, "protocol", protocol)
251 }
252
253 pub fn proxy(&self) -> Option<glib::GString> {
254 ObjectExt::property(self, "proxy")
255 }
256
257 pub fn set_proxy(&self, proxy: Option<&str>) {
258 ObjectExt::set_property(self, "proxy", proxy)
259 }
260
261 pub fn pubkey(&self) -> Option<glib::ByteArray> {
262 ObjectExt::property(self, "pubkey")
263 }
264
265 pub fn set_pubkey(&self, pubkey: Option<&glib::ByteArray>) {
266 ObjectExt::set_property(self, "pubkey", pubkey)
267 }
268
269 #[doc(alias = "read-only")]
270 pub fn set_read_only(&self, read_only: bool) {
271 ObjectExt::set_property(self, "read-only", read_only)
272 }
273
274 #[doc(alias = "secure-channels")]
275 pub fn secure_channels(&self) -> Vec<glib::GString> {
276 ObjectExt::property(self, "secure-channels")
277 }
278
279 #[doc(alias = "secure-channels")]
280 pub fn set_secure_channels(&self, secure_channels: &[&str]) {
281 ObjectExt::set_property(self, "secure-channels", secure_channels)
282 }
283
284 #[doc(alias = "share-dir-ro")]
285 pub fn is_share_dir_ro(&self) -> bool {
286 ObjectExt::property(self, "share-dir-ro")
287 }
288
289 #[doc(alias = "share-dir-ro")]
290 pub fn set_share_dir_ro(&self, share_dir_ro: bool) {
291 ObjectExt::set_property(self, "share-dir-ro", share_dir_ro)
292 }
293
294 #[doc(alias = "shared-dir")]
295 pub fn shared_dir(&self) -> Option<glib::GString> {
296 ObjectExt::property(self, "shared-dir")
297 }
298
299 #[doc(alias = "shared-dir")]
300 pub fn set_shared_dir(&self, shared_dir: Option<&str>) {
301 ObjectExt::set_property(self, "shared-dir", shared_dir)
302 }
303
304 #[doc(alias = "smartcard-certificates")]
305 pub fn smartcard_certificates(&self) -> Vec<glib::GString> {
306 ObjectExt::property(self, "smartcard-certificates")
307 }
308
309 #[doc(alias = "smartcard-certificates")]
310 pub fn set_smartcard_certificates(&self, smartcard_certificates: &[&str]) {
311 ObjectExt::set_property(self, "smartcard-certificates", smartcard_certificates)
312 }
313
314 #[doc(alias = "smartcard-db")]
315 pub fn smartcard_db(&self) -> Option<glib::GString> {
316 ObjectExt::property(self, "smartcard-db")
317 }
318
319 #[doc(alias = "smartcard-db")]
320 pub fn set_smartcard_db(&self, smartcard_db: Option<&str>) {
321 ObjectExt::set_property(self, "smartcard-db", smartcard_db)
322 }
323
324 #[doc(alias = "tls-port")]
325 pub fn tls_port(&self) -> Option<glib::GString> {
326 ObjectExt::property(self, "tls-port")
327 }
328
329 #[doc(alias = "tls-port")]
330 pub fn set_tls_port(&self, tls_port: Option<&str>) {
331 ObjectExt::set_property(self, "tls-port", tls_port)
332 }
333
334 #[doc(alias = "unix-path")]
335 pub fn unix_path(&self) -> Option<glib::GString> {
336 ObjectExt::property(self, "unix-path")
337 }
338
339 #[doc(alias = "unix-path")]
340 pub fn set_unix_path(&self, unix_path: Option<&str>) {
341 ObjectExt::set_property(self, "unix-path", unix_path)
342 }
343
344 pub fn uri(&self) -> Option<glib::GString> {
345 ObjectExt::property(self, "uri")
346 }
347
348 pub fn set_uri(&self, uri: Option<&str>) {
349 ObjectExt::set_property(self, "uri", uri)
350 }
351
352 pub fn username(&self) -> Option<glib::GString> {
353 ObjectExt::property(self, "username")
354 }
355
356 pub fn set_username(&self, username: Option<&str>) {
357 ObjectExt::set_property(self, "username", username)
358 }
359
360 pub fn verify(&self) -> SessionVerify {
365 ObjectExt::property(self, "verify")
366 }
367
368 pub fn set_verify(&self, verify: SessionVerify) {
369 ObjectExt::set_property(self, "verify", verify)
370 }
371
372 #[doc(alias = "channel-destroy")]
373 pub fn connect_channel_destroy<F: Fn(&Self, &Channel) + 'static>(
374 &self,
375 f: F,
376 ) -> SignalHandlerId {
377 unsafe extern "C" fn channel_destroy_trampoline<F: Fn(&Session, &Channel) + 'static>(
378 this: *mut ffi::SpiceSession,
379 channel: *mut ffi::SpiceChannel,
380 f: glib::ffi::gpointer,
381 ) {
382 unsafe {
383 let f: &F = &*(f as *const F);
384 f(&from_glib_borrow(this), &from_glib_borrow(channel))
385 }
386 }
387 unsafe {
388 let f: Box_<F> = Box_::new(f);
389 connect_raw(
390 self.as_ptr() as *mut _,
391 c"channel-destroy".as_ptr(),
392 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
393 channel_destroy_trampoline::<F> as *const (),
394 )),
395 Box_::into_raw(f),
396 )
397 }
398 }
399
400 #[doc(alias = "channel-new")]
401 pub fn connect_channel_new<F: Fn(&Self, &Channel) + 'static>(&self, f: F) -> SignalHandlerId {
402 unsafe extern "C" fn channel_new_trampoline<F: Fn(&Session, &Channel) + 'static>(
403 this: *mut ffi::SpiceSession,
404 channel: *mut ffi::SpiceChannel,
405 f: glib::ffi::gpointer,
406 ) {
407 unsafe {
408 let f: &F = &*(f as *const F);
409 f(&from_glib_borrow(this), &from_glib_borrow(channel))
410 }
411 }
412 unsafe {
413 let f: Box_<F> = Box_::new(f);
414 connect_raw(
415 self.as_ptr() as *mut _,
416 c"channel-new".as_ptr(),
417 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
418 channel_new_trampoline::<F> as *const (),
419 )),
420 Box_::into_raw(f),
421 )
422 }
423 }
424
425 #[doc(alias = "disconnected")]
426 pub fn connect_disconnected<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
427 unsafe extern "C" fn disconnected_trampoline<F: Fn(&Session) + 'static>(
428 this: *mut ffi::SpiceSession,
429 f: glib::ffi::gpointer,
430 ) {
431 unsafe {
432 let f: &F = &*(f as *const F);
433 f(&from_glib_borrow(this))
434 }
435 }
436 unsafe {
437 let f: Box_<F> = Box_::new(f);
438 connect_raw(
439 self.as_ptr() as *mut _,
440 c"disconnected".as_ptr(),
441 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
442 disconnected_trampoline::<F> as *const (),
443 )),
444 Box_::into_raw(f),
445 )
446 }
447 }
448
449 #[doc(alias = "mm-time-reset")]
450 pub fn connect_mm_time_reset<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
451 unsafe extern "C" fn mm_time_reset_trampoline<F: Fn(&Session) + 'static>(
452 this: *mut ffi::SpiceSession,
453 f: glib::ffi::gpointer,
454 ) {
455 unsafe {
456 let f: &F = &*(f as *const F);
457 f(&from_glib_borrow(this))
458 }
459 }
460 unsafe {
461 let f: Box_<F> = Box_::new(f);
462 connect_raw(
463 self.as_ptr() as *mut _,
464 c"mm-time-reset".as_ptr(),
465 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
466 mm_time_reset_trampoline::<F> as *const (),
467 )),
468 Box_::into_raw(f),
469 )
470 }
471 }
472
473 #[doc(alias = "ca")]
474 pub fn connect_ca_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
475 unsafe extern "C" fn notify_ca_trampoline<F: Fn(&Session) + 'static>(
476 this: *mut ffi::SpiceSession,
477 _param_spec: glib::ffi::gpointer,
478 f: glib::ffi::gpointer,
479 ) {
480 unsafe {
481 let f: &F = &*(f as *const F);
482 f(&from_glib_borrow(this))
483 }
484 }
485 unsafe {
486 let f: Box_<F> = Box_::new(f);
487 connect_raw(
488 self.as_ptr() as *mut _,
489 c"notify::ca".as_ptr(),
490 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
491 notify_ca_trampoline::<F> as *const (),
492 )),
493 Box_::into_raw(f),
494 )
495 }
496 }
497
498 #[doc(alias = "ca-file")]
499 pub fn connect_ca_file_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
500 unsafe extern "C" fn notify_ca_file_trampoline<F: Fn(&Session) + 'static>(
501 this: *mut ffi::SpiceSession,
502 _param_spec: glib::ffi::gpointer,
503 f: glib::ffi::gpointer,
504 ) {
505 unsafe {
506 let f: &F = &*(f as *const F);
507 f(&from_glib_borrow(this))
508 }
509 }
510 unsafe {
511 let f: Box_<F> = Box_::new(f);
512 connect_raw(
513 self.as_ptr() as *mut _,
514 c"notify::ca-file".as_ptr(),
515 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
516 notify_ca_file_trampoline::<F> as *const (),
517 )),
518 Box_::into_raw(f),
519 )
520 }
521 }
522
523 #[doc(alias = "cache-size")]
524 pub fn connect_cache_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
525 unsafe extern "C" fn notify_cache_size_trampoline<F: Fn(&Session) + 'static>(
526 this: *mut ffi::SpiceSession,
527 _param_spec: glib::ffi::gpointer,
528 f: glib::ffi::gpointer,
529 ) {
530 unsafe {
531 let f: &F = &*(f as *const F);
532 f(&from_glib_borrow(this))
533 }
534 }
535 unsafe {
536 let f: Box_<F> = Box_::new(f);
537 connect_raw(
538 self.as_ptr() as *mut _,
539 c"notify::cache-size".as_ptr(),
540 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
541 notify_cache_size_trampoline::<F> as *const (),
542 )),
543 Box_::into_raw(f),
544 )
545 }
546 }
547
548 #[doc(alias = "cert-subject")]
549 pub fn connect_cert_subject_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
550 unsafe extern "C" fn notify_cert_subject_trampoline<F: Fn(&Session) + 'static>(
551 this: *mut ffi::SpiceSession,
552 _param_spec: glib::ffi::gpointer,
553 f: glib::ffi::gpointer,
554 ) {
555 unsafe {
556 let f: &F = &*(f as *const F);
557 f(&from_glib_borrow(this))
558 }
559 }
560 unsafe {
561 let f: Box_<F> = Box_::new(f);
562 connect_raw(
563 self.as_ptr() as *mut _,
564 c"notify::cert-subject".as_ptr(),
565 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
566 notify_cert_subject_trampoline::<F> as *const (),
567 )),
568 Box_::into_raw(f),
569 )
570 }
571 }
572
573 #[doc(alias = "ciphers")]
574 pub fn connect_ciphers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
575 unsafe extern "C" fn notify_ciphers_trampoline<F: Fn(&Session) + 'static>(
576 this: *mut ffi::SpiceSession,
577 _param_spec: glib::ffi::gpointer,
578 f: glib::ffi::gpointer,
579 ) {
580 unsafe {
581 let f: &F = &*(f as *const F);
582 f(&from_glib_borrow(this))
583 }
584 }
585 unsafe {
586 let f: Box_<F> = Box_::new(f);
587 connect_raw(
588 self.as_ptr() as *mut _,
589 c"notify::ciphers".as_ptr(),
590 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
591 notify_ciphers_trampoline::<F> as *const (),
592 )),
593 Box_::into_raw(f),
594 )
595 }
596 }
597
598 #[doc(alias = "client-sockets")]
599 pub fn connect_client_sockets_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
600 unsafe extern "C" fn notify_client_sockets_trampoline<F: Fn(&Session) + 'static>(
601 this: *mut ffi::SpiceSession,
602 _param_spec: glib::ffi::gpointer,
603 f: glib::ffi::gpointer,
604 ) {
605 unsafe {
606 let f: &F = &*(f as *const F);
607 f(&from_glib_borrow(this))
608 }
609 }
610 unsafe {
611 let f: Box_<F> = Box_::new(f);
612 connect_raw(
613 self.as_ptr() as *mut _,
614 c"notify::client-sockets".as_ptr(),
615 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
616 notify_client_sockets_trampoline::<F> as *const (),
617 )),
618 Box_::into_raw(f),
619 )
620 }
621 }
622
623 #[doc(alias = "disable-effects")]
624 pub fn connect_disable_effects_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
625 unsafe extern "C" fn notify_disable_effects_trampoline<F: Fn(&Session) + 'static>(
626 this: *mut ffi::SpiceSession,
627 _param_spec: glib::ffi::gpointer,
628 f: glib::ffi::gpointer,
629 ) {
630 unsafe {
631 let f: &F = &*(f as *const F);
632 f(&from_glib_borrow(this))
633 }
634 }
635 unsafe {
636 let f: Box_<F> = Box_::new(f);
637 connect_raw(
638 self.as_ptr() as *mut _,
639 c"notify::disable-effects".as_ptr(),
640 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
641 notify_disable_effects_trampoline::<F> as *const (),
642 )),
643 Box_::into_raw(f),
644 )
645 }
646 }
647
648 #[doc(alias = "enable-audio")]
649 pub fn connect_enable_audio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
650 unsafe extern "C" fn notify_enable_audio_trampoline<F: Fn(&Session) + 'static>(
651 this: *mut ffi::SpiceSession,
652 _param_spec: glib::ffi::gpointer,
653 f: glib::ffi::gpointer,
654 ) {
655 unsafe {
656 let f: &F = &*(f as *const F);
657 f(&from_glib_borrow(this))
658 }
659 }
660 unsafe {
661 let f: Box_<F> = Box_::new(f);
662 connect_raw(
663 self.as_ptr() as *mut _,
664 c"notify::enable-audio".as_ptr(),
665 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
666 notify_enable_audio_trampoline::<F> as *const (),
667 )),
668 Box_::into_raw(f),
669 )
670 }
671 }
672
673 #[doc(alias = "enable-smartcard")]
674 pub fn connect_enable_smartcard_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
675 unsafe extern "C" fn notify_enable_smartcard_trampoline<F: Fn(&Session) + 'static>(
676 this: *mut ffi::SpiceSession,
677 _param_spec: glib::ffi::gpointer,
678 f: glib::ffi::gpointer,
679 ) {
680 unsafe {
681 let f: &F = &*(f as *const F);
682 f(&from_glib_borrow(this))
683 }
684 }
685 unsafe {
686 let f: Box_<F> = Box_::new(f);
687 connect_raw(
688 self.as_ptr() as *mut _,
689 c"notify::enable-smartcard".as_ptr(),
690 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
691 notify_enable_smartcard_trampoline::<F> as *const (),
692 )),
693 Box_::into_raw(f),
694 )
695 }
696 }
697
698 #[doc(alias = "enable-usbredir")]
699 pub fn connect_enable_usbredir_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
700 unsafe extern "C" fn notify_enable_usbredir_trampoline<F: Fn(&Session) + 'static>(
701 this: *mut ffi::SpiceSession,
702 _param_spec: glib::ffi::gpointer,
703 f: glib::ffi::gpointer,
704 ) {
705 unsafe {
706 let f: &F = &*(f as *const F);
707 f(&from_glib_borrow(this))
708 }
709 }
710 unsafe {
711 let f: Box_<F> = Box_::new(f);
712 connect_raw(
713 self.as_ptr() as *mut _,
714 c"notify::enable-usbredir".as_ptr(),
715 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
716 notify_enable_usbredir_trampoline::<F> as *const (),
717 )),
718 Box_::into_raw(f),
719 )
720 }
721 }
722
723 #[doc(alias = "gl-scanout")]
724 pub fn connect_gl_scanout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
725 unsafe extern "C" fn notify_gl_scanout_trampoline<F: Fn(&Session) + 'static>(
726 this: *mut ffi::SpiceSession,
727 _param_spec: glib::ffi::gpointer,
728 f: glib::ffi::gpointer,
729 ) {
730 unsafe {
731 let f: &F = &*(f as *const F);
732 f(&from_glib_borrow(this))
733 }
734 }
735 unsafe {
736 let f: Box_<F> = Box_::new(f);
737 connect_raw(
738 self.as_ptr() as *mut _,
739 c"notify::gl-scanout".as_ptr(),
740 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
741 notify_gl_scanout_trampoline::<F> as *const (),
742 )),
743 Box_::into_raw(f),
744 )
745 }
746 }
747
748 #[doc(alias = "glz-window-size")]
749 pub fn connect_glz_window_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
750 unsafe extern "C" fn notify_glz_window_size_trampoline<F: Fn(&Session) + 'static>(
751 this: *mut ffi::SpiceSession,
752 _param_spec: glib::ffi::gpointer,
753 f: glib::ffi::gpointer,
754 ) {
755 unsafe {
756 let f: &F = &*(f as *const F);
757 f(&from_glib_borrow(this))
758 }
759 }
760 unsafe {
761 let f: Box_<F> = Box_::new(f);
762 connect_raw(
763 self.as_ptr() as *mut _,
764 c"notify::glz-window-size".as_ptr(),
765 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
766 notify_glz_window_size_trampoline::<F> as *const (),
767 )),
768 Box_::into_raw(f),
769 )
770 }
771 }
772
773 #[doc(alias = "host")]
774 pub fn connect_host_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
775 unsafe extern "C" fn notify_host_trampoline<F: Fn(&Session) + 'static>(
776 this: *mut ffi::SpiceSession,
777 _param_spec: glib::ffi::gpointer,
778 f: glib::ffi::gpointer,
779 ) {
780 unsafe {
781 let f: &F = &*(f as *const F);
782 f(&from_glib_borrow(this))
783 }
784 }
785 unsafe {
786 let f: Box_<F> = Box_::new(f);
787 connect_raw(
788 self.as_ptr() as *mut _,
789 c"notify::host".as_ptr(),
790 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
791 notify_host_trampoline::<F> as *const (),
792 )),
793 Box_::into_raw(f),
794 )
795 }
796 }
797
798 #[doc(alias = "inhibit-keyboard-grab")]
799 pub fn connect_inhibit_keyboard_grab_notify<F: Fn(&Self) + 'static>(
800 &self,
801 f: F,
802 ) -> SignalHandlerId {
803 unsafe extern "C" fn notify_inhibit_keyboard_grab_trampoline<F: Fn(&Session) + 'static>(
804 this: *mut ffi::SpiceSession,
805 _param_spec: glib::ffi::gpointer,
806 f: glib::ffi::gpointer,
807 ) {
808 unsafe {
809 let f: &F = &*(f as *const F);
810 f(&from_glib_borrow(this))
811 }
812 }
813 unsafe {
814 let f: Box_<F> = Box_::new(f);
815 connect_raw(
816 self.as_ptr() as *mut _,
817 c"notify::inhibit-keyboard-grab".as_ptr(),
818 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
819 notify_inhibit_keyboard_grab_trampoline::<F> as *const (),
820 )),
821 Box_::into_raw(f),
822 )
823 }
824 }
825
826 #[doc(alias = "migration-state")]
827 pub fn connect_migration_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
828 unsafe extern "C" fn notify_migration_state_trampoline<F: Fn(&Session) + 'static>(
829 this: *mut ffi::SpiceSession,
830 _param_spec: glib::ffi::gpointer,
831 f: glib::ffi::gpointer,
832 ) {
833 unsafe {
834 let f: &F = &*(f as *const F);
835 f(&from_glib_borrow(this))
836 }
837 }
838 unsafe {
839 let f: Box_<F> = Box_::new(f);
840 connect_raw(
841 self.as_ptr() as *mut _,
842 c"notify::migration-state".as_ptr(),
843 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
844 notify_migration_state_trampoline::<F> as *const (),
845 )),
846 Box_::into_raw(f),
847 )
848 }
849 }
850
851 #[doc(alias = "name")]
852 pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
853 unsafe extern "C" fn notify_name_trampoline<F: Fn(&Session) + 'static>(
854 this: *mut ffi::SpiceSession,
855 _param_spec: glib::ffi::gpointer,
856 f: glib::ffi::gpointer,
857 ) {
858 unsafe {
859 let f: &F = &*(f as *const F);
860 f(&from_glib_borrow(this))
861 }
862 }
863 unsafe {
864 let f: Box_<F> = Box_::new(f);
865 connect_raw(
866 self.as_ptr() as *mut _,
867 c"notify::name".as_ptr(),
868 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
869 notify_name_trampoline::<F> as *const (),
870 )),
871 Box_::into_raw(f),
872 )
873 }
874 }
875
876 #[doc(alias = "password")]
877 pub fn connect_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
878 unsafe extern "C" fn notify_password_trampoline<F: Fn(&Session) + 'static>(
879 this: *mut ffi::SpiceSession,
880 _param_spec: glib::ffi::gpointer,
881 f: glib::ffi::gpointer,
882 ) {
883 unsafe {
884 let f: &F = &*(f as *const F);
885 f(&from_glib_borrow(this))
886 }
887 }
888 unsafe {
889 let f: Box_<F> = Box_::new(f);
890 connect_raw(
891 self.as_ptr() as *mut _,
892 c"notify::password".as_ptr(),
893 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
894 notify_password_trampoline::<F> as *const (),
895 )),
896 Box_::into_raw(f),
897 )
898 }
899 }
900
901 #[doc(alias = "port")]
902 pub fn connect_port_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
903 unsafe extern "C" fn notify_port_trampoline<F: Fn(&Session) + 'static>(
904 this: *mut ffi::SpiceSession,
905 _param_spec: glib::ffi::gpointer,
906 f: glib::ffi::gpointer,
907 ) {
908 unsafe {
909 let f: &F = &*(f as *const F);
910 f(&from_glib_borrow(this))
911 }
912 }
913 unsafe {
914 let f: Box_<F> = Box_::new(f);
915 connect_raw(
916 self.as_ptr() as *mut _,
917 c"notify::port".as_ptr(),
918 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
919 notify_port_trampoline::<F> as *const (),
920 )),
921 Box_::into_raw(f),
922 )
923 }
924 }
925
926 #[doc(alias = "protocol")]
927 pub fn connect_protocol_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
928 unsafe extern "C" fn notify_protocol_trampoline<F: Fn(&Session) + 'static>(
929 this: *mut ffi::SpiceSession,
930 _param_spec: glib::ffi::gpointer,
931 f: glib::ffi::gpointer,
932 ) {
933 unsafe {
934 let f: &F = &*(f as *const F);
935 f(&from_glib_borrow(this))
936 }
937 }
938 unsafe {
939 let f: Box_<F> = Box_::new(f);
940 connect_raw(
941 self.as_ptr() as *mut _,
942 c"notify::protocol".as_ptr(),
943 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
944 notify_protocol_trampoline::<F> as *const (),
945 )),
946 Box_::into_raw(f),
947 )
948 }
949 }
950
951 #[doc(alias = "proxy")]
952 pub fn connect_proxy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
953 unsafe extern "C" fn notify_proxy_trampoline<F: Fn(&Session) + 'static>(
954 this: *mut ffi::SpiceSession,
955 _param_spec: glib::ffi::gpointer,
956 f: glib::ffi::gpointer,
957 ) {
958 unsafe {
959 let f: &F = &*(f as *const F);
960 f(&from_glib_borrow(this))
961 }
962 }
963 unsafe {
964 let f: Box_<F> = Box_::new(f);
965 connect_raw(
966 self.as_ptr() as *mut _,
967 c"notify::proxy".as_ptr(),
968 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
969 notify_proxy_trampoline::<F> as *const (),
970 )),
971 Box_::into_raw(f),
972 )
973 }
974 }
975
976 #[doc(alias = "pubkey")]
977 pub fn connect_pubkey_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
978 unsafe extern "C" fn notify_pubkey_trampoline<F: Fn(&Session) + 'static>(
979 this: *mut ffi::SpiceSession,
980 _param_spec: glib::ffi::gpointer,
981 f: glib::ffi::gpointer,
982 ) {
983 unsafe {
984 let f: &F = &*(f as *const F);
985 f(&from_glib_borrow(this))
986 }
987 }
988 unsafe {
989 let f: Box_<F> = Box_::new(f);
990 connect_raw(
991 self.as_ptr() as *mut _,
992 c"notify::pubkey".as_ptr(),
993 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
994 notify_pubkey_trampoline::<F> as *const (),
995 )),
996 Box_::into_raw(f),
997 )
998 }
999 }
1000
1001 #[doc(alias = "read-only")]
1002 pub fn connect_read_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1003 unsafe extern "C" fn notify_read_only_trampoline<F: Fn(&Session) + 'static>(
1004 this: *mut ffi::SpiceSession,
1005 _param_spec: glib::ffi::gpointer,
1006 f: glib::ffi::gpointer,
1007 ) {
1008 unsafe {
1009 let f: &F = &*(f as *const F);
1010 f(&from_glib_borrow(this))
1011 }
1012 }
1013 unsafe {
1014 let f: Box_<F> = Box_::new(f);
1015 connect_raw(
1016 self.as_ptr() as *mut _,
1017 c"notify::read-only".as_ptr(),
1018 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1019 notify_read_only_trampoline::<F> as *const (),
1020 )),
1021 Box_::into_raw(f),
1022 )
1023 }
1024 }
1025
1026 #[doc(alias = "secure-channels")]
1027 pub fn connect_secure_channels_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1028 unsafe extern "C" fn notify_secure_channels_trampoline<F: Fn(&Session) + 'static>(
1029 this: *mut ffi::SpiceSession,
1030 _param_spec: glib::ffi::gpointer,
1031 f: glib::ffi::gpointer,
1032 ) {
1033 unsafe {
1034 let f: &F = &*(f as *const F);
1035 f(&from_glib_borrow(this))
1036 }
1037 }
1038 unsafe {
1039 let f: Box_<F> = Box_::new(f);
1040 connect_raw(
1041 self.as_ptr() as *mut _,
1042 c"notify::secure-channels".as_ptr(),
1043 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1044 notify_secure_channels_trampoline::<F> as *const (),
1045 )),
1046 Box_::into_raw(f),
1047 )
1048 }
1049 }
1050
1051 #[doc(alias = "share-dir-ro")]
1052 pub fn connect_share_dir_ro_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1053 unsafe extern "C" fn notify_share_dir_ro_trampoline<F: Fn(&Session) + 'static>(
1054 this: *mut ffi::SpiceSession,
1055 _param_spec: glib::ffi::gpointer,
1056 f: glib::ffi::gpointer,
1057 ) {
1058 unsafe {
1059 let f: &F = &*(f as *const F);
1060 f(&from_glib_borrow(this))
1061 }
1062 }
1063 unsafe {
1064 let f: Box_<F> = Box_::new(f);
1065 connect_raw(
1066 self.as_ptr() as *mut _,
1067 c"notify::share-dir-ro".as_ptr(),
1068 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1069 notify_share_dir_ro_trampoline::<F> as *const (),
1070 )),
1071 Box_::into_raw(f),
1072 )
1073 }
1074 }
1075
1076 #[doc(alias = "shared-dir")]
1077 pub fn connect_shared_dir_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1078 unsafe extern "C" fn notify_shared_dir_trampoline<F: Fn(&Session) + 'static>(
1079 this: *mut ffi::SpiceSession,
1080 _param_spec: glib::ffi::gpointer,
1081 f: glib::ffi::gpointer,
1082 ) {
1083 unsafe {
1084 let f: &F = &*(f as *const F);
1085 f(&from_glib_borrow(this))
1086 }
1087 }
1088 unsafe {
1089 let f: Box_<F> = Box_::new(f);
1090 connect_raw(
1091 self.as_ptr() as *mut _,
1092 c"notify::shared-dir".as_ptr(),
1093 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1094 notify_shared_dir_trampoline::<F> as *const (),
1095 )),
1096 Box_::into_raw(f),
1097 )
1098 }
1099 }
1100
1101 #[doc(alias = "smartcard-certificates")]
1102 pub fn connect_smartcard_certificates_notify<F: Fn(&Self) + 'static>(
1103 &self,
1104 f: F,
1105 ) -> SignalHandlerId {
1106 unsafe extern "C" fn notify_smartcard_certificates_trampoline<F: Fn(&Session) + 'static>(
1107 this: *mut ffi::SpiceSession,
1108 _param_spec: glib::ffi::gpointer,
1109 f: glib::ffi::gpointer,
1110 ) {
1111 unsafe {
1112 let f: &F = &*(f as *const F);
1113 f(&from_glib_borrow(this))
1114 }
1115 }
1116 unsafe {
1117 let f: Box_<F> = Box_::new(f);
1118 connect_raw(
1119 self.as_ptr() as *mut _,
1120 c"notify::smartcard-certificates".as_ptr(),
1121 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1122 notify_smartcard_certificates_trampoline::<F> as *const (),
1123 )),
1124 Box_::into_raw(f),
1125 )
1126 }
1127 }
1128
1129 #[doc(alias = "smartcard-db")]
1130 pub fn connect_smartcard_db_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1131 unsafe extern "C" fn notify_smartcard_db_trampoline<F: Fn(&Session) + 'static>(
1132 this: *mut ffi::SpiceSession,
1133 _param_spec: glib::ffi::gpointer,
1134 f: glib::ffi::gpointer,
1135 ) {
1136 unsafe {
1137 let f: &F = &*(f as *const F);
1138 f(&from_glib_borrow(this))
1139 }
1140 }
1141 unsafe {
1142 let f: Box_<F> = Box_::new(f);
1143 connect_raw(
1144 self.as_ptr() as *mut _,
1145 c"notify::smartcard-db".as_ptr(),
1146 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1147 notify_smartcard_db_trampoline::<F> as *const (),
1148 )),
1149 Box_::into_raw(f),
1150 )
1151 }
1152 }
1153
1154 #[doc(alias = "tls-port")]
1155 pub fn connect_tls_port_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1156 unsafe extern "C" fn notify_tls_port_trampoline<F: Fn(&Session) + 'static>(
1157 this: *mut ffi::SpiceSession,
1158 _param_spec: glib::ffi::gpointer,
1159 f: glib::ffi::gpointer,
1160 ) {
1161 unsafe {
1162 let f: &F = &*(f as *const F);
1163 f(&from_glib_borrow(this))
1164 }
1165 }
1166 unsafe {
1167 let f: Box_<F> = Box_::new(f);
1168 connect_raw(
1169 self.as_ptr() as *mut _,
1170 c"notify::tls-port".as_ptr(),
1171 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1172 notify_tls_port_trampoline::<F> as *const (),
1173 )),
1174 Box_::into_raw(f),
1175 )
1176 }
1177 }
1178
1179 #[doc(alias = "unix-path")]
1180 pub fn connect_unix_path_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1181 unsafe extern "C" fn notify_unix_path_trampoline<F: Fn(&Session) + 'static>(
1182 this: *mut ffi::SpiceSession,
1183 _param_spec: glib::ffi::gpointer,
1184 f: glib::ffi::gpointer,
1185 ) {
1186 unsafe {
1187 let f: &F = &*(f as *const F);
1188 f(&from_glib_borrow(this))
1189 }
1190 }
1191 unsafe {
1192 let f: Box_<F> = Box_::new(f);
1193 connect_raw(
1194 self.as_ptr() as *mut _,
1195 c"notify::unix-path".as_ptr(),
1196 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1197 notify_unix_path_trampoline::<F> as *const (),
1198 )),
1199 Box_::into_raw(f),
1200 )
1201 }
1202 }
1203
1204 #[doc(alias = "uri")]
1205 pub fn connect_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1206 unsafe extern "C" fn notify_uri_trampoline<F: Fn(&Session) + 'static>(
1207 this: *mut ffi::SpiceSession,
1208 _param_spec: glib::ffi::gpointer,
1209 f: glib::ffi::gpointer,
1210 ) {
1211 unsafe {
1212 let f: &F = &*(f as *const F);
1213 f(&from_glib_borrow(this))
1214 }
1215 }
1216 unsafe {
1217 let f: Box_<F> = Box_::new(f);
1218 connect_raw(
1219 self.as_ptr() as *mut _,
1220 c"notify::uri".as_ptr(),
1221 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1222 notify_uri_trampoline::<F> as *const (),
1223 )),
1224 Box_::into_raw(f),
1225 )
1226 }
1227 }
1228
1229 #[doc(alias = "username")]
1230 pub fn connect_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1231 unsafe extern "C" fn notify_username_trampoline<F: Fn(&Session) + 'static>(
1232 this: *mut ffi::SpiceSession,
1233 _param_spec: glib::ffi::gpointer,
1234 f: glib::ffi::gpointer,
1235 ) {
1236 unsafe {
1237 let f: &F = &*(f as *const F);
1238 f(&from_glib_borrow(this))
1239 }
1240 }
1241 unsafe {
1242 let f: Box_<F> = Box_::new(f);
1243 connect_raw(
1244 self.as_ptr() as *mut _,
1245 c"notify::username".as_ptr(),
1246 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1247 notify_username_trampoline::<F> as *const (),
1248 )),
1249 Box_::into_raw(f),
1250 )
1251 }
1252 }
1253
1254 #[doc(alias = "uuid")]
1255 pub fn connect_uuid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1256 unsafe extern "C" fn notify_uuid_trampoline<F: Fn(&Session) + 'static>(
1257 this: *mut ffi::SpiceSession,
1258 _param_spec: glib::ffi::gpointer,
1259 f: glib::ffi::gpointer,
1260 ) {
1261 unsafe {
1262 let f: &F = &*(f as *const F);
1263 f(&from_glib_borrow(this))
1264 }
1265 }
1266 unsafe {
1267 let f: Box_<F> = Box_::new(f);
1268 connect_raw(
1269 self.as_ptr() as *mut _,
1270 c"notify::uuid".as_ptr(),
1271 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1272 notify_uuid_trampoline::<F> as *const (),
1273 )),
1274 Box_::into_raw(f),
1275 )
1276 }
1277 }
1278
1279 #[doc(alias = "verify")]
1280 pub fn connect_verify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1281 unsafe extern "C" fn notify_verify_trampoline<F: Fn(&Session) + 'static>(
1282 this: *mut ffi::SpiceSession,
1283 _param_spec: glib::ffi::gpointer,
1284 f: glib::ffi::gpointer,
1285 ) {
1286 unsafe {
1287 let f: &F = &*(f as *const F);
1288 f(&from_glib_borrow(this))
1289 }
1290 }
1291 unsafe {
1292 let f: Box_<F> = Box_::new(f);
1293 connect_raw(
1294 self.as_ptr() as *mut _,
1295 c"notify::verify".as_ptr(),
1296 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1297 notify_verify_trampoline::<F> as *const (),
1298 )),
1299 Box_::into_raw(f),
1300 )
1301 }
1302 }
1303}
1304
1305impl Default for Session {
1306 fn default() -> Self {
1307 Self::new()
1308 }
1309}