|
1 | 1 | // Take a look at the license at the top of the repository in the LICENSE file.
|
2 | 2 |
|
3 |
| -use glib::{prelude::*, translate::*}; |
| 3 | +use glib::{prelude::*, translate::*, IntoStrV}; |
4 | 4 |
|
5 | 5 | use crate::{ProxyResolver, SimpleProxyResolver};
|
6 | 6 |
|
7 | 7 | impl SimpleProxyResolver {
|
8 | 8 | #[doc(alias = "g_simple_proxy_resolver_new")]
|
9 | 9 | #[allow(clippy::new_ret_no_self)]
|
10 |
| - pub fn new(default_proxy: Option<&str>, ignore_hosts: &[&str]) -> ProxyResolver { |
| 10 | + pub fn new(default_proxy: Option<&str>, ignore_hosts: impl IntoStrV) -> ProxyResolver { |
11 | 11 | unsafe {
|
12 |
| - from_glib_full(ffi::g_simple_proxy_resolver_new( |
13 |
| - default_proxy.to_glib_none().0, |
14 |
| - ignore_hosts.to_glib_none().0, |
15 |
| - )) |
| 12 | + ignore_hosts.run_with_strv(|ignore_hosts| { |
| 13 | + from_glib_full(ffi::g_simple_proxy_resolver_new( |
| 14 | + default_proxy.to_glib_none().0, |
| 15 | + ignore_hosts.as_ptr() as *mut _, |
| 16 | + )) |
| 17 | + }) |
16 | 18 | }
|
17 | 19 | }
|
18 | 20 | }
|
19 | 21 |
|
20 | 22 | pub trait SimpleProxyResolverExtManual: 'static {
|
21 | 23 | #[doc(alias = "g_simple_proxy_resolver_set_ignore_hosts")]
|
22 |
| - fn set_ignore_hosts(&self, ignore_hosts: &[&str]); |
| 24 | + fn set_ignore_hosts(&self, ignore_hosts: impl IntoStrV); |
23 | 25 | }
|
24 | 26 |
|
25 | 27 | impl<O: IsA<SimpleProxyResolver>> SimpleProxyResolverExtManual for O {
|
26 |
| - fn set_ignore_hosts(&self, ignore_hosts: &[&str]) { |
| 28 | + fn set_ignore_hosts(&self, ignore_hosts: impl IntoStrV) { |
27 | 29 | unsafe {
|
28 |
| - ffi::g_simple_proxy_resolver_set_ignore_hosts( |
29 |
| - self.as_ref().to_glib_none().0, |
30 |
| - ignore_hosts.to_glib_none().0, |
31 |
| - ); |
| 30 | + ignore_hosts.run_with_strv(|ignore_hosts| { |
| 31 | + ffi::g_simple_proxy_resolver_set_ignore_hosts( |
| 32 | + self.as_ref().to_glib_none().0, |
| 33 | + ignore_hosts.as_ptr() as *mut _, |
| 34 | + ); |
| 35 | + }) |
32 | 36 | }
|
33 | 37 | }
|
34 | 38 | }
|
0 commit comments