Skip to content

Commit 801cd17

Browse files
committed
gio: use StrV for TlsConnection
1 parent 063c4d4 commit 801cd17

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

gio/Gir.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,10 @@ manual_traits = ["TlsConnectionExtManual"]
13641364
name = "get_channel_binding_data"
13651365
# Gir confuses the mutability of the data
13661366
manual = true
1367+
[[object.function]]
1368+
name = "set_advertised_protocols"
1369+
# Use strv
1370+
manual = true
13671371

13681372
[[object]]
13691373
name = "Gio.TlsError"

gio/src/auto/tls_connection.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ pub trait TlsConnectionExt: 'static {
102102
io_priority: glib::Priority,
103103
) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>;
104104

105-
#[cfg(any(feature = "v2_60", feature = "dox"))]
106-
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
107-
#[doc(alias = "g_tls_connection_set_advertised_protocols")]
108-
fn set_advertised_protocols(&self, protocols: &[&str]);
109-
110105
#[doc(alias = "g_tls_connection_set_certificate")]
111106
fn set_certificate(&self, certificate: &impl IsA<TlsCertificate>);
112107

@@ -369,17 +364,6 @@ impl<O: IsA<TlsConnection>> TlsConnectionExt for O {
369364
))
370365
}
371366

372-
#[cfg(any(feature = "v2_60", feature = "dox"))]
373-
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
374-
fn set_advertised_protocols(&self, protocols: &[&str]) {
375-
unsafe {
376-
ffi::g_tls_connection_set_advertised_protocols(
377-
self.as_ref().to_glib_none().0,
378-
protocols.to_glib_none().0,
379-
);
380-
}
381-
}
382-
383367
fn set_certificate(&self, certificate: &impl IsA<TlsCertificate>) {
384368
unsafe {
385369
ffi::g_tls_connection_set_certificate(

gio/src/tls_connection.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::ptr;
55

66
use glib::prelude::*;
77
#[cfg(any(feature = "v2_66", feature = "dox"))]
8-
use glib::translate::*;
8+
use glib::{translate::*, IntoStrV};
99

1010
#[cfg(any(feature = "v2_66", feature = "dox"))]
1111
use crate::TlsChannelBindingType;
@@ -20,6 +20,11 @@ pub trait TlsConnectionExtManual {
2020
&self,
2121
type_: TlsChannelBindingType,
2222
) -> Result<glib::ByteArray, glib::Error>;
23+
24+
#[cfg(any(feature = "v2_60", feature = "dox"))]
25+
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
26+
#[doc(alias = "g_tls_connection_set_advertised_protocols")]
27+
fn set_advertised_protocols(&self, protocols: impl IntoStrV);
2328
}
2429

2530
impl<O: IsA<TlsConnection>> TlsConnectionExtManual for O {
@@ -45,4 +50,17 @@ impl<O: IsA<TlsConnection>> TlsConnectionExtManual for O {
4550
}
4651
}
4752
}
53+
54+
#[cfg(any(feature = "v2_60", feature = "dox"))]
55+
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
56+
fn set_advertised_protocols(&self, protocols: impl IntoStrV) {
57+
unsafe {
58+
protocols.run_with_strv(|protocols| {
59+
ffi::g_tls_connection_set_advertised_protocols(
60+
self.as_ref().to_glib_none().0,
61+
protocols.as_ptr() as *mut _,
62+
);
63+
})
64+
}
65+
}
4866
}

0 commit comments

Comments
 (0)