Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gir / gir-files and update for time_t #1349

Merged
merged 11 commits into from
Apr 6, 2024
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- { name: "gdk-pixbuf", features: "v2_42", nightly: "--all-features", test_sys: true }
- { name: "gio", features: "v2_80", nightly: "--all-features", test_sys: true }
- { name: "glib", features: "v2_80", nightly: "--all-features", test_sys: false }
- { name: "graphene", features: "v1_12", nightly: "", test_sys: true }
- { name: "graphene", features: "", nightly: "", test_sys: true }
- { name: "pango", features: "v1_50", nightly: "--all-features", test_sys: true }
- { name: "pangocairo", features: "", nightly: "--all-features", test_sys: true }
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

env:
# git revision of gvsbuild we use for to build GLib and the other dependencies
gvsbuildref: de70bfe8f540249aafbf8247ac6886019262917f
gvsbuildref: 876d21a1ecd8db1398b1dba263efee1bc3befad8

# bump this number if you want to force a rebuild of gvsbuild with the same revision
gvsbuildupdate: 1
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
- { name: "glib", test: true, args: "--features v2_80" }
- { name: "glib-build-tools", test: false, args: "" }
- { name: "graphene", test: false, args: "" }
- { name: "pango", test: true, args: "--features v1_50" }
- { name: "pango", test: true, args: "--features v1_52" }
- { name: "pangocairo", test: true, args: "" }
- { name: "examples", test: false, args: "--bins --examples --all-features" }

Expand Down
4 changes: 2 additions & 2 deletions 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 @ c537d4a59043)
from gir-files (https://github.com/gtk-rs/gir-files @ 2437ecd9a33d)
Generated by gir (https://github.com/gtk-rs/gir @ eb5be4f1bafe)
from gir-files (https://github.com/gtk-rs/gir-files @ 449db48cf86c)
5 changes: 4 additions & 1 deletion gdk-pixbuf/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ use gobject_sys as gobject;
#[allow(unused_imports)]
use libc::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, uintptr_t, FILE,
intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[cfg(unix)]
#[allow(unused_imports)]
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};

#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};
Expand Down
4 changes: 2 additions & 2 deletions 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 @ c537d4a59043)
from gir-files (https://github.com/gtk-rs/gir-files @ 2437ecd9a33d)
Generated by gir (https://github.com/gtk-rs/gir @ eb5be4f1bafe)
from gir-files (https://github.com/gtk-rs/gir-files @ 449db48cf86c)
1 change: 1 addition & 0 deletions gio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ v2_74 = ["v2_72", "ffi/v2_74", "glib/v2_74"]
v2_76 = ["v2_74", "ffi/v2_76", "glib/v2_76"]
v2_78 = ["v2_76", "ffi/v2_78", "glib/v2_78"]
v2_80 = ["v2_78", "ffi/v2_80", "glib/v2_80"]
v2_82 = ["v2_80", "ffi/v2_82", "glib/v2_82"]

[dependencies]
libc.workspace = true
Expand Down
13 changes: 13 additions & 0 deletions gio/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,27 @@ status = "generate"
[[object.function]]
name = "get_unix_pid"
cfg_condition = "unix"
# Use correct libc type
# https://gitlab.gnome.org/GNOME/glib/-/issues/3311
manual = true
[[object.function]]
name = "get_unix_user"
cfg_condition = "unix"
# Use correct libc type
# https://gitlab.gnome.org/GNOME/glib/-/issues/3311
manual = true
[object.function.return]
use_return_for_result = true
[[object.function]]
name = "set_unix_user"
cfg_condition = "unix"
# Use correct libc type
# https://gitlab.gnome.org/GNOME/glib/-/issues/3311
manual = true
[[object.function]]
pattern = "[gs]et_native"
# Unsafe and using raw pointers
manual = true

[[object]]
name = "Gio.CredentialsType"
Expand Down
59 changes: 0 additions & 59 deletions gio/src/auto/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,6 @@ impl Credentials {
unsafe { from_glib_full(ffi::g_credentials_new()) }
}

//#[doc(alias = "g_credentials_get_native")]
//#[doc(alias = "get_native")]
//pub fn native(&self, native_type: CredentialsType) -> /*Unimplemented*/Option<Basic: Pointer> {
// unsafe { TODO: call ffi:g_credentials_get_native() }
//}

#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_credentials_get_unix_pid")]
#[doc(alias = "get_unix_pid")]
pub fn unix_pid(&self) -> Result<i32, glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::g_credentials_get_unix_pid(self.to_glib_none().0, &mut error);
if error.is_null() {
Ok(ret)
} else {
Err(from_glib_full(error))
}
}
}

#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_credentials_get_unix_user")]
#[doc(alias = "get_unix_user")]
pub fn unix_user(&self) -> Result<u32, glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::g_credentials_get_unix_user(self.to_glib_none().0, &mut error);
if error.is_null() {
Ok(ret)
} else {
Err(from_glib_full(error))
}
}
}

#[doc(alias = "g_credentials_is_same_user")]
pub fn is_same_user(&self, other_credentials: &Credentials) -> Result<(), glib::Error> {
unsafe {
Expand All @@ -75,27 +37,6 @@ impl Credentials {
}
}

//#[doc(alias = "g_credentials_set_native")]
//pub fn set_native(&self, native_type: CredentialsType, native: /*Unimplemented*/Basic: Pointer) {
// unsafe { TODO: call ffi:g_credentials_set_native() }
//}

#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_credentials_set_unix_user")]
pub fn set_unix_user(&self, uid: u32) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::g_credentials_set_unix_user(self.to_glib_none().0, uid, &mut error);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}

#[doc(alias = "g_credentials_to_string")]
#[doc(alias = "to_string")]
pub fn to_str(&self) -> glib::GString {
Expand Down
50 changes: 50 additions & 0 deletions gio/src/auto/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,31 @@ pub trait FileExt: IsA<File> + sealed::Sealed + 'static {
}
}

#[cfg(feature = "v2_82")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_82")))]
#[doc(alias = "g_file_copy_async_with_closures")]
fn copy_async_with_closures(
&self,
destination: &impl IsA<File>,
flags: FileCopyFlags,
io_priority: i32,
cancellable: Option<&impl IsA<Cancellable>>,
progress_callback_closure: Option<&glib::Closure>,
ready_callback_closure: &glib::Closure,
) {
unsafe {
ffi::g_file_copy_async_with_closures(
self.as_ref().to_glib_none().0,
destination.as_ref().to_glib_none().0,
flags.into_glib(),
io_priority,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
progress_callback_closure.to_glib_none().0,
ready_callback_closure.to_glib_none().0,
);
}
}

#[doc(alias = "g_file_copy_attributes")]
fn copy_attributes(
&self,
Expand Down Expand Up @@ -1296,6 +1321,31 @@ pub trait FileExt: IsA<File> + sealed::Sealed + 'static {
}
}

#[cfg(feature = "v2_82")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_82")))]
#[doc(alias = "g_file_move_async_with_closures")]
fn move_async_with_closures(
&self,
destination: &impl IsA<File>,
flags: FileCopyFlags,
io_priority: i32,
cancellable: Option<&impl IsA<Cancellable>>,
progress_callback_closure: Option<&glib::Closure>,
ready_callback_closure: &glib::Closure,
) {
unsafe {
ffi::g_file_move_async_with_closures(
self.as_ref().to_glib_none().0,
destination.as_ref().to_glib_none().0,
flags.into_glib(),
io_priority,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
progress_callback_closure.to_glib_none().0,
ready_callback_closure.to_glib_none().0,
);
}
}

#[doc(alias = "g_file_open_readwrite")]
fn open_readwrite(
&self,
Expand Down
28 changes: 28 additions & 0 deletions gio/src/auto/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

#[cfg(feature = "v2_82")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_82")))]
use crate::SettingsBindFlags;
use crate::{Action, SettingsBackend, SettingsSchema};
use glib::{
prelude::*,
Expand Down Expand Up @@ -108,6 +111,31 @@ pub trait SettingsExt: IsA<Settings> + sealed::Sealed + 'static {
}
}

#[cfg(feature = "v2_82")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_82")))]
#[doc(alias = "g_settings_bind_with_mapping_closures")]
fn bind_with_mapping_closures(
&self,
key: &str,
object: &impl IsA<glib::Object>,
property: &str,
flags: SettingsBindFlags,
get_mapping: Option<&glib::Closure>,
set_mapping: Option<&glib::Closure>,
) {
unsafe {
ffi::g_settings_bind_with_mapping_closures(
self.as_ref().to_glib_none().0,
key.to_glib_none().0,
object.as_ref().to_glib_none().0,
property.to_glib_none().0,
flags.into_glib(),
get_mapping.to_glib_none().0,
set_mapping.to_glib_none().0,
);
}
}

#[doc(alias = "g_settings_bind_writable")]
fn bind_writable(
&self,
Expand Down
4 changes: 2 additions & 2 deletions 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 @ c537d4a59043)
from gir-files (https://github.com/gtk-rs/gir-files @ 2437ecd9a33d)
Generated by gir (https://github.com/gtk-rs/gir @ eb5be4f1bafe)
from gir-files (https://github.com/gtk-rs/gir-files @ 449db48cf86c)
68 changes: 68 additions & 0 deletions gio/src/credentials.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::translate::*;

use crate::{Credentials, CredentialsType};

impl Credentials {
#[doc(alias = "g_credentials_get_native")]
#[doc(alias = "get_native")]
pub fn native(&self, native_type: CredentialsType) -> glib::ffi::gpointer {
unsafe { ffi::g_credentials_get_native(self.to_glib_none().0, native_type.into_glib()) }
}

#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_credentials_get_unix_pid")]
#[doc(alias = "get_unix_pid")]
pub fn unix_pid(&self) -> Result<libc::pid_t, glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::g_credentials_get_unix_pid(self.to_glib_none().0, &mut error);
if error.is_null() {
Ok(ret)
} else {
Err(from_glib_full(error))
}
}
}

#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_credentials_get_unix_user")]
#[doc(alias = "get_unix_user")]
pub fn unix_user(&self) -> Result<libc::uid_t, glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::g_credentials_get_unix_user(self.to_glib_none().0, &mut error);
if error.is_null() {
Ok(ret)
} else {
Err(from_glib_full(error))
}
}
}

#[doc(alias = "g_credentials_set_native")]
pub unsafe fn set_native(&self, native_type: CredentialsType, native: glib::ffi::gpointer) {
unsafe {
ffi::g_credentials_set_native(self.to_glib_none().0, native_type.into_glib(), native)
}
}

#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[doc(alias = "g_credentials_set_unix_user")]
pub fn set_unix_user(&self, uid: libc::uid_t) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::g_credentials_set_unix_user(self.to_glib_none().0, uid, &mut error);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
}
1 change: 1 addition & 0 deletions gio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod cancellable;
mod cancellable_future;
pub use crate::cancellable_future::{CancellableFuture, Cancelled};
mod converter;
mod credentials;
mod data_input_stream;
mod datagram_based;
mod dbus;
Expand Down
6 changes: 5 additions & 1 deletion gio/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ v2_74 = ["v2_72"]
v2_76 = ["v2_74"]
v2_78 = ["v2_76"]
v2_80 = ["v2_78"]
v2_82 = ["v2_80"]

[lib]
name = "gio_sys"
Expand Down Expand Up @@ -103,7 +104,10 @@ version = "2.76"
version = "2.77"

[package.metadata.system-deps.gio_2_0.v2_80]
version = "2.79"
version = "2.80"

[package.metadata.system-deps.gio_2_0.v2_82]
version = "2.81"

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
Expand Down
7 changes: 7 additions & 0 deletions gio/sys/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ ignore = [
"Gio.ThreadedResolverClass"
]

[[object]]
name = "Gio.Credentials"
status = "generate"
[[object.function]]
pattern = "[gs]et_unix.*"
cfg_condition = "unix"

[[object]]
name = "Gio.SocketFamily"
status = "manual"
Expand Down
Loading
Loading