Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions gdk-pixbuf/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,13 @@ concurrency = "send+sync"
[[object.function.parameter]]
name = "format"
const = true
[[object.function]]
name = "get_extensions"
[object.function.return]
# The array is `NULL`-terminated
nullable = false
[[object.function]]
name = "get_mime_types"
[object.function.return]
# The array is `NULL`-terminated
nullable = false
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/pixbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ impl Pixbuf {
//}

//#[doc(alias = "gdk_pixbuf_save_to_callbackv")]
//pub fn save_to_callbackv<P: FnMut(&Vec<u8>, usize, &glib::Error) -> bool>(&self, save_func: P, type_: &str, option_keys: &[&str], option_values: &[&str]) -> Result<(), glib::Error> {
//pub fn save_to_callbackv<P: FnMut(&Vec<u8>, usize, &glib::Error) -> bool>(&self, save_func: P, type_: &str, option_keys: Option<&[&str]>, option_values: Option<&[&str]>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:gdk_pixbuf_save_to_callbackv() }
//}

Expand Down
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 7047e1b433e2)
Generated by gir (https://github.com/gtk-rs/gir @ 27b9ace47ead)
from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8)
2 changes: 1 addition & 1 deletion gdk-pixbuf/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 7047e1b433e2)
Generated by gir (https://github.com/gtk-rs/gir @ 27b9ace47ead)
from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8)
20 changes: 19 additions & 1 deletion gio/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ generate = [
"Gio.TestDBusFlags",
"Gio.TlsAuthenticationMode",
"Gio.TlsBackend",
"Gio.TlsCertificate",
"Gio.TlsCertificateRequestFlags",
"Gio.TlsChannelBindingError",
"Gio.TlsClientConnection",
Expand Down Expand Up @@ -931,6 +930,11 @@ status = "generate"
name = "set_attribute_stringv"
# use strv
manual = true
[[object.function]]
name = "list_attributes"
[object.function.return]
# `NULL` on error it's only used for the case where `FileInfo` is NULL, which is not possible in Rust.
nullable = false

[[object]]
name = "Gio.FilterOutputStream"
Expand Down Expand Up @@ -1496,6 +1500,20 @@ status = "generate"
# Better to provide None than -1 when you don't want to specify the number of threads
manual = true

[[object]]
name = "Gio.TlsCertificate"
status = "generate"
[[object.function]]
name = "get_dns_names"
[object.function.return]
# `NULL` if it’s not available.
nullable = true
[[object.function]]
name = "get_ip_addresses"
[object.function.return]
# `NULL` if it’s not available.
nullable = true

[[object]]
name = "Gio.TlsCertificateFlags"
status = "generate"
Expand Down
4 changes: 2 additions & 2 deletions gio/src/auto/app_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ pub trait AppInfoExt: IsA<AppInfo> + 'static {
#[doc(alias = "g_app_info_launch")]
fn launch(
&self,
files: &[File],
files: Option<&[File]>,
context: Option<&impl IsA<AppLaunchContext>>,
) -> Result<(), glib::Error> {
unsafe {
Expand All @@ -487,7 +487,7 @@ pub trait AppInfoExt: IsA<AppInfo> + 'static {
#[doc(alias = "g_app_info_launch_uris")]
fn launch_uris(
&self,
uris: &[&str],
uris: Option<&[&str]>,
context: Option<&impl IsA<AppLaunchContext>>,
) -> Result<(), glib::Error> {
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion gio/src/auto/app_launch_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub trait AppLaunchContextExt: IsA<AppLaunchContext> + 'static {
fn startup_notify_id(
&self,
info: Option<&impl IsA<AppInfo>>,
files: &[File],
files: Option<&[File]>,
) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::g_app_launch_context_get_startup_notify_id(
Expand Down
8 changes: 4 additions & 4 deletions gio/src/auto/dbus_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,11 @@ pub trait DBusProxyExt: IsA<DBusProxy> + 'static {

#[doc(alias = "g_dbus_proxy_get_cached_property_names")]
#[doc(alias = "get_cached_property_names")]
fn cached_property_names(&self) -> Vec<glib::GString> {
fn cached_property_names(&self) -> Option<Vec<glib::GString>> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::g_dbus_proxy_get_cached_property_names(
self.as_ref().to_glib_none().0,
))
MaybeFromGlibPtrContainer::maybe_from_glib_full(
ffi::g_dbus_proxy_get_cached_property_names(self.as_ref().to_glib_none().0),
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gio/src/auto/dtls_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ pub trait DtlsConnectionExt: IsA<DtlsConnection> + 'static {
#[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
#[doc(alias = "g_dtls_connection_set_advertised_protocols")]
#[doc(alias = "advertised-protocols")]
fn set_advertised_protocols(&self, protocols: &[&str]) {
fn set_advertised_protocols(&self, protocols: Option<&[&str]>) {
unsafe {
ffi::g_dtls_connection_set_advertised_protocols(
self.as_ref().to_glib_none().0,
Expand Down
2 changes: 1 addition & 1 deletion gio/src/auto/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub fn content_type_is_unknown(type_: &str) -> bool {
#[cfg(feature = "v2_60")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
#[doc(alias = "g_content_type_set_mime_dirs")]
pub fn content_type_set_mime_dirs(dirs: &[&str]) {
pub fn content_type_set_mime_dirs(dirs: Option<&[&str]>) {
unsafe {
ffi::g_content_type_set_mime_dirs(dirs.to_glib_none().0);
}
Expand Down
16 changes: 8 additions & 8 deletions gio/src/auto/tls_certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ pub trait TlsCertificateExt: IsA<TlsCertificate> + 'static {
#[doc(alias = "g_tls_certificate_get_dns_names")]
#[doc(alias = "get_dns_names")]
#[doc(alias = "dns-names")]
fn dns_names(&self) -> Vec<glib::Bytes> {
fn dns_names(&self) -> Option<Vec<glib::Bytes>> {
unsafe {
FromGlibPtrContainer::from_glib_container(ffi::g_tls_certificate_get_dns_names(
self.as_ref().to_glib_none().0,
))
MaybeFromGlibPtrContainer::maybe_from_glib_container(
ffi::g_tls_certificate_get_dns_names(self.as_ref().to_glib_none().0),
)
}
}

Expand All @@ -184,11 +184,11 @@ pub trait TlsCertificateExt: IsA<TlsCertificate> + 'static {
#[doc(alias = "g_tls_certificate_get_ip_addresses")]
#[doc(alias = "get_ip_addresses")]
#[doc(alias = "ip-addresses")]
fn ip_addresses(&self) -> Vec<InetAddress> {
fn ip_addresses(&self) -> Option<Vec<InetAddress>> {
unsafe {
FromGlibPtrContainer::from_glib_container(ffi::g_tls_certificate_get_ip_addresses(
self.as_ref().to_glib_none().0,
))
MaybeFromGlibPtrContainer::maybe_from_glib_container(
ffi::g_tls_certificate_get_ip_addresses(self.as_ref().to_glib_none().0),
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gio/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 7047e1b433e2)
Generated by gir (https://github.com/gtk-rs/gir @ 27b9ace47ead)
from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8)
2 changes: 1 addition & 1 deletion gio/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 7047e1b433e2)
Generated by gir (https://github.com/gtk-rs/gir @ 27b9ace47ead)
from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8)
2 changes: 1 addition & 1 deletion glib/gobject-sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 7047e1b433e2)
Generated by gir (https://github.com/gtk-rs/gir @ 27b9ace47ead)
from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8)
6 changes: 3 additions & 3 deletions glib/src/auto/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ pub fn spaced_primes_closest(num: u32) -> u32 {
pub fn spawn_async(
working_directory: Option<impl AsRef<std::path::Path>>,
argv: &[&std::path::Path],
envp: &[&std::path::Path],
envp: Option<&[&std::path::Path]>,
flags: SpawnFlags,
child_setup: Option<Box_<dyn FnOnce() + 'static>>,
) -> Result<Pid, crate::Error> {
Expand Down Expand Up @@ -756,7 +756,7 @@ pub fn spawn_async(
//#[cfg(feature = "v2_68")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v2_68")))]
//#[doc(alias = "g_spawn_async_with_pipes_and_fds")]
//pub fn spawn_async_with_pipes_and_fds(working_directory: Option<impl AsRef<std::path::Path>>, argv: &[&std::path::Path], envp: &[&std::path::Path], flags: SpawnFlags, child_setup: Option<Box_<dyn FnOnce() + 'static>>, stdin_fd: i32, stdout_fd: i32, stderr_fd: i32, source_fds: &[i32], target_fds: &[i32], n_fds: usize) -> Result<(Pid, i32, i32, i32), crate::Error> {
//pub fn spawn_async_with_pipes_and_fds(working_directory: Option<impl AsRef<std::path::Path>>, argv: &[&std::path::Path], envp: Option<&[&std::path::Path]>, flags: SpawnFlags, child_setup: Option<Box_<dyn FnOnce() + 'static>>, stdin_fd: i32, stdout_fd: i32, stderr_fd: i32, source_fds: &[i32], target_fds: &[i32], n_fds: usize) -> Result<(Pid, i32, i32, i32), crate::Error> {
// unsafe { TODO: call ffi:g_spawn_async_with_pipes_and_fds() }
//}

Expand Down Expand Up @@ -817,7 +817,7 @@ pub fn spawn_command_line_async(
//}

//#[doc(alias = "g_spawn_sync")]
//pub fn spawn_sync(working_directory: Option<impl AsRef<std::path::Path>>, argv: &[&std::path::Path], envp: &[&std::path::Path], flags: SpawnFlags, child_setup: Option<&mut dyn FnMut()>, standard_output: Vec<u8>, standard_error: Vec<u8>) -> Result<i32, crate::Error> {
//pub fn spawn_sync(working_directory: Option<impl AsRef<std::path::Path>>, argv: &[&std::path::Path], envp: Option<&[&std::path::Path]>, flags: SpawnFlags, child_setup: Option<&mut dyn FnMut()>, standard_output: Vec<u8>, standard_error: Vec<u8>) -> Result<i32, crate::Error> {
// unsafe { TODO: call ffi:g_spawn_sync() }
//}

Expand Down
2 changes: 1 addition & 1 deletion glib/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 7047e1b433e2)
Generated by gir (https://github.com/gtk-rs/gir @ 27b9ace47ead)
from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8)
67 changes: 52 additions & 15 deletions glib/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,13 @@ macro_rules! glib_boxed_wrapper {
}

#[doc(hidden)]
impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::translate::FromGlibContainerAsVec<*mut $ffi_name, *mut *mut $ffi_name> for $name $(<$($generic),+>)? {
unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Vec<Self> {
if num == 0 || ptr.is_null() {
return Vec::new();
impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::translate::MaybeFromGlibContainerAsVec<*mut $ffi_name, *mut *mut $ffi_name> for $name $(<$($generic),+>)? {
unsafe fn maybe_from_glib_none_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Option<Vec<Self>> {
if ptr.is_null() {
return None;
}
if num == 0 {
return Some(Vec::new());
}

let mut res = Vec::<Self>::with_capacity(num);
Expand All @@ -265,44 +268,78 @@ macro_rules! glib_boxed_wrapper {
::std::ptr::write(res_ptr.add(i), $crate::translate::from_glib_none(std::ptr::read(ptr.add(i))));
}
res.set_len(num);
res
Some(res)
}

unsafe fn from_glib_container_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Vec<Self> {
let res = $crate::translate::FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, num);
unsafe fn maybe_from_glib_container_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Option<Vec<Self>> {
let res = $crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_none_num_as_vec(ptr, num)?;
$crate::ffi::g_free(ptr as *mut _);
res
Some(res)
}

unsafe fn from_glib_full_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Vec<Self> {
if num == 0 || ptr.is_null() {
unsafe fn maybe_from_glib_full_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Option<Vec<Self>> {
if ptr.is_null() {
return None;
}
if num == 0 {
$crate::ffi::g_free(ptr as *mut _);
return Vec::new();
return Some(Vec::new());
}

let mut res = Vec::with_capacity(num);
let res_ptr = res.as_mut_ptr();
::std::ptr::copy_nonoverlapping(ptr as *mut Self, res_ptr, num);
res.set_len(num);
$crate::ffi::g_free(ptr as *mut _);
res
Some(res)
}
}

#[doc(hidden)]
impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::translate::FromGlibContainerAsVec<*mut $ffi_name, *mut *mut $ffi_name> for $name $(<$($generic),+>)? {
unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Vec<Self> {
$crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_none_num_as_vec(ptr, num).unwrap_or_default()
}

unsafe fn from_glib_container_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Vec<Self> {
$crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_container_num_as_vec(ptr, num).unwrap_or_default()
}

unsafe fn from_glib_full_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Vec<Self> {
$crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_full_num_as_vec(ptr, num).unwrap_or_default()
}
}

#[doc(hidden)]
impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::translate::MaybeFromGlibPtrArrayContainerAsVec<*mut $ffi_name, *mut *mut $ffi_name> for $name $(<$($generic),+>)? {
unsafe fn maybe_from_glib_none_as_vec(ptr: *mut *mut $ffi_name) -> Option<Vec<Self>> {
$crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_none_num_as_vec(ptr, $crate::translate::c_ptr_array_len(ptr)?)
}

unsafe fn maybe_from_glib_container_as_vec(ptr: *mut *mut $ffi_name) -> Option<Vec<Self>> {
$crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_container_num_as_vec(ptr, $crate::translate::c_ptr_array_len(ptr)?)
}

unsafe fn maybe_from_glib_full_as_vec(ptr: *mut *mut $ffi_name) -> Option<Vec<Self>> {
$crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_full_num_as_vec(ptr, $crate::translate::c_ptr_array_len(ptr)?)
}
}

#[doc(hidden)]
impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::translate::FromGlibPtrArrayContainerAsVec<*mut $ffi_name, *mut *mut $ffi_name> for $name $(<$($generic),+>)? {
unsafe fn from_glib_none_as_vec(ptr: *mut *mut $ffi_name) -> Vec<Self> {
$crate::translate::FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, $crate::translate::c_ptr_array_len(ptr))
$crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_none_num_as_vec(ptr, $crate::translate::c_ptr_array_len(ptr).unwrap_or(0)).unwrap_or_default()
}

unsafe fn from_glib_container_as_vec(ptr: *mut *mut $ffi_name) -> Vec<Self> {
$crate::translate::FromGlibContainerAsVec::from_glib_container_num_as_vec(ptr, $crate::translate::c_ptr_array_len(ptr))
$crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_container_num_as_vec(ptr, $crate::translate::c_ptr_array_len(ptr).unwrap_or(0)).unwrap_or_default()
}

unsafe fn from_glib_full_as_vec(ptr: *mut *mut $ffi_name) -> Vec<Self> {
$crate::translate::FromGlibContainerAsVec::from_glib_full_num_as_vec(ptr, $crate::translate::c_ptr_array_len(ptr))
$crate::translate::MaybeFromGlibContainerAsVec::maybe_from_glib_full_num_as_vec(ptr, $crate::translate::c_ptr_array_len(ptr).unwrap_or(0)).unwrap_or_default()
}
}

#[doc(hidden)]
impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::translate::IntoGlibPtr<*mut $ffi_name> for $name $(<$($generic),+>)? {
#[inline]
Expand Down
Loading
Loading