diff --git a/Cargo.lock b/Cargo.lock index f2d59808673f..2c31b7a2cdd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,15 +25,14 @@ checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" [[package]] name = "async-tls" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfeefd0ca297cbbb3bd34fd6b228401c2a5177038257afd751bc29f0a2da4795" +checksum = "b2ae3c9eba89d472a0e4fe1dea433df78fbbe63d2b764addaf2ba3a6bde89a5e" dependencies = [ "futures-core", "futures-io", "rustls", "rustls-pemfile", - "webpki", "webpki-roots", ] @@ -78,7 +77,7 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "cairo-rs" -version = "0.19.0" +version = "0.20.0" dependencies = [ "bitflags 2.4.2", "cairo-sys-rs", @@ -92,7 +91,7 @@ dependencies = [ [[package]] name = "cairo-sys-rs" -version = "0.19.0" +version = "0.20.0" dependencies = [ "glib-sys", "libc", @@ -411,7 +410,7 @@ dependencies = [ [[package]] name = "gdk-pixbuf" -version = "0.19.0" +version = "0.20.0" dependencies = [ "gdk-pixbuf-sys", "gio", @@ -422,7 +421,7 @@ dependencies = [ [[package]] name = "gdk-pixbuf-sys" -version = "0.19.0" +version = "0.20.0" dependencies = [ "gio-sys", "glib-sys", @@ -446,7 +445,7 @@ dependencies = [ [[package]] name = "gio" -version = "0.19.0" +version = "0.20.0" dependencies = [ "futures", "futures-channel", @@ -465,7 +464,7 @@ dependencies = [ [[package]] name = "gio-sys" -version = "0.19.0" +version = "0.20.0" dependencies = [ "glib-sys", "gobject-sys", @@ -484,7 +483,7 @@ checksum = "3a5da913a8586ce748f1164c890e1ebe75a7bbc472668f57b7f9fb893d7ac416" [[package]] name = "glib" -version = "0.19.0" +version = "0.20.0" dependencies = [ "bitflags 2.4.2", "criterion", @@ -509,14 +508,14 @@ dependencies = [ [[package]] name = "glib-build-tools" -version = "0.19.0" +version = "0.20.0" dependencies = [ "gio", ] [[package]] name = "glib-macros" -version = "0.19.0" +version = "0.20.0" dependencies = [ "glib", "heck", @@ -529,7 +528,7 @@ dependencies = [ [[package]] name = "glib-sys" -version = "0.19.0" +version = "0.20.0" dependencies = [ "libc", "shell-words", @@ -545,7 +544,7 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "gobject-sys" -version = "0.19.0" +version = "0.20.0" dependencies = [ "glib-sys", "libc", @@ -556,7 +555,7 @@ dependencies = [ [[package]] name = "graphene-rs" -version = "0.19.0" +version = "0.20.0" dependencies = [ "gir-format-check", "glib", @@ -566,7 +565,7 @@ dependencies = [ [[package]] name = "graphene-sys" -version = "0.19.0" +version = "0.20.0" dependencies = [ "glib-sys", "libc", @@ -578,7 +577,7 @@ dependencies = [ [[package]] name = "gtk-rs-examples" -version = "0.19.0" +version = "0.20.0" dependencies = [ "async-tls", "futures", @@ -725,7 +724,7 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "pango" -version = "0.19.0" +version = "0.20.0" dependencies = [ "gio", "gir-format-check", @@ -736,7 +735,7 @@ dependencies = [ [[package]] name = "pango-sys" -version = "0.19.0" +version = "0.20.0" dependencies = [ "glib-sys", "gobject-sys", @@ -748,7 +747,7 @@ dependencies = [ [[package]] name = "pangocairo" -version = "0.19.0" +version = "0.20.0" dependencies = [ "cairo-rs", "gir-format-check", @@ -760,7 +759,7 @@ dependencies = [ [[package]] name = "pangocairo-sys" -version = "0.19.0" +version = "0.20.0" dependencies = [ "cairo-sys-rs", "glib-sys", @@ -925,21 +924,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", -] - [[package]] name = "ring" version = "0.17.7" @@ -949,8 +933,8 @@ dependencies = [ "cc", "getrandom", "libc", - "spin 0.9.8", - "untrusted 0.9.0", + "spin", + "untrusted", "windows-sys 0.48.0", ] @@ -969,14 +953,14 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.9" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring 0.16.20", + "ring", + "rustls-webpki", "sct", - "webpki", ] [[package]] @@ -988,6 +972,16 @@ dependencies = [ "base64", ] +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "ryu" version = "1.0.16" @@ -1015,8 +1009,8 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.7", - "untrusted 0.9.0", + "ring", + "untrusted", ] [[package]] @@ -1105,12 +1099,6 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -1254,12 +1242,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -1358,8 +1340,8 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.7", - "untrusted 0.9.0", + "ring", + "untrusted", ] [[package]] @@ -1536,9 +1518,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.36" +version = "0.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818ce546a11a9986bc24f93d0cdf38a8a1a400f1473ea8c82e59f6e0ffab9249" +checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 83fa4bbb2882..fe45ef82b5ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ exclude = ["gir", "checker"] [workspace.package] homepage = "https://gtk-rs.org/" authors = ["The gtk-rs Project Developers"] -version = "0.19.0" +version = "0.20.0" repository = "https://github.com/gtk-rs/gtk-rs-core" license = "MIT" exclude = [ @@ -41,16 +41,16 @@ libc = "0.2" bitflags = "2.4" thiserror = "1" gir-format-check = "^0.1" -glib-sys = { path = "glib/sys", version = "0.19" } -gobject-sys = { path = "glib/gobject-sys", version = "0.19" } -glib = { path = "glib", version = "0.19" } -gio-sys = { path = "gio/sys", version = "0.19" } -gio = { path = "gio", version = "0.19" } -pango-sys = { path = "pango/sys", version = "0.19" } -pango = { path = "pango", version = "0.19" } -cairo-sys-rs = { path = "cairo/sys", version = "0.19" } -cairo-rs = { path = "cairo", version = "0.19" } -glib-macros = { path = "glib-macros", version = "0.19" } +glib-sys = { path = "glib/sys", version = "0.20" } +gobject-sys = { path = "glib/gobject-sys", version = "0.20" } +glib = { path = "glib", version = "0.20" } +gio-sys = { path = "gio/sys", version = "0.20" } +gio = { path = "gio", version = "0.20" } +pango-sys = { path = "pango/sys", version = "0.20" } +pango = { path = "pango", version = "0.20" } +cairo-sys-rs = { path = "cairo/sys", version = "0.20" } +cairo-rs = { path = "cairo", version = "0.20" } +glib-macros = { path = "glib-macros", version = "0.20" } [workspace.metadata.docs.rs] all-features = true diff --git a/cairo/Cargo.toml b/cairo/Cargo.toml index 1b6f4b5c32b0..1b8d830079be 100644 --- a/cairo/Cargo.toml +++ b/cairo/Cargo.toml @@ -33,10 +33,10 @@ win32-surface = ["ffi/win32-surface"] [dependencies.glib] optional = true -path = "../glib" +workspace = true [dependencies] -ffi = { package = "cairo-sys-rs", path = "sys" } +ffi = { package = "cairo-sys-rs", path = "sys", version = "0.20" } libc.workspace = true bitflags.workspace = true thiserror.workspace = true diff --git a/cairo/src/enums.rs b/cairo/src/enums.rs index 29cfbcd14673..b51731b7ec7d 100644 --- a/cairo/src/enums.rs +++ b/cairo/src/enums.rs @@ -11,7 +11,7 @@ use crate::Error; #[cfg(feature = "use_glib")] macro_rules! gvalue_impl { ($name:ty, $get_type:expr) => { - impl glib::types::StaticType for $name { + impl glib::prelude::StaticType for $name { #[inline] fn static_type() -> glib::Type { unsafe { from_glib($get_type()) } @@ -40,7 +40,7 @@ macro_rules! gvalue_impl { } fn value_type(&self) -> glib::Type { - ::static_type() + ::static_type() } } diff --git a/cairo/src/lib.rs b/cairo/src/lib.rs index 3fd6d6492fb7..9edb39350726 100644 --- a/cairo/src/lib.rs +++ b/cairo/src/lib.rs @@ -20,7 +20,7 @@ macro_rules! gvalue_impl_inner { #[allow(unused_imports)] use glib::translate::*; - impl glib::types::StaticType for $name { + impl glib::prelude::StaticType for $name { #[inline] fn static_type() -> glib::types::Type { unsafe { from_glib($get_type()) } @@ -75,7 +75,7 @@ macro_rules! gvalue_impl { fn to_value(&self) -> glib::Value { unsafe { let mut value = glib::Value::from_type_unchecked( - <$name as glib::StaticType>::static_type(), + <$name as glib::prelude::StaticType>::static_type(), ); glib::gobject_ffi::g_value_take_boxed( value.to_glib_none_mut().0, @@ -86,7 +86,7 @@ macro_rules! gvalue_impl { } fn value_type(&self) -> glib::Type { - <$name as glib::StaticType>::static_type() + <$name as glib::prelude::StaticType>::static_type() } } @@ -94,7 +94,7 @@ macro_rules! gvalue_impl { fn from(v: $name) -> Self { unsafe { let mut value = glib::Value::from_type_unchecked( - <$name as glib::StaticType>::static_type(), + <$name as glib::prelude::StaticType>::static_type(), ); glib::gobject_ffi::g_value_take_boxed( value.to_glib_none_mut().0, @@ -160,7 +160,7 @@ macro_rules! gvalue_impl_inline { glib::ffi::g_malloc0(std::mem::size_of::<$ffi_name>()) as *mut $ffi_name; ptr.write(self.0); let mut value = glib::Value::from_type_unchecked( - <$name as glib::StaticType>::static_type(), + <$name as glib::prelude::StaticType>::static_type(), ); glib::gobject_ffi::g_value_take_boxed( value.to_glib_none_mut().0, @@ -171,7 +171,7 @@ macro_rules! gvalue_impl_inline { } fn value_type(&self) -> glib::Type { - <$name as glib::StaticType>::static_type() + <$name as glib::prelude::StaticType>::static_type() } } diff --git a/cairo/sys/Cargo.toml b/cairo/sys/Cargo.toml index ce894b4bf413..aa7bebcd72ab 100644 --- a/cairo/sys/Cargo.toml +++ b/cairo/sys/Cargo.toml @@ -47,16 +47,15 @@ ps = [] freetype = [] script = [] xcb = [] -use_glib = ["glib"] +use_glib = ["glib-sys"] win32-surface = ["windows-sys"] [dependencies] libc = "0.2" -[dependencies.glib] -package = "glib-sys" +[dependencies.glib-sys] optional = true -path = "../../glib/sys" +workspace = true [dependencies.x11] optional = true diff --git a/cairo/sys/src/gobject.rs b/cairo/sys/src/gobject.rs index 5dbb8ed2940e..c8f9ada6efbf 100644 --- a/cairo/sys/src/gobject.rs +++ b/cairo/sys/src/gobject.rs @@ -1,37 +1,37 @@ // Take a look at the license at the top of the repository in the LICENSE file. extern "C" { - pub fn cairo_gobject_context_get_type() -> glib::GType; - pub fn cairo_gobject_device_get_type() -> glib::GType; - pub fn cairo_gobject_matrix_get_type() -> glib::GType; - pub fn cairo_gobject_pattern_get_type() -> glib::GType; - pub fn cairo_gobject_surface_get_type() -> glib::GType; - pub fn cairo_gobject_rectangle_get_type() -> glib::GType; - pub fn cairo_gobject_scaled_font_get_type() -> glib::GType; - pub fn cairo_gobject_font_face_get_type() -> glib::GType; - pub fn cairo_gobject_font_options_get_type() -> glib::GType; - pub fn cairo_gobject_rectangle_int_get_type() -> glib::GType; - pub fn cairo_gobject_region_get_type() -> glib::GType; - pub fn cairo_gobject_status_get_type() -> glib::GType; - pub fn cairo_gobject_content_get_type() -> glib::GType; - pub fn cairo_gobject_operator_get_type() -> glib::GType; - pub fn cairo_gobject_antialias_get_type() -> glib::GType; - pub fn cairo_gobject_fill_rule_get_type() -> glib::GType; - pub fn cairo_gobject_line_cap_get_type() -> glib::GType; - pub fn cairo_gobject_line_join_get_type() -> glib::GType; - pub fn cairo_gobject_text_cluster_flags_get_type() -> glib::GType; - pub fn cairo_gobject_font_slant_get_type() -> glib::GType; - pub fn cairo_gobject_font_weight_get_type() -> glib::GType; - pub fn cairo_gobject_subpixel_order_get_type() -> glib::GType; - pub fn cairo_gobject_hint_style_get_type() -> glib::GType; - pub fn cairo_gobject_hint_metrics_get_type() -> glib::GType; - pub fn cairo_gobject_font_type_get_type() -> glib::GType; - pub fn cairo_gobject_path_data_type_get_type() -> glib::GType; - pub fn cairo_gobject_device_type_get_type() -> glib::GType; - pub fn cairo_gobject_surface_type_get_type() -> glib::GType; - pub fn cairo_gobject_format_get_type() -> glib::GType; - pub fn cairo_gobject_pattern_type_get_type() -> glib::GType; - pub fn cairo_gobject_extend_get_type() -> glib::GType; - pub fn cairo_gobject_filter_get_type() -> glib::GType; - pub fn cairo_gobject_region_overlap_get_type() -> glib::GType; + pub fn cairo_gobject_context_get_type() -> glib_sys::GType; + pub fn cairo_gobject_device_get_type() -> glib_sys::GType; + pub fn cairo_gobject_matrix_get_type() -> glib_sys::GType; + pub fn cairo_gobject_pattern_get_type() -> glib_sys::GType; + pub fn cairo_gobject_surface_get_type() -> glib_sys::GType; + pub fn cairo_gobject_rectangle_get_type() -> glib_sys::GType; + pub fn cairo_gobject_scaled_font_get_type() -> glib_sys::GType; + pub fn cairo_gobject_font_face_get_type() -> glib_sys::GType; + pub fn cairo_gobject_font_options_get_type() -> glib_sys::GType; + pub fn cairo_gobject_rectangle_int_get_type() -> glib_sys::GType; + pub fn cairo_gobject_region_get_type() -> glib_sys::GType; + pub fn cairo_gobject_status_get_type() -> glib_sys::GType; + pub fn cairo_gobject_content_get_type() -> glib_sys::GType; + pub fn cairo_gobject_operator_get_type() -> glib_sys::GType; + pub fn cairo_gobject_antialias_get_type() -> glib_sys::GType; + pub fn cairo_gobject_fill_rule_get_type() -> glib_sys::GType; + pub fn cairo_gobject_line_cap_get_type() -> glib_sys::GType; + pub fn cairo_gobject_line_join_get_type() -> glib_sys::GType; + pub fn cairo_gobject_text_cluster_flags_get_type() -> glib_sys::GType; + pub fn cairo_gobject_font_slant_get_type() -> glib_sys::GType; + pub fn cairo_gobject_font_weight_get_type() -> glib_sys::GType; + pub fn cairo_gobject_subpixel_order_get_type() -> glib_sys::GType; + pub fn cairo_gobject_hint_style_get_type() -> glib_sys::GType; + pub fn cairo_gobject_hint_metrics_get_type() -> glib_sys::GType; + pub fn cairo_gobject_font_type_get_type() -> glib_sys::GType; + pub fn cairo_gobject_path_data_type_get_type() -> glib_sys::GType; + pub fn cairo_gobject_device_type_get_type() -> glib_sys::GType; + pub fn cairo_gobject_surface_type_get_type() -> glib_sys::GType; + pub fn cairo_gobject_format_get_type() -> glib_sys::GType; + pub fn cairo_gobject_pattern_type_get_type() -> glib_sys::GType; + pub fn cairo_gobject_extend_get_type() -> glib_sys::GType; + pub fn cairo_gobject_filter_get_type() -> glib_sys::GType; + pub fn cairo_gobject_region_overlap_get_type() -> glib_sys::GType; } diff --git a/examples/Cargo.toml b/examples/Cargo.toml index fe87cf32e1f0..26f362ebb251 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -13,7 +13,7 @@ glib.workspace = true gio.workspace = true [dependencies.async-tls] -version = "0.12" +version = "0.13" optional = true [build-dependencies.glib-build-tools] diff --git a/gdk-pixbuf/Cargo.toml b/gdk-pixbuf/Cargo.toml index 88ef38112058..c4a46721187e 100644 --- a/gdk-pixbuf/Cargo.toml +++ b/gdk-pixbuf/Cargo.toml @@ -21,7 +21,7 @@ v2_40 = ["ffi/v2_40"] v2_42 = ["v2_40", "ffi/v2_42"] [dependencies] -ffi = { package = "gdk-pixbuf-sys", path = "sys", version = "0.19" } +ffi = { package = "gdk-pixbuf-sys", path = "sys", version = "0.20" } libc.workspace = true glib.workspace = true gio.workspace = true diff --git a/gdk-pixbuf/src/pixbuf.rs b/gdk-pixbuf/src/pixbuf.rs index ec5d6756256a..e1962ce885b7 100644 --- a/gdk-pixbuf/src/pixbuf.rs +++ b/gdk-pixbuf/src/pixbuf.rs @@ -2,7 +2,7 @@ use std::{future::Future, io::Read, mem, path::Path, pin::Pin, ptr, slice}; -use glib::{object::IsA, translate::*, Error}; +use glib::{prelude::*, translate::*, Error}; use libc::{c_uchar, c_void}; use crate::{Colorspace, Pixbuf, PixbufFormat}; diff --git a/gdk-pixbuf/src/pixbuf_animation.rs b/gdk-pixbuf/src/pixbuf_animation.rs index 51e434e011ab..1a99a8c3c7fe 100644 --- a/gdk-pixbuf/src/pixbuf_animation.rs +++ b/gdk-pixbuf/src/pixbuf_animation.rs @@ -2,7 +2,7 @@ use std::{ptr, time::SystemTime}; -use glib::{object::IsA, translate::*}; +use glib::{prelude::*, translate::*}; use crate::{PixbufAnimation, PixbufAnimationIter}; diff --git a/gdk-pixbuf/src/subclass/pixbuf_loader.rs b/gdk-pixbuf/src/subclass/pixbuf_loader.rs index 797990d36835..dda489bf821b 100644 --- a/gdk-pixbuf/src/subclass/pixbuf_loader.rs +++ b/gdk-pixbuf/src/subclass/pixbuf_loader.rs @@ -3,7 +3,7 @@ // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`PixbufLoader`](crate::PixbufLoader). -use glib::{subclass::prelude::*, translate::*, Cast}; +use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::PixbufLoader; diff --git a/gio/Cargo.toml b/gio/Cargo.toml index 5003aa3077e3..a83235d76cc4 100644 --- a/gio/Cargo.toml +++ b/gio/Cargo.toml @@ -37,7 +37,7 @@ futures-core = { version = "0.3", default-features = false } futures-channel = "0.3" futures-io = "0.3" futures-util = { version = "0.3", default-features = false } -ffi = { package = "gio-sys", path = "sys", version = "0.19" } +ffi = { package = "gio-sys", path = "sys", version = "0.20" } glib.workspace = true thiserror.workspace = true pin-project-lite = "0.2" diff --git a/gio/src/dbus_method_invocation.rs b/gio/src/dbus_method_invocation.rs index 1829c29979a4..d30942745760 100644 --- a/gio/src/dbus_method_invocation.rs +++ b/gio/src/dbus_method_invocation.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{error::ErrorDomain, translate::*}; +use glib::{prelude::*, translate::*}; use crate::DBusMethodInvocation; diff --git a/gio/src/debug_controller_dbus.rs b/gio/src/debug_controller_dbus.rs index 7437500ddd3a..49dc1433b8ae 100644 --- a/gio/src/debug_controller_dbus.rs +++ b/gio/src/debug_controller_dbus.rs @@ -11,7 +11,7 @@ mod sealed { pub trait DebugControllerDBusExtManual: sealed::Sealed + IsA + Sized { fn connection(&self) -> DBusConnection { - glib::ObjectExt::property(self.as_ref(), "connection") + ObjectExt::property(self.as_ref(), "connection") } } diff --git a/gio/src/file_info.rs b/gio/src/file_info.rs index 0019833d4552..066639f0132c 100644 --- a/gio/src/file_info.rs +++ b/gio/src/file_info.rs @@ -5,7 +5,7 @@ use std::{ time::{Duration, SystemTime}, }; -use glib::{translate::*, IntoStrV, StrV}; +use glib::{translate::*, StrV}; use crate::FileInfo; diff --git a/gio/src/settings.rs b/gio/src/settings.rs index cfbdaeba41a9..a49d1ac719ac 100644 --- a/gio/src/settings.rs +++ b/gio/src/settings.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{prelude::*, translate::*, variant::FromVariant, BoolError, IntoStrV, StrV, Variant}; +use glib::{prelude::*, translate::*, BoolError, StrV, Variant}; use crate::{prelude::*, Settings, SettingsBindFlags}; diff --git a/gio/src/simple_proxy_resolver.rs b/gio/src/simple_proxy_resolver.rs index bf01ca4ac55b..828bcbbb5cb1 100644 --- a/gio/src/simple_proxy_resolver.rs +++ b/gio/src/simple_proxy_resolver.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{prelude::*, translate::*, IntoStrV}; +use glib::{prelude::*, translate::*}; use crate::{ProxyResolver, SimpleProxyResolver}; diff --git a/gio/src/socket_msg_flags.rs b/gio/src/socket_msg_flags.rs index abecaa0fc0a1..772f2e1dbb4e 100644 --- a/gio/src/socket_msg_flags.rs +++ b/gio/src/socket_msg_flags.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{bitflags, prelude::*, translate::*, value::FromValue, Type}; +use glib::{bitflags, prelude::*, translate::*, Type}; bitflags::bitflags! { #[doc(alias = "GSocketMsgFlags")] @@ -46,7 +46,7 @@ impl glib::value::ValueType for SocketMsgFlags { type Type = Self; } -unsafe impl<'a> FromValue<'a> for SocketMsgFlags { +unsafe impl<'a> glib::value::FromValue<'a> for SocketMsgFlags { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { diff --git a/gio/src/subclass/application.rs b/gio/src/subclass/application.rs index 0643a352434d..e6005847bda2 100644 --- a/gio/src/subclass/application.rs +++ b/gio/src/subclass/application.rs @@ -2,7 +2,7 @@ use std::{ffi::OsString, fmt, ops::Deref, ptr}; -use glib::{subclass::prelude::*, translate::*, Cast, ExitCode, VariantDict}; +use glib::{prelude::*, subclass::prelude::*, translate::*, ExitCode, VariantDict}; use libc::{c_char, c_int, c_void}; use crate::Application; diff --git a/gio/src/subclass/input_stream.rs b/gio/src/subclass/input_stream.rs index 651f3706dfa9..ab92908b8cb4 100644 --- a/gio/src/subclass/input_stream.rs +++ b/gio/src/subclass/input_stream.rs @@ -2,7 +2,7 @@ use std::ptr; -use glib::{subclass::prelude::*, translate::*, Cast, Error}; +use glib::{prelude::*, subclass::prelude::*, translate::*, Error}; use crate::{Cancellable, InputStream}; diff --git a/gio/src/subclass/io_stream.rs b/gio/src/subclass/io_stream.rs index 4f5b9640a9f9..ee1daaa0c856 100644 --- a/gio/src/subclass/io_stream.rs +++ b/gio/src/subclass/io_stream.rs @@ -2,7 +2,7 @@ use std::{ptr, sync::OnceLock}; -use glib::{prelude::*, subclass::prelude::*, translate::*, Cast, Error}; +use glib::{prelude::*, subclass::prelude::*, translate::*, Error}; use crate::{Cancellable, IOStream, InputStream, OutputStream}; diff --git a/gio/src/subclass/output_stream.rs b/gio/src/subclass/output_stream.rs index eea21732bce9..7b916d94745e 100644 --- a/gio/src/subclass/output_stream.rs +++ b/gio/src/subclass/output_stream.rs @@ -2,7 +2,7 @@ use std::ptr; -use glib::{subclass::prelude::*, translate::*, Cast, Error}; +use glib::{prelude::*, subclass::prelude::*, translate::*, Error}; use crate::{Cancellable, InputStream, OutputStream, OutputStreamSpliceFlags}; diff --git a/gio/src/subclass/seekable.rs b/gio/src/subclass/seekable.rs index aeec736af093..26c43b39a7a1 100644 --- a/gio/src/subclass/seekable.rs +++ b/gio/src/subclass/seekable.rs @@ -2,7 +2,7 @@ use std::ptr; -use glib::{subclass::prelude::*, translate::*, Cast, Error, SeekType}; +use glib::{prelude::*, subclass::prelude::*, translate::*, Error, SeekType}; use crate::{Cancellable, Seekable}; diff --git a/gio/src/subclass/socket_control_message.rs b/gio/src/subclass/socket_control_message.rs index ac1697dd31bd..4b995e097550 100644 --- a/gio/src/subclass/socket_control_message.rs +++ b/gio/src/subclass/socket_control_message.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{subclass::prelude::*, translate::*, Cast}; +use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::SocketControlMessage; diff --git a/gio/src/tls_connection.rs b/gio/src/tls_connection.rs index 1d5a11f6d150..e0a9ac0a35b4 100644 --- a/gio/src/tls_connection.rs +++ b/gio/src/tls_connection.rs @@ -5,7 +5,7 @@ use std::ptr; use glib::prelude::*; #[cfg(feature = "v2_60")] -use glib::{translate::*, IntoStrV}; +use glib::translate::*; #[cfg(feature = "v2_66")] use crate::TlsChannelBindingType; diff --git a/glib-macros/src/boxed_derive.rs b/glib-macros/src/boxed_derive.rs index 9c81d696b61c..8abd4fd08f0b 100644 --- a/glib-macros/src/boxed_derive.rs +++ b/glib-macros/src/boxed_derive.rs @@ -132,7 +132,7 @@ pub fn impl_boxed(input: &syn::DeriveInput) -> syn::Result { const NAME: &'static ::core::primitive::str = #gtype_name; } - impl #crate_ident::StaticType for #name { + impl #crate_ident::prelude::StaticType for #name { #[inline] fn static_type() -> #crate_ident::Type { static TYPE: ::std::sync::OnceLock<#crate_ident::Type> = ::std::sync::OnceLock::new(); @@ -151,7 +151,7 @@ pub fn impl_boxed(input: &syn::DeriveInput) -> syn::Result { fn to_value(&self) -> #crate_ident::Value { unsafe { let ptr: *mut #name = ::std::boxed::Box::into_raw(::std::boxed::Box::new(self.clone())); - let mut value = #crate_ident::Value::from_type_unchecked(<#name as #crate_ident::StaticType>::static_type()); + let mut value = #crate_ident::Value::from_type_unchecked(<#name as #crate_ident::prelude::StaticType>::static_type()); #crate_ident::gobject_ffi::g_value_take_boxed( #crate_ident::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, ptr as *mut _ @@ -162,7 +162,7 @@ pub fn impl_boxed(input: &syn::DeriveInput) -> syn::Result { #[inline] fn value_type(&self) -> #crate_ident::Type { - <#name as #crate_ident::StaticType>::static_type() + <#name as #crate_ident::prelude::StaticType>::static_type() } } @@ -170,7 +170,7 @@ pub fn impl_boxed(input: &syn::DeriveInput) -> syn::Result { #[inline] fn from(v: #name) -> Self { unsafe { - let mut value = #crate_ident::Value::from_type_unchecked(<#name as #crate_ident::StaticType>::static_type()); + let mut value = #crate_ident::Value::from_type_unchecked(<#name as #crate_ident::prelude::StaticType>::static_type()); #crate_ident::gobject_ffi::g_value_take_boxed( #crate_ident::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, #crate_ident::translate::IntoGlibPtr::<*mut #name>::into_glib_ptr(v) as *mut _, @@ -262,7 +262,7 @@ pub fn impl_boxed(input: &syn::DeriveInput) -> syn::Result { } } - impl #crate_ident::HasParamSpec for #name { + impl #crate_ident::prelude::HasParamSpec for #name { type ParamSpec = #crate_ident::ParamSpecBoxed; type SetValue = Self; type BuilderFn = fn(&::core::primitive::str) -> #crate_ident::ParamSpecBoxedBuilder; diff --git a/glib-macros/src/enum_derive.rs b/glib-macros/src/enum_derive.rs index cb82556a1e46..e542e6164160 100644 --- a/glib-macros/src/enum_derive.rs +++ b/glib-macros/src/enum_derive.rs @@ -175,7 +175,7 @@ pub fn impl_enum(input: &syn::DeriveInput) -> syn::Result { } } - impl #crate_ident::value::ToValue for #name { + impl #crate_ident::prelude::ToValue for #name { #[inline] fn to_value(&self) -> #crate_ident::value::Value { let mut value = #crate_ident::value::Value::for_value_type::(); @@ -190,7 +190,7 @@ pub fn impl_enum(input: &syn::DeriveInput) -> syn::Result { #[inline] fn value_type(&self) -> #crate_ident::Type { - ::static_type() + ::static_type() } } @@ -201,7 +201,7 @@ pub fn impl_enum(input: &syn::DeriveInput) -> syn::Result { } } - impl #crate_ident::StaticType for #name { + impl #crate_ident::prelude::StaticType for #name { #[inline] fn static_type() -> #crate_ident::Type { Self::register_enum() diff --git a/glib-macros/src/flags_attribute.rs b/glib-macros/src/flags_attribute.rs index 55daf9533323..9c60aa86c96d 100644 --- a/glib-macros/src/flags_attribute.rs +++ b/glib-macros/src/flags_attribute.rs @@ -221,7 +221,7 @@ pub fn impl_flags(attrs: AttrInput, input: &mut syn::ItemEnum) -> TokenStream { #[inline] fn value_type(&self) -> #crate_ident::Type { - ::static_type() + ::static_type() } } @@ -242,7 +242,7 @@ pub fn impl_flags(attrs: AttrInput, input: &mut syn::ItemEnum) -> TokenStream { } } - impl #crate_ident::StaticType for #name { + impl #crate_ident::prelude::StaticType for #name { #[inline] fn static_type() -> #crate_ident::Type { Self::register_flags() diff --git a/glib-macros/src/properties.rs b/glib-macros/src/properties.rs index a8e2e20ccf54..0a168774b44b 100644 --- a/glib-macros/src/properties.rs +++ b/glib-macros/src/properties.rs @@ -383,7 +383,7 @@ fn expand_param_spec(prop: &PropDesc) -> TokenStream2 { let span = prop.attrs_span; quote_spanned! {span=> - <<#ty as #crate_ident::Property>::Value as #crate_ident::HasParamSpec> + <<#ty as #crate_ident::property::Property>::Value as #crate_ident::prelude::HasParamSpec> ::param_spec_builder() #builder_call #rw_flags #(#builder_fields)* @@ -397,7 +397,7 @@ fn expand_properties_fn(props: &[PropDesc]) -> TokenStream2 { let param_specs = props.iter().map(expand_param_spec); quote!( fn derived_properties() -> &'static [#crate_ident::ParamSpec] { - use #crate_ident::ParamSpecBuilderExt; + use #crate_ident::prelude::ParamSpecBuilderExt; static PROPERTIES: ::std::sync::OnceLock<[#crate_ident::ParamSpec; #n_props]> = ::std::sync::OnceLock::new(); PROPERTIES.get_or_init(|| [ #(#param_specs,)* @@ -424,18 +424,18 @@ fn expand_property_fn(props: &[PropDesc]) -> TokenStream2 { let body = match (member, get) { (_, MaybeCustomFn::Custom(expr)) => quote!( DerivedPropertiesEnum::#enum_ident => { - let value: <#ty as #crate_ident::Property>::Value = (#expr)(&self); + let value: <#ty as #crate_ident::property::Property>::Value = (#expr)(&self); ::std::convert::From::from(value) } ), (None, MaybeCustomFn::Default) => quote!( DerivedPropertiesEnum::#enum_ident => - #crate_ident::PropertyGet::get(&self.#field_ident, |v| ::std::convert::From::from(v)) + #crate_ident::property::PropertyGet::get(&self.#field_ident, |v| ::std::convert::From::from(v)) ), (Some(member), MaybeCustomFn::Default) => quote!( DerivedPropertiesEnum::#enum_ident => - #crate_ident::PropertyGet::get(&self.#field_ident, |v| ::std::convert::From::from(&v.#member)) + #crate_ident::property::PropertyGet::get(&self.#field_ident, |v| ::std::convert::From::from(&v.#member)) ), }; @@ -476,7 +476,7 @@ fn expand_set_property_fn(props: &[PropDesc]) -> TokenStream2 { let expect = quote!(.unwrap_or_else( |err| panic!( "Invalid conversion from `glib::value::Value` to `{}` inside setter for property `{}`: {:?}", - ::std::any::type_name::<<#ty as #crate_ident::Property>::Value>(), #stripped_name, err + ::std::any::type_name::<<#ty as #crate_ident::property::Property>::Value>(), #stripped_name, err ) )); set.as_ref().map(|set| { @@ -488,7 +488,7 @@ fn expand_set_property_fn(props: &[PropDesc]) -> TokenStream2 { ), (None, MaybeCustomFn::Default) => quote!( DerivedPropertiesEnum::#enum_ident => { - #crate_ident::PropertySet::set( + #crate_ident::property::PropertySet::set( &self.#field_ident, #crate_ident::Value::get(value)#expect ); @@ -496,7 +496,7 @@ fn expand_set_property_fn(props: &[PropDesc]) -> TokenStream2 { ), (Some(member), MaybeCustomFn::Default) => quote!( DerivedPropertiesEnum::#enum_ident => { - #crate_ident::PropertySetNested::set_nested( + #crate_ident::property::PropertySetNested::set_nested( &self.#field_ident, move |v| v.#member = #crate_ident::Value::get(value)#expect ); @@ -570,14 +570,14 @@ fn expand_impl_getset_properties(props: &[PropDesc]) -> Vec { let span = p.attrs_span; parse_quote_spanned!(span=> #[must_use] - pub fn #ident(&self) -> <#ty as #crate_ident::Property>::Value { - self.property::<<#ty as #crate_ident::Property>::Value>(#stripped_name) + pub fn #ident(&self) -> <#ty as #crate_ident::property::Property>::Value { + self.property::<<#ty as #crate_ident::property::Property>::Value>(#stripped_name) }) }); let setter = (p.set.is_some() && !p.is_construct_only).then(|| { let ident = format_ident!("set_{}", ident); - let target_ty = quote!(<<#ty as #crate_ident::Property>::Value as #crate_ident::HasParamSpec>::SetValue); + let target_ty = quote!(<<#ty as #crate_ident::property::Property>::Value as #crate_ident::prelude::HasParamSpec>::SetValue); let set_ty = if p.nullable { quote!(::core::option::Option>) } else { @@ -715,10 +715,10 @@ pub fn impl_derive_props(input: PropsMacroInput) -> TokenStream { item }); quote! { - pub trait #trait_ident: #crate_ident::IsA<#wrapper_type> { + pub trait #trait_ident: #crate_ident::prelude::IsA<#wrapper_type> { #(#fns_without_visibility_modifier)* } - impl> #trait_ident for T {} + impl> #trait_ident for T {} } } else { quote! { @@ -732,7 +732,7 @@ pub fn impl_derive_props(input: PropsMacroInput) -> TokenStream { }; let expanded = quote! { - use #crate_ident::{PropertyGet, PropertySet, ToValue}; + use #crate_ident::property::{PropertyGet, PropertySet}; #properties_enum diff --git a/glib-macros/src/shared_boxed_derive.rs b/glib-macros/src/shared_boxed_derive.rs index b598aae2d1e5..de007c0dd382 100644 --- a/glib-macros/src/shared_boxed_derive.rs +++ b/glib-macros/src/shared_boxed_derive.rs @@ -154,7 +154,7 @@ pub fn impl_shared_boxed(input: &syn::DeriveInput) -> syn::Result #crate_ident::Type { static TYPE: ::std::sync::OnceLock<#crate_ident::Type> = ::std::sync::OnceLock::new(); @@ -173,7 +173,7 @@ pub fn impl_shared_boxed(input: &syn::DeriveInput) -> syn::Result #crate_ident::Value { unsafe { let ptr = #refcounted_type_prefix::into_raw(self.0.clone()); - let mut value = #crate_ident::Value::from_type_unchecked(<#name as #crate_ident::StaticType>::static_type()); + let mut value = #crate_ident::Value::from_type_unchecked(<#name as #crate_ident::prelude::StaticType>::static_type()); #crate_ident::gobject_ffi::g_value_take_boxed( #crate_ident::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, ptr as *mut _ @@ -184,7 +184,7 @@ pub fn impl_shared_boxed(input: &syn::DeriveInput) -> syn::Result #crate_ident::Type { - <#name as #crate_ident::StaticType>::static_type() + <#name as #crate_ident::prelude::StaticType>::static_type() } } @@ -192,7 +192,7 @@ pub fn impl_shared_boxed(input: &syn::DeriveInput) -> syn::Result Self { unsafe { - let mut value = #crate_ident::Value::from_type_unchecked(<#name as #crate_ident::StaticType>::static_type()); + let mut value = #crate_ident::Value::from_type_unchecked(<#name as #crate_ident::prelude::StaticType>::static_type()); #crate_ident::gobject_ffi::g_value_take_boxed( #crate_ident::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, #crate_ident::translate::IntoGlibPtr::<*mut #refcounted_type_prefix::InnerType>::into_glib_ptr(v) as *mut _, diff --git a/glib-macros/src/value_delegate_derive.rs b/glib-macros/src/value_delegate_derive.rs index 7b166a5c48df..d1252ed4dc6b 100644 --- a/glib-macros/src/value_delegate_derive.rs +++ b/glib-macros/src/value_delegate_derive.rs @@ -153,9 +153,9 @@ pub fn impl_value_delegate(input: ValueDelegateInput) -> syn::Result glib::types::Type { - <#delegated_ty as #crate_ident::types::StaticType>::static_type() + <#delegated_ty as #crate_ident::prelude::StaticType>::static_type() } } @@ -192,7 +192,7 @@ pub fn impl_value_delegate(input: ValueDelegateInput) -> syn::Result::BuilderFn; fn param_spec_builder() -> Self::BuilderFn { - <#delegated_ty as #crate_ident::HasParamSpec>::param_spec_builder() + <#delegated_ty as #crate_ident::prelude::HasParamSpec>::param_spec_builder() } } }; diff --git a/glib-macros/src/variant_derive.rs b/glib-macros/src/variant_derive.rs index 93efc901ea91..96c9c500f94d 100644 --- a/glib-macros/src/variant_derive.rs +++ b/glib-macros/src/variant_derive.rs @@ -57,7 +57,7 @@ fn derive_variant_for_struct( let idents_len = idents.len(); let static_variant_type = quote! { - impl #impl_generics #glib::StaticVariantType for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::StaticVariantType for #ident #type_generics #where_clause { #[inline] fn static_variant_type() -> ::std::borrow::Cow<'static, #glib::VariantTy> { static TYP: ::std::sync::OnceLock<#glib::VariantType> = ::std::sync::OnceLock::new(); @@ -67,7 +67,7 @@ fn derive_variant_for_struct( #( { - let typ = <#types as #glib::StaticVariantType>::static_variant_type(); + let typ = <#types as #glib::variant::StaticVariantType>::static_variant_type(); builder.append(typ.as_str()); } )* @@ -80,11 +80,11 @@ fn derive_variant_for_struct( }; let to_variant = quote! { - impl #impl_generics #glib::ToVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::ToVariant for #ident #type_generics #where_clause { fn to_variant(&self) -> #glib::Variant { #glib::Variant::tuple_from_iter(::std::array::IntoIter::<#glib::Variant, #idents_len>::new([ #( - #glib::ToVariant::to_variant(&self.#idents) + #glib::variant::ToVariant::to_variant(&self.#idents) ),* ])) } @@ -102,7 +102,7 @@ fn derive_variant_for_struct( }; let from_variant = quote! { - impl #impl_generics #glib::FromVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::FromVariant for #ident #type_generics #where_clause { fn from_variant(variant: &#glib::Variant) -> ::core::option::Option { if !variant.is_container() { return ::core::option::Option::None; @@ -133,7 +133,7 @@ fn derive_variant_for_struct( let counts = (0..types.len()).map(syn::Index::from).collect::>(); let static_variant_type = quote! { - impl #impl_generics #glib::StaticVariantType for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::StaticVariantType for #ident #type_generics #where_clause { #[inline] fn static_variant_type() -> ::std::borrow::Cow<'static, #glib::VariantTy> { static TYP: ::std::sync::OnceLock<#glib::VariantType> = ::std::sync::OnceLock::new(); @@ -143,7 +143,7 @@ fn derive_variant_for_struct( #( { - let typ = <#types as #glib::StaticVariantType>::static_variant_type(); + let typ = <#types as #glib::variant::StaticVariantType>::static_variant_type(); #glib::ffi::g_string_append_len( ptr, typ.as_str().as_ptr() as *const _, @@ -162,11 +162,11 @@ fn derive_variant_for_struct( }; let to_variant = quote! { - impl #impl_generics #glib::ToVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::ToVariant for #ident #type_generics #where_clause { fn to_variant(&self) -> #glib::Variant { #glib::Variant::tuple_from_iter(::std::iter::IntoIterator::into_iter([ #( - #glib::ToVariant::to_variant(&self.#idents) + #glib::variant::ToVariant::to_variant(&self.#idents) ),* ])) } @@ -184,7 +184,7 @@ fn derive_variant_for_struct( }; let from_variant = quote! { - impl #impl_generics #glib::FromVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::FromVariant for #ident #type_generics #where_clause { fn from_variant(variant: &#glib::Variant) -> ::core::option::Option { if !variant.is_container() { return ::core::option::Option::None; @@ -205,7 +205,7 @@ fn derive_variant_for_struct( } Fields::Unit => { let static_variant_type = quote! { - impl #impl_generics #glib::StaticVariantType for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::StaticVariantType for #ident #type_generics #where_clause { #[inline] fn static_variant_type() -> ::std::borrow::Cow<'static, #glib::VariantTy> { ::std::borrow::Cow::Borrowed(#glib::VariantTy::UNIT) @@ -214,23 +214,23 @@ fn derive_variant_for_struct( }; let to_variant = quote! { - impl #impl_generics #glib::ToVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::ToVariant for #ident #type_generics #where_clause { #[inline] fn to_variant(&self) -> #glib::Variant { - #glib::ToVariant::to_variant(&()) + #glib::variant::ToVariant::to_variant(&()) } } impl #impl_generics ::std::convert::From<#ident #type_generics> for #glib::Variant #where_clause { #[inline] fn from(v: #ident #type_generics) -> #glib::Variant { - #glib::ToVariant::to_variant(&()) + #glib::variant::ToVariant::to_variant(&()) } } }; let from_variant = quote! { - impl #impl_generics #glib::FromVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::FromVariant for #ident #type_generics #where_clause { fn from_variant(variant: &#glib::Variant) -> ::core::option::Option { ::core::option::Option::Some(Self) } @@ -323,10 +323,10 @@ fn derive_variant_for_enum( let field_names = named.iter().map(|f| f.ident.as_ref().unwrap()); let field_names2 = field_names.clone(); quote! { - Self::#ident { #(#field_names),* } => #glib::ToVariant::to_variant(&( + Self::#ident { #(#field_names),* } => #glib::variant::ToVariant::to_variant(&( #tag, #glib::Variant::tuple_from_iter(::std::iter::IntoIterator::into_iter([ - #(#glib::ToVariant::to_variant(&#field_names2)),* + #(#glib::variant::ToVariant::to_variant(&#field_names2)),* ])) )) } @@ -337,19 +337,19 @@ fn derive_variant_for_enum( }); let field_names2 = field_names.clone(); quote! { - Self::#ident(#(#field_names),*) => #glib::ToVariant::to_variant(&( + Self::#ident(#(#field_names),*) => #glib::variant::ToVariant::to_variant(&( #tag, #glib::Variant::tuple_from_iter(::std::iter::IntoIterator::into_iter([ - #(#glib::ToVariant::to_variant(&#field_names2)),* + #(#glib::variant::ToVariant::to_variant(&#field_names2)),* ])) )) } }, syn::Fields::Unit => { quote! { - Self::#ident => #glib::ToVariant::to_variant(&( + Self::#ident => #glib::variant::ToVariant::to_variant(&( #tag, - #glib::ToVariant::to_variant(&()) + #glib::variant::ToVariant::to_variant(&()) )) } }, @@ -370,7 +370,7 @@ fn derive_variant_for_enum( let field_names = named.iter().map(|f| f.ident.as_ref().unwrap()); let field_names2 = field_names.clone(); quote! { - #ident::#field_ident { #(#field_names),* } => #glib::ToVariant::to_variant(&( + #ident::#field_ident { #(#field_names),* } => #glib::variant::ToVariant::to_variant(&( #tag, #glib::Variant::tuple_from_iter(::std::iter::IntoIterator::into_iter([ #(<#glib::Variant as ::std::convert::From<_>>::from(#field_names2)),* @@ -385,7 +385,7 @@ fn derive_variant_for_enum( .map(|(i, _)| format_ident!("field{}", i)); let field_names2 = field_names.clone(); quote! { - #ident::#field_ident(#(#field_names),*) => #glib::ToVariant::to_variant(&( + #ident::#field_ident(#(#field_names),*) => #glib::variant::ToVariant::to_variant(&( #tag, #glib::Variant::tuple_from_iter(::std::iter::IntoIterator::into_iter([ #(<#glib::Variant as ::std::convert::From<_>>::from(#field_names2)),* @@ -395,9 +395,9 @@ fn derive_variant_for_enum( } syn::Fields::Unit => { quote! { - #ident::#field_ident => #glib::ToVariant::to_variant(&( + #ident::#field_ident => #glib::variant::ToVariant::to_variant(&( #tag, - #glib::ToVariant::to_variant(&()) + #glib::variant::ToVariant::to_variant(&()) )) } } @@ -419,7 +419,7 @@ fn derive_variant_for_enum( let name = f.ident.as_ref().unwrap(); let repr = &f.ty; quote! { - #name: <#repr as #glib::FromVariant>::from_variant( + #name: <#repr as #glib::variant::FromVariant>::from_variant( &#glib::Variant::try_child_value(&value, #index)? )? } @@ -432,7 +432,7 @@ fn derive_variant_for_enum( quote! { #tag => ::core::option::Option::Some(Self::#ident( #( - <#repr as #glib::FromVariant>::from_variant( + <#repr as #glib::variant::FromVariant>::from_variant( &#glib::Variant::try_child_value(&value, #indices)? )? ),* @@ -452,7 +452,7 @@ fn derive_variant_for_enum( }; Ok(quote! { - impl #impl_generics #glib::StaticVariantType for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::StaticVariantType for #ident #type_generics #where_clause { #[inline] fn static_variant_type() -> ::std::borrow::Cow<'static, #glib::VariantTy> { ::std::borrow::Cow::Borrowed( @@ -463,7 +463,7 @@ fn derive_variant_for_enum( } } - impl #impl_generics #glib::ToVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::ToVariant for #ident #type_generics #where_clause { fn to_variant(&self) -> #glib::Variant { match self { #(#to),* @@ -479,9 +479,9 @@ fn derive_variant_for_enum( } } - impl #impl_generics #glib::FromVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::FromVariant for #ident #type_generics #where_clause { fn from_variant(variant: &#glib::Variant) -> ::core::option::Option { - let (tag, value) = <(#repr, #glib::Variant) as #glib::FromVariant>::from_variant(&variant)?; + let (tag, value) = <(#repr, #glib::Variant) as #glib::variant::FromVariant>::from_variant(&variant)?; if !#glib::VariantTy::is_tuple(#glib::Variant::type_(&value)) { return ::core::option::Option::None; } @@ -515,7 +515,7 @@ fn derive_variant_for_c_enum( let nicks2 = nicks.clone(); ( quote! { - #glib::ToVariant::to_variant(match self { + #glib::variant::ToVariant::to_variant(match self { #(Self::#idents => #nicks),* }) }, @@ -532,10 +532,10 @@ fn derive_variant_for_c_enum( let idents = data_enum.variants.iter().map(|v| &v.ident); ( quote! { - #glib::ToVariant::to_variant(&(*self as #repr)) + #glib::variant::ToVariant::to_variant(&(*self as #repr)) }, quote! { - let value = <#repr as #glib::FromVariant>::from_variant(&variant)?; + let value = <#repr as #glib::variant::FromVariant>::from_variant(&variant)?; #(if value == Self::#idents as #repr { return ::core::option::Option::Some(Self::#idents); })* @@ -545,10 +545,10 @@ fn derive_variant_for_c_enum( } EnumMode::Enum { repr: true } => ( quote! { - #glib::ToVariant::to_variant(&(*self as i32)) + #glib::variant::ToVariant::to_variant(&(*self as i32)) }, quote! { - let value = ::from_variant(&variant)?; + let value = ::from_variant(&variant)?; unsafe { #glib::translate::try_from_glib(value) }.ok() }, ), @@ -559,7 +559,7 @@ fn derive_variant_for_c_enum( let value = #glib::EnumClass::value(&enum_class, value); let value = ::core::option::Option::unwrap(value); let nick = #glib::EnumValue::nick(&value); - #glib::ToVariant::to_variant(nick) + #glib::variant::ToVariant::to_variant(nick) }, quote! { let enum_class = #glib::EnumClass::new::(); @@ -571,10 +571,10 @@ fn derive_variant_for_c_enum( ), EnumMode::Flags { repr: true } => ( quote! { - #glib::ToVariant::to_variant(&self.bits()) + #glib::variant::ToVariant::to_variant(&self.bits()) }, quote! { - let value = ::from_variant(&variant)?; + let value = ::from_variant(&variant)?; Self::from_bits(value) }, ), @@ -583,7 +583,7 @@ fn derive_variant_for_c_enum( let flags_class = #glib::FlagsClass::new::(); let value = ::into_glib(*self); let s = #glib::FlagsClass::to_nick_string(&flags_class, value); - #glib::ToVariant::to_variant(&s) + #glib::variant::ToVariant::to_variant(&s) }, quote! { let flags_class = #glib::FlagsClass::new::(); @@ -595,7 +595,7 @@ fn derive_variant_for_c_enum( }; quote! { - impl #impl_generics #glib::StaticVariantType for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::StaticVariantType for #ident #type_generics #where_clause { #[inline] fn static_variant_type() -> ::std::borrow::Cow<'static, #glib::VariantTy> { ::std::borrow::Cow::Borrowed( @@ -606,7 +606,7 @@ fn derive_variant_for_c_enum( } } - impl #impl_generics #glib::ToVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::ToVariant for #ident #type_generics #where_clause { fn to_variant(&self) -> #glib::Variant { #to_variant } @@ -615,11 +615,11 @@ fn derive_variant_for_c_enum( impl #impl_generics ::std::convert::From<#ident #type_generics> for #glib::Variant #where_clause { #[inline] fn from(v: #ident #type_generics) -> #glib::Variant { - <#ident #type_generics as #glib::ToVariant>::to_variant(&v) + <#ident #type_generics as #glib::variant::ToVariant>::to_variant(&v) } } - impl #impl_generics #glib::FromVariant for #ident #type_generics #where_clause { + impl #impl_generics #glib::variant::FromVariant for #ident #type_generics #where_clause { fn from_variant(variant: &#glib::Variant) -> ::core::option::Option { #from_variant } diff --git a/glib-macros/tests/enum_dynamic.rs b/glib-macros/tests/enum_dynamic.rs index 6db46e2bd248..50b4d3dc3973 100644 --- a/glib-macros/tests/enum_dynamic.rs +++ b/glib-macros/tests/enum_dynamic.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{prelude::*, subclass::prelude::*, Cast}; +use glib::{prelude::*, subclass::prelude::*}; mod module { use super::*; diff --git a/glib-macros/tests/flags_dynamic.rs b/glib-macros/tests/flags_dynamic.rs index 5683992d6ae5..a3ed875a48ff 100644 --- a/glib-macros/tests/flags_dynamic.rs +++ b/glib-macros/tests/flags_dynamic.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{prelude::*, subclass::prelude::*, Cast}; +use glib::{prelude::*, subclass::prelude::*}; mod module { use super::*; diff --git a/glib-macros/tests/object_subclass_dynamic.rs b/glib-macros/tests/object_subclass_dynamic.rs index 8f5283f25474..80890d0d275c 100644 --- a/glib-macros/tests/object_subclass_dynamic.rs +++ b/glib-macros/tests/object_subclass_dynamic.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{subclass::prelude::*, Cast}; +use glib::{prelude::*, subclass::prelude::*}; mod static_ { use super::*; diff --git a/glib-macros/tests/properties.rs b/glib-macros/tests/properties.rs index 528aec45a209..383b24263a9c 100644 --- a/glib-macros/tests/properties.rs +++ b/glib-macros/tests/properties.rs @@ -403,11 +403,9 @@ fn keyword_propnames() { mod kw_names { mod imp { - use glib::subclass::object::DerivedObjectProperties; - use glib::ObjectExt; use std::cell::Cell; - use glib::subclass::{prelude::ObjectImpl, types::ObjectSubclass}; + use glib::{prelude::*, subclass::prelude::*}; use glib_macros::Properties; #[derive(Properties, Default)] diff --git a/glib-macros/tests/value_delegate_derive.rs b/glib-macros/tests/value_delegate_derive.rs index df1dce9dd642..3048b2e8e2cc 100644 --- a/glib-macros/tests/value_delegate_derive.rs +++ b/glib-macros/tests/value_delegate_derive.rs @@ -1,4 +1,4 @@ -use glib::{value::FromValue, StaticType, ToValue, Value, ValueDelegate}; +use glib::{prelude::*, value::FromValue, Value, ValueDelegate}; #[test] fn into_value() { diff --git a/glib/Cargo.toml b/glib/Cargo.toml index 85ee98c401d0..fa5e46df5ed0 100644 --- a/glib/Cargo.toml +++ b/glib/Cargo.toml @@ -24,13 +24,13 @@ futures-task = { version = "0.3", default-features = false } futures-executor = "0.3" futures-channel = "0.3" futures-util = "0.3" -ffi = { package = "glib-sys", path = "sys", version = "0.19"} -gobject_ffi = { package = "gobject-sys", path = "gobject-sys", version = "0.19" } +ffi = { package = "glib-sys", path = "sys", version = "0.20"} +gobject_ffi = { package = "gobject-sys", path = "gobject-sys", version = "0.20" } glib-macros.workspace = true rs-log = { package = "log", version = "0.4", optional = true } smallvec = { version = "1.12", features = ["union", "const_generics", "const_new"] } thiserror.workspace = true -gio_ffi = { package = "gio-sys", path = "../gio/sys", optional = true, version = "0.19" } +gio_ffi = { package = "gio-sys", path = "../gio/sys", optional = true, version = "0.20" } memchr = "2.7.1" [dev-dependencies] diff --git a/glib/src/boxed.rs b/glib/src/boxed.rs index c32da21610f6..ad60f58778f8 100644 --- a/glib/src/boxed.rs +++ b/glib/src/boxed.rs @@ -315,7 +315,7 @@ macro_rules! glib_boxed_wrapper { }; (@value_impl $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)?, $ffi_name:ty, @type_ $get_type_expr:expr) => { - impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::types::StaticType for $name $(<$($generic),+>)? { + impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::StaticType for $name $(<$($generic),+>)? { #[inline] fn static_type() -> $crate::types::Type { #[allow(unused_unsafe)] @@ -361,7 +361,7 @@ macro_rules! glib_boxed_wrapper { #[inline] fn to_value(&self) -> $crate::Value { unsafe { - let mut value = $crate::Value::from_type_unchecked(::static_type()); + let mut value = $crate::Value::from_type_unchecked(::static_type()); $crate::gobject_ffi::g_value_take_boxed( $crate::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, $crate::translate::ToGlibPtr::<*const $ffi_name>::to_glib_full(self) as *mut _, @@ -372,7 +372,7 @@ macro_rules! glib_boxed_wrapper { #[inline] fn value_type(&self) -> $crate::Type { - ::static_type() + ::static_type() } } @@ -380,7 +380,7 @@ macro_rules! glib_boxed_wrapper { #[inline] fn from(o: $name $(<$($generic),+>)?) -> Self { unsafe { - let mut value = $crate::Value::from_type_unchecked(<$name $(<$($generic),+>)? as $crate::StaticType>::static_type()); + let mut value = $crate::Value::from_type_unchecked(<$name $(<$($generic),+>)? as $crate::prelude::StaticType>::static_type()); $crate::gobject_ffi::g_value_take_boxed( $crate::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, $crate::translate::IntoGlibPtr::<*mut $ffi_name>::into_glib_ptr(o) as *mut _, @@ -407,7 +407,7 @@ macro_rules! glib_boxed_wrapper { } - impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::HasParamSpec for $name $(<$($generic),+>)? { + impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::HasParamSpec for $name $(<$($generic),+>)? { type ParamSpec = $crate::ParamSpecBoxed; type SetValue = Self; type BuilderFn = fn(&str) -> $crate::ParamSpecBoxedBuilder; diff --git a/glib/src/boxed_inline.rs b/glib/src/boxed_inline.rs index 6cae416691df..4534ddd7d702 100644 --- a/glib/src/boxed_inline.rs +++ b/glib/src/boxed_inline.rs @@ -546,7 +546,7 @@ macro_rules! glib_boxed_inline_wrapper { (@value_impl $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)?, $ffi_name:ty) => { }; (@value_impl $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)?, $ffi_name:ty, @type_ $get_type_expr:expr) => { - impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::types::StaticType for $name $(<$($generic),+>)? { + impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::StaticType for $name $(<$($generic),+>)? { #[inline] fn static_type() -> $crate::types::Type { #[allow(unused_unsafe)] @@ -591,7 +591,7 @@ macro_rules! glib_boxed_inline_wrapper { #[inline] fn to_value(&self) -> $crate::Value { unsafe { - let mut value = $crate::Value::from_type_unchecked(::static_type()); + let mut value = $crate::Value::from_type_unchecked(::static_type()); $crate::gobject_ffi::g_value_set_boxed( $crate::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, $crate::translate::ToGlibPtr::<*const $ffi_name>::to_glib_none(self).0 as *mut _, @@ -602,7 +602,7 @@ macro_rules! glib_boxed_inline_wrapper { #[inline] fn value_type(&self) -> $crate::Type { - ::static_type() + ::static_type() } } @@ -630,7 +630,7 @@ macro_rules! glib_boxed_inline_wrapper { } } - impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::HasParamSpec for $name $(<$($generic),+>)? { + impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::HasParamSpec for $name $(<$($generic),+>)? { type ParamSpec = $crate::ParamSpecBoxed; type SetValue = Self; type BuilderFn = fn(&str) -> $crate::ParamSpecBoxedBuilder; diff --git a/glib/src/clone.rs b/glib/src/clone.rs index 598ca8bb4c97..19ad531d0e27 100644 --- a/glib/src/clone.rs +++ b/glib/src/clone.rs @@ -1,5 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use crate::prelude::*; use std::{ marker::PhantomData, rc::{self, Rc}, @@ -36,7 +37,7 @@ where fn upgrade(&self) -> Option; } -impl Upgrade for crate::WeakRef { +impl Upgrade for crate::WeakRef { type Strong = T; fn upgrade(&self) -> Option { diff --git a/glib/src/closure.rs b/glib/src/closure.rs index 789cbd0ae3d6..2fc39933e55c 100644 --- a/glib/src/closure.rs +++ b/glib/src/closure.rs @@ -6,7 +6,7 @@ use std::{mem, ptr, slice}; use libc::{c_uint, c_void}; -use crate::{prelude::*, translate::*, value::FromValue, Type, Value}; +use crate::{prelude::*, translate::*, Type, Value}; wrapper! { #[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] @@ -370,7 +370,9 @@ impl TryFromClosureReturnValue for () { } } -impl FromValue<'a> + StaticType + 'static> TryFromClosureReturnValue for T { +impl crate::value::FromValue<'a> + StaticType + 'static> TryFromClosureReturnValue + for T +{ #[inline] fn try_from_closure_return_value(v: Option) -> Result { v.ok_or_else(|| { diff --git a/glib/src/collections/strv.rs b/glib/src/collections/strv.rs index 85b288e23b0e..89dbc214383f 100644 --- a/glib/src/collections/strv.rs +++ b/glib/src/collections/strv.rs @@ -2,7 +2,7 @@ use std::{ffi::c_char, fmt, marker::PhantomData, mem, ptr}; -use crate::{translate::*, GStr, GString, GStringPtr, IntoGStr, IntoOptionalGStr}; +use crate::{prelude::*, translate::*, GStr, GString, GStringPtr}; // rustdoc-stripper-ignore-next /// Minimum size of the `StrV` allocation. @@ -996,14 +996,14 @@ impl IntoGlibPtr<*mut *mut c_char> for StrV { } } -impl crate::StaticType for StrV { +impl StaticType for StrV { #[inline] fn static_type() -> crate::Type { >::static_type() } } -impl<'a> crate::StaticType for &'a [GStringPtr] { +impl<'a> StaticType for &'a [GStringPtr] { #[inline] fn static_type() -> crate::Type { >::static_type() @@ -1045,7 +1045,7 @@ impl crate::value::ToValue for StrV { } fn value_type(&self) -> crate::Type { - ::static_type() + ::static_type() } } diff --git a/glib/src/control_flow.rs b/glib/src/control_flow.rs index 6888d6219bd4..4d22523e21d0 100644 --- a/glib/src/control_flow.rs +++ b/glib/src/control_flow.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::translate::*; +use crate::{prelude::*, translate::*}; // rustdoc-stripper-ignore-next /// Continue calling the closure in the future iterations or drop it. @@ -85,13 +85,13 @@ impl FromGlib for ControlFlow { } } -impl crate::ToValue for ControlFlow { +impl crate::value::ToValue for ControlFlow { fn to_value(&self) -> crate::Value { bool::from(*self).to_value() } fn value_type(&self) -> crate::Type { - ::static_type() + ::static_type() } } diff --git a/glib/src/convert.rs b/glib/src/convert.rs index 94e769d4cf38..3b45d10e714a 100644 --- a/glib/src/convert.rs +++ b/glib/src/convert.rs @@ -2,9 +2,7 @@ use std::{io, os::raw::c_char, path::PathBuf, ptr}; -use crate::{ - translate::*, ConvertError, Error, GString, IntoGStr, IntoOptionalGStr, NormalizeMode, Slice, -}; +use crate::{translate::*, ConvertError, Error, GString, NormalizeMode, Slice}; // rustdoc-stripper-ignore-next /// A wrapper for [`ConvertError`](crate::ConvertError) that can hold an offset into the input diff --git a/glib/src/enums.rs b/glib/src/enums.rs index c2c0c8c515f0..82ef2f40f6c0 100644 --- a/glib/src/enums.rs +++ b/glib/src/enums.rs @@ -2,11 +2,7 @@ use std::{cmp, ffi::CStr, fmt, ops::Deref, ptr}; -use crate::{ - translate::*, - value::{FromValue, ValueTypeChecker}, - HasParamSpec, ParamSpecEnum, ParamSpecFlags, StaticType, Type, TypeInfo, Value, -}; +use crate::{prelude::*, translate::*, ParamSpecEnum, ParamSpecFlags, Type, TypeInfo, Value}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] pub enum UserDirectory { @@ -339,7 +335,7 @@ impl UnsafeFrom for EnumValue { } } -unsafe impl<'a, 'b> FromValue<'a> for &'b EnumValue { +unsafe impl<'a, 'b> crate::value::FromValue<'a> for &'b EnumValue { type Checker = EnumTypeChecker; unsafe fn from_value(value: &'a Value) -> Self { @@ -371,7 +367,7 @@ pub type EnumValuesStorage = EnumerationValuesStorage; pub struct EnumTypeChecker(); -unsafe impl ValueTypeChecker for EnumTypeChecker { +unsafe impl crate::value::ValueTypeChecker for EnumTypeChecker { type Error = InvalidEnumError; fn check(value: &Value) -> Result<(), Self::Error> { @@ -1044,7 +1040,7 @@ impl<'a> FlagsBuilder<'a> { } } -unsafe impl<'a, 'b> FromValue<'a> for Vec<&'b FlagsValue> { +unsafe impl<'a, 'b> crate::value::FromValue<'a> for Vec<&'b FlagsValue> { type Checker = FlagsTypeChecker; unsafe fn from_value(value: &'a Value) -> Self { @@ -1055,7 +1051,7 @@ unsafe impl<'a, 'b> FromValue<'a> for Vec<&'b FlagsValue> { } pub struct FlagsTypeChecker(); -unsafe impl ValueTypeChecker for FlagsTypeChecker { +unsafe impl crate::value::ValueTypeChecker for FlagsTypeChecker { type Error = InvalidFlagsError; fn check(value: &Value) -> Result<(), Self::Error> { diff --git a/glib/src/gobject/dynamic_object.rs b/glib/src/gobject/dynamic_object.rs index 3945a293ed75..f6e7648046fb 100644 --- a/glib/src/gobject/dynamic_object.rs +++ b/glib/src/gobject/dynamic_object.rs @@ -4,7 +4,7 @@ use crate::{ enums::{EnumValues, FlagsValues}, prelude::*, subclass::prelude::*, - InterfaceInfo, IsA, TypeFlags, TypeInfo, TypeModule, TypePlugin, + InterfaceInfo, TypeFlags, TypeInfo, TypeModule, TypePlugin, }; mod sealed { diff --git a/glib/src/gobject/signal_group.rs b/glib/src/gobject/signal_group.rs index 45e95fbba92c..61d599162e18 100644 --- a/glib/src/gobject/signal_group.rs +++ b/glib/src/gobject/signal_group.rs @@ -3,9 +3,10 @@ use std::mem::transmute; use crate::{ + prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, - IsA, Object, ObjectType, RustClosure, SignalGroup, Value, + Object, RustClosure, SignalGroup, Value, }; impl SignalGroup { @@ -177,7 +178,7 @@ mod tests { use super::*; use crate as glib; - use crate::{ObjectExt, StaticType}; + use crate::prelude::*; mod imp { use super::*; diff --git a/glib/src/gstring.rs b/glib/src/gstring.rs index 1d1bc95b5c9e..8f71ee5c850b 100644 --- a/glib/src/gstring.rs +++ b/glib/src/gstring.rs @@ -13,7 +13,7 @@ use std::{ ptr, slice, }; -use crate::{prelude::*, translate::*, value::FromValue, Type, Value}; +use crate::{prelude::*, translate::*, Type, Value}; // rustdoc-stripper-ignore-next /// Representation of a borrowed [`GString`]. @@ -592,7 +592,7 @@ impl FromGlibPtrNone<*mut i8> for &GStr { } } -unsafe impl<'a> FromValue<'a> for &'a GStr { +unsafe impl<'a> crate::value::FromValue<'a> for &'a GStr { type Checker = crate::value::GenericValueTypeOrNoneChecker; #[inline] @@ -2249,7 +2249,7 @@ impl crate::value::ValueType for Vec { type Type = Vec; } -unsafe impl<'a> FromValue<'a> for Vec { +unsafe impl<'a> crate::value::FromValue<'a> for Vec { type Checker = crate::value::GenericValueTypeChecker; #[inline] diff --git a/glib/src/lib.rs b/glib/src/lib.rs index c5f2b7d33e5f..e49242cf51db 100644 --- a/glib/src/lib.rs +++ b/glib/src/lib.rs @@ -21,20 +21,14 @@ pub use self::{ closure::{Closure, RustClosure}, enums::{EnumClass, EnumValue, FlagsBuilder, FlagsClass, FlagsValue, UserDirectory}, error::{BoolError, Error}, - object::{ - BorrowedObject, Cast, CastNone, Class, InitiallyUnowned, Interface, IsA, Object, - ObjectClassExt, ObjectExt, ObjectType, SendWeakRef, WeakRef, - }, + object::{BorrowedObject, Class, InitiallyUnowned, Interface, Object, SendWeakRef, WeakRef}, signal::{ signal_handler_block, signal_handler_disconnect, signal_handler_unblock, signal_stop_emission_by_name, Propagation, SignalHandlerId, }, - types::{ILong, Pointer, StaticType, StaticTypeExt, Type, ULong}, - value::{BoxedValue, SendValue, ToSendValue, ToValue, Value}, - variant::{ - FixedSizeVariantArray, FixedSizeVariantType, FromVariant, StaticVariantType, ToVariant, - Variant, - }, + types::{ILong, Pointer, Type, ULong}, + value::{BoxedValue, SendValue, Value}, + variant::{FixedSizeVariantArray, Variant}, variant_dict::VariantDict, variant_iter::{VariantIter, VariantStrIter}, variant_type::{VariantTy, VariantTyIterator, VariantType}, @@ -104,9 +98,7 @@ mod exit_code; pub use exit_code::ExitCode; pub mod collections; -pub use collections::{ - ptr_slice::IntoPtrSlice, strv::IntoStrV, List, PtrSlice, SList, Slice, StrV, -}; +pub use collections::{List, PtrSlice, SList, Slice, StrV}; pub use self::auto::*; #[allow(clippy::too_many_arguments)] @@ -133,7 +125,7 @@ mod bytes; mod control_flow; pub use self::control_flow::ControlFlow; pub mod char; -pub use self::char::*; +pub use self::char::{Char, UChar}; mod checksum; pub mod closure; mod convert; @@ -165,7 +157,7 @@ mod date; mod date_time; mod time_span; mod time_zone; -pub use self::time_span::*; +pub use self::time_span::TimeSpan; pub mod value; pub mod variant; mod variant_dict; @@ -176,8 +168,7 @@ mod value_array; pub use self::value_array::ValueArray; mod param_spec; pub use self::param_spec::*; -mod property; -pub use self::property::*; +pub mod property; mod quark; pub use self::quark::Quark; pub mod match_info; diff --git a/glib/src/main_context.rs b/glib/src/main_context.rs index 35000992b3dc..50c6f439d8bc 100644 --- a/glib/src/main_context.rs +++ b/glib/src/main_context.rs @@ -2,7 +2,7 @@ use std::mem; -use ffi::{self, gboolean, gpointer}; +use ffi::{gboolean, gpointer}; use crate::{source::Priority, translate::*, MainContext, Source, SourceId}; diff --git a/glib/src/match_info.rs b/glib/src/match_info.rs index 601bf2132951..ade62d928a12 100644 --- a/glib/src/match_info.rs +++ b/glib/src/match_info.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::{translate::*, GStr, IntoGStr, Regex}; +use crate::{prelude::*, translate::*, GStr, Regex}; use std::{marker::PhantomData, mem, ptr}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -160,7 +160,7 @@ impl<'input> IntoGlibPtr<*const ffi::GMatchInfo> for MatchInfo<'input> { ToGlibPtr::<*const ffi::GMatchInfo>::to_glib_none(&*s).0 as *const _ } } -impl<'input> crate::types::StaticType for MatchInfo<'input> { +impl<'input> StaticType for MatchInfo<'input> { #[inline] fn static_type() -> crate::types::Type { unsafe { from_glib(ffi::g_match_info_get_type()) } @@ -168,7 +168,7 @@ impl<'input> crate::types::StaticType for MatchInfo<'input> { } #[doc(hidden)] -impl crate::value::ValueType for MatchInfo<'static> { +impl ValueType for MatchInfo<'static> { type Type = Self; } @@ -206,12 +206,11 @@ unsafe impl<'a, 'input: 'a> crate::value::FromValue<'a> for &'a MatchInfo<'input ) } } -impl crate::value::ToValue for MatchInfo<'static> { +impl ToValue for MatchInfo<'static> { #[inline] fn to_value(&self) -> crate::Value { unsafe { - let mut value = - crate::Value::from_type_unchecked(::static_type()); + let mut value = crate::Value::from_type_unchecked(::static_type()); crate::gobject_ffi::g_value_take_boxed( crate::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, crate::translate::ToGlibPtr::<*mut ffi::GMatchInfo>::to_glib_full(self) as *mut _, @@ -222,7 +221,7 @@ impl crate::value::ToValue for MatchInfo<'static> { #[inline] fn value_type(&self) -> crate::Type { - ::static_type() + ::static_type() } } @@ -231,7 +230,7 @@ impl From> for crate::Value { fn from(s: MatchInfo<'static>) -> Self { unsafe { let mut value = crate::Value::from_type_unchecked( - as crate::StaticType>::static_type(), + as StaticType>::static_type(), ); crate::gobject_ffi::g_value_take_boxed( crate::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, @@ -258,7 +257,7 @@ impl crate::value::ToValueOptional for MatchInfo<'static> { } } -impl crate::HasParamSpec for MatchInfo<'static> { +impl HasParamSpec for MatchInfo<'static> { type ParamSpec = crate::ParamSpecBoxed; type SetValue = Self; type BuilderFn = fn(&str) -> crate::ParamSpecBoxedBuilder; diff --git a/glib/src/object.rs b/glib/src/object.rs index c10fefe2bd8b..566ccdcb15f7 100644 --- a/glib/src/object.rs +++ b/glib/src/object.rs @@ -9,11 +9,11 @@ use crate::{ closure::TryFromClosureReturnValue, prelude::*, quark::Quark, - subclass::{prelude::*, signal::SignalQuery, SignalId}, + subclass::{prelude::*, SignalId, SignalQuery}, thread_guard::thread_id, translate::*, value::FromValue, - Closure, IntoGStr, PtrSlice, RustClosure, SignalHandlerId, Type, Value, + Closure, PtrSlice, RustClosure, SignalHandlerId, Type, Value, }; // rustdoc-stripper-ignore-next @@ -30,7 +30,7 @@ pub unsafe trait ObjectType: + Ord + hash::Hash + crate::value::ValueType - + crate::value::ToValue + + ToValue + crate::value::ToValueOptional + crate::value::FromValueOptional<'static> + for<'a> ToGlibPtr<'a, *mut ::GlibType> @@ -746,7 +746,7 @@ macro_rules! glib_object_wrapper { } #[doc(hidden)] - unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::object::IsA for $name $(<$($generic),+>)? { } + unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::IsA for $name $(<$($generic),+>)? { } #[doc(hidden)] impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::subclass::types::FromObject for $name $(<$($generic),+>)? { @@ -1026,7 +1026,7 @@ macro_rules! glib_object_wrapper { } } - impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::types::StaticType for $name $(<$($generic),+>)? { + impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::StaticType for $name $(<$($generic),+>)? { #[inline] fn static_type() -> $crate::types::Type { #[allow(unused_unsafe)] @@ -1074,7 +1074,7 @@ macro_rules! glib_object_wrapper { #[inline] fn to_value(&self) -> $crate::Value { unsafe { - let mut value = $crate::Value::from_type_unchecked(::static_type()); + let mut value = $crate::Value::from_type_unchecked(::static_type()); $crate::gobject_ffi::g_value_take_object( $crate::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, $crate::translate::ToGlibPtr::<*mut $ffi_name>::to_glib_full(self) as *mut _, @@ -1085,7 +1085,7 @@ macro_rules! glib_object_wrapper { #[inline] fn value_type(&self) -> $crate::Type { - ::static_type() + ::static_type() } } @@ -1094,7 +1094,7 @@ macro_rules! glib_object_wrapper { #[inline] fn from(o: $name $(<$($generic),+>)?) -> Self { unsafe { - let mut value = $crate::Value::from_type_unchecked(<$name $(<$($generic),+>)? as $crate::StaticType>::static_type()); + let mut value = $crate::Value::from_type_unchecked(<$name $(<$($generic),+>)? as $crate::prelude::StaticType>::static_type()); $crate::gobject_ffi::g_value_take_object( $crate::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, $crate::translate::IntoGlibPtr::<*mut $ffi_name>::into_glib_ptr(o) as *mut _, @@ -1122,7 +1122,7 @@ macro_rules! glib_object_wrapper { $crate::glib_object_wrapper!(@weak_impl $name $(<$($generic $(: $bound $(+ $bound2)*)?),+>)?); - impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::HasParamSpec for $name $(<$($generic),+>)? { + impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::HasParamSpec for $name $(<$($generic),+>)? { type ParamSpec = $crate::ParamSpecObject; type SetValue = Self; type BuilderFn = fn(&str) -> $crate::ParamSpecObjectBuilder; @@ -1148,13 +1148,13 @@ macro_rules! glib_object_wrapper { (@munch_impls $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)?, ) => { }; (@munch_impls $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)?, $super_name:path) => { - unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::object::IsA<$super_name> for $name $(<$($generic),+>)? { } + unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::IsA<$super_name> for $name $(<$($generic),+>)? { } #[doc(hidden)] impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? From<$name $(<$($generic),+>)?> for $super_name { #[inline] fn from(v: $name $(<$($generic),+>)?) -> Self { - <$name $(::<$($generic),+>)? as $crate::Cast>::upcast(v) + <$name $(::<$($generic),+>)? as $crate::prelude::Cast>::upcast(v) } } @@ -1255,12 +1255,12 @@ macro_rules! glib_object_wrapper { impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? From<$name $(<$($generic),+>)?> for $crate::object::Object { #[inline] fn from(v: $name $(<$($generic),+>)?) -> Self { - <$name $(::<$($generic),+>)? as $crate::Cast>::upcast(v) + <$name $(::<$($generic),+>)? as $crate::prelude::Cast>::upcast(v) } } #[doc(hidden)] - unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::object::IsA<$crate::object::Object> for $name $(<$($generic),+>)? { } + unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::IsA<$crate::object::Object> for $name $(<$($generic),+>)? { } #[doc(hidden)] unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::object::IsClass for $name $(<$($generic),+>)? { } @@ -1336,12 +1336,12 @@ macro_rules! glib_object_wrapper { impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? From<$name $(<$($generic),+>)?> for $crate::object::Object { #[inline] fn from(v: $name $(<$($generic),+>)?) -> Self { - <$name $(::<$($generic),+>)? as $crate::Cast>::upcast(v) + <$name $(::<$($generic),+>)? as $crate::prelude::Cast>::upcast(v) } } #[doc(hidden)] - unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::object::IsA<$crate::object::Object> for $name $(<$($generic),+>)? { } + unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::IsA<$crate::object::Object> for $name $(<$($generic),+>)? { } #[doc(hidden)] unsafe impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::object::IsInterface for $name $(<$($generic),+>)? { } diff --git a/glib/src/prelude.rs b/glib/src/prelude.rs index c719431361a0..cb565ecfbf5c 100644 --- a/glib/src/prelude.rs +++ b/glib/src/prelude.rs @@ -4,8 +4,11 @@ //! Traits and essential types intended for blanket imports. pub use crate::{ + error::ErrorDomain, gobject::traits::{DynamicObjectRegisterExt, TypeModuleExt, TypePluginExt}, - param_spec::ParamSpecBuilderExt, - Cast, CastNone, IsA, ObjectClassExt, ObjectExt, ObjectType, ParamSpecType, StaticType, - StaticTypeExt, StaticVariantType, ToSendValue, ToValue, ToVariant, + object::{Cast, CastNone, IsA, ObjectClassExt, ObjectExt, ObjectType}, + param_spec::{HasParamSpec, ParamSpecBuilderExt, ParamSpecType}, + types::{StaticType, StaticTypeExt}, + value::{ToSendValue, ToValue, ValueType}, + variant::{FixedSizeVariantType, FromVariant, StaticVariantType, ToVariant}, }; diff --git a/glib/src/property.rs b/glib/src/property.rs index 679dd6ffcd55..9e91eec44a88 100644 --- a/glib/src/property.rs +++ b/glib/src/property.rs @@ -9,8 +9,7 @@ use std::sync::Arc; use std::sync::Mutex; use std::sync::RwLock; -use crate::HasParamSpec; -use crate::IsA; +use crate::prelude::*; use crate::Object; use crate::SendWeakRef; use crate::WeakRef; diff --git a/glib/src/quark.rs b/glib/src/quark.rs index 37dbae983730..183b824a718d 100644 --- a/glib/src/quark.rs +++ b/glib/src/quark.rs @@ -2,7 +2,7 @@ use std::{fmt, num::NonZeroU32}; -use crate::{translate::*, GStr, IntoGStr}; +use crate::{translate::*, GStr}; #[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[repr(transparent)] diff --git a/glib/src/shared.rs b/glib/src/shared.rs index 3e600a384664..e9473cc17125 100644 --- a/glib/src/shared.rs +++ b/glib/src/shared.rs @@ -335,7 +335,7 @@ macro_rules! glib_shared_wrapper { (@value_impl $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)?, $ffi_name:ty) => { }; (@value_impl $name:ident $(<$($generic:ident $(: $bound:tt $(+ $bound2:tt)*)?),+>)?, $ffi_name:ty, @type_ $get_type_expr:expr) => { - impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::types::StaticType for $name $(<$($generic),+>)? { + impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::StaticType for $name $(<$($generic),+>)? { #[inline] fn static_type() -> $crate::types::Type { #[allow(unused_unsafe)] @@ -381,7 +381,7 @@ macro_rules! glib_shared_wrapper { #[inline] fn to_value(&self) -> $crate::Value { unsafe { - let mut value = $crate::Value::from_type_unchecked(::static_type()); + let mut value = $crate::Value::from_type_unchecked(::static_type()); $crate::gobject_ffi::g_value_take_boxed( $crate::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, $crate::translate::ToGlibPtr::<*mut $ffi_name>::to_glib_full(self) as *mut _, @@ -392,7 +392,7 @@ macro_rules! glib_shared_wrapper { #[inline] fn value_type(&self) -> $crate::Type { - ::static_type() + ::static_type() } } @@ -400,7 +400,7 @@ macro_rules! glib_shared_wrapper { #[inline] fn from(s: $name $(<$($generic),+>)?) -> Self { unsafe { - let mut value = $crate::Value::from_type_unchecked(<$name $(<$($generic),+>)? as $crate::StaticType>::static_type()); + let mut value = $crate::Value::from_type_unchecked(<$name $(<$($generic),+>)? as $crate::prelude::StaticType>::static_type()); $crate::gobject_ffi::g_value_take_boxed( $crate::translate::ToGlibPtrMut::to_glib_none_mut(&mut value).0, $crate::translate::IntoGlibPtr::<*mut $ffi_name>::into_glib_ptr(s) as *mut _, @@ -426,7 +426,7 @@ macro_rules! glib_shared_wrapper { } } - impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::HasParamSpec for $name $(<$($generic),+>)? { + impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::prelude::HasParamSpec for $name $(<$($generic),+>)? { type ParamSpec = $crate::ParamSpecBoxed; type SetValue = Self; type BuilderFn = fn(&str) -> $crate::ParamSpecBoxedBuilder; diff --git a/glib/src/signal.rs b/glib/src/signal.rs index 75d986e09d93..54a8d2da2d2d 100644 --- a/glib/src/signal.rs +++ b/glib/src/signal.rs @@ -208,13 +208,13 @@ impl FromGlib for Propagation { } } -impl crate::ToValue for Propagation { +impl crate::value::ToValue for Propagation { fn to_value(&self) -> crate::Value { bool::from(*self).to_value() } fn value_type(&self) -> crate::Type { - ::static_type() + ::static_type() } } diff --git a/glib/src/subclass/interface.rs b/glib/src/subclass/interface.rs index b1c4e14f34ca..5fdafe934c6d 100644 --- a/glib/src/subclass/interface.rs +++ b/glib/src/subclass/interface.rs @@ -19,7 +19,7 @@ impl PrerequisiteList for () { } } -impl PrerequisiteList for (T,) { +impl PrerequisiteList for (T,) { fn types() -> Vec { vec![T::static_type()] } @@ -46,7 +46,7 @@ macro_rules! prerequisite_list_trait( // and then implements the trait on (A, B, C). macro_rules! prerequisite_list_trait_impl( ($($name:ident),+) => ( - impl<$($name: crate::ObjectType),+> PrerequisiteList for ( $($name),+ ) { + impl<$($name: ObjectType),+> PrerequisiteList for ( $($name),+ ) { fn types() -> Vec { vec![$($name::static_type()),+] } diff --git a/glib/src/subclass/object.rs b/glib/src/subclass/object.rs index 3f8d74ec3ca9..e840e13d8e36 100644 --- a/glib/src/subclass/object.rs +++ b/glib/src/subclass/object.rs @@ -7,7 +7,7 @@ use std::{mem, ptr}; use super::{prelude::*, Signal}; -use crate::{prelude::*, translate::*, Cast, Object, ParamSpec, Slice, Value}; +use crate::{prelude::*, translate::*, Object, ParamSpec, Slice, Value}; // rustdoc-stripper-ignore-next /// Trait for implementors of `glib::Object` subclasses. diff --git a/glib/src/subclass/type_module.rs b/glib/src/subclass/type_module.rs index b46a1299552b..9b8563b11da1 100644 --- a/glib/src/subclass/type_module.rs +++ b/glib/src/subclass/type_module.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::{subclass::prelude::*, translate::*, Cast, TypeModule}; +use crate::{prelude::*, subclass::prelude::*, translate::*, TypeModule}; pub trait TypeModuleImpl: ObjectImpl + TypeModuleImplExt { // rustdoc-stripper-ignore-next @@ -97,7 +97,7 @@ unsafe extern "C" fn unload(type_module: *mut gobject_ffi::GT #[cfg(test)] mod tests { - use crate::{self as glib, prelude::TypeModuleExt}; + use crate as glib; use super::*; @@ -158,8 +158,8 @@ mod tests { assert!(!imp::SimpleModuleType::type_().is_valid()); let simple_module = glib::Object::new::(); // simulates the GLib type system to load the module. - assert!(simple_module.use_()); + assert!(TypeModuleExt::use_(&simple_module)); assert!(imp::SimpleModuleType::type_().is_valid()); - simple_module.unuse(); + TypeModuleExt::unuse(&simple_module); } } diff --git a/glib/src/subclass/type_plugin.rs b/glib/src/subclass/type_plugin.rs index 54c1cffe3327..890645fe437c 100644 --- a/glib/src/subclass/type_plugin.rs +++ b/glib/src/subclass/type_plugin.rs @@ -1,11 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use crate::enums::{EnumValues, FlagsValues}; -use crate::translate::IntoGlib; -use crate::translate::{FromGlib, ToGlibPtr}; use crate::{ - subclass::prelude::*, Cast, Interface, InterfaceInfo, Type, TypeFlags, TypeInfo, TypePlugin, - TypeValueTable, + prelude::*, subclass::prelude::*, translate::*, Interface, InterfaceInfo, Type, TypeFlags, + TypeInfo, TypePlugin, TypeValueTable, }; pub trait TypePluginImpl: ObjectImpl + TypePluginImplExt { diff --git a/glib/src/translate.rs b/glib/src/translate.rs index 11cfec05f01b..789f2ef52378 100644 --- a/glib/src/translate.rs +++ b/glib/src/translate.rs @@ -146,6 +146,9 @@ use std::{ ptr, }; +pub use crate::collections::{ptr_slice::IntoPtrSlice, strv::IntoStrV}; +pub use crate::gstring::{IntoGStr, IntoOptionalGStr}; + use libc::{c_char, size_t}; // rustdoc-stripper-ignore-next diff --git a/glib/src/types.rs b/glib/src/types.rs index f332ed123e8b..888f6fc7e469 100644 --- a/glib/src/types.rs +++ b/glib/src/types.rs @@ -12,7 +12,7 @@ use std::{ ptr, }; -use crate::{translate::*, IntoGStr, ObjectType, Slice, TypeFlags, TypePlugin}; +use crate::{prelude::*, translate::*, Slice, TypeFlags, TypePlugin}; // rustdoc-stripper-ignore-next /// A GLib or GLib-based library type diff --git a/glib/src/utils.rs b/glib/src/utils.rs index 126582c97fb6..1e8344ff7ba6 100644 --- a/glib/src/utils.rs +++ b/glib/src/utils.rs @@ -5,7 +5,7 @@ use std::{ mem, ptr, }; -use crate::{translate::*, GString, IntoGStr, IntoOptionalGStr}; +use crate::{translate::*, GString}; // rustdoc-stripper-ignore-next /// Same as [`get_prgname()`]. diff --git a/glib/src/value_array.rs b/glib/src/value_array.rs index 081985aeee75..b7d61be3ad63 100644 --- a/glib/src/value_array.rs +++ b/glib/src/value_array.rs @@ -3,12 +3,7 @@ use std::{cmp::Ordering, ops, slice}; use crate::{ - prelude::*, - translate::*, - value::{ - FromValue, GenericValueTypeOrNoneChecker, ToValueOptional, ValueType, ValueTypeOptional, - }, - HasParamSpec, ParamSpecValueArray, ParamSpecValueArrayBuilder, Type, Value, + prelude::*, translate::*, ParamSpecValueArray, ParamSpecValueArrayBuilder, Type, Value, }; wrapper! { @@ -157,11 +152,11 @@ impl ValueType for ValueArray { } #[doc(hidden)] -impl ValueTypeOptional for ValueArray {} +impl crate::value::ValueTypeOptional for ValueArray {} #[doc(hidden)] -unsafe impl<'a> FromValue<'a> for ValueArray { - type Checker = GenericValueTypeOrNoneChecker; +unsafe impl<'a> crate::value::FromValue<'a> for ValueArray { + type Checker = crate::value::GenericValueTypeOrNoneChecker; #[inline] unsafe fn from_value(value: &'a Value) -> Self { @@ -172,8 +167,8 @@ unsafe impl<'a> FromValue<'a> for ValueArray { } #[doc(hidden)] -unsafe impl<'a> FromValue<'a> for &'a ValueArray { - type Checker = GenericValueTypeOrNoneChecker; +unsafe impl<'a> crate::value::FromValue<'a> for &'a ValueArray { + type Checker = crate::value::GenericValueTypeOrNoneChecker; #[inline] unsafe fn from_value(value: &'a Value) -> Self { @@ -225,7 +220,7 @@ impl std::convert::From for Value { } #[doc(hidden)] -impl ToValueOptional for ValueArray { +impl crate::value::ToValueOptional for ValueArray { #[inline] fn to_value_optional(s: Option<&Self>) -> Value { let mut value = Value::for_value_type::(); diff --git a/glib/src/variant.rs b/glib/src/variant.rs index 7793e804d23b..37c42ee60d9b 100644 --- a/glib/src/variant.rs +++ b/glib/src/variant.rs @@ -18,7 +18,7 @@ //! //! ``` //! use glib::prelude::*; // or `use gtk::prelude::*;` -//! use glib::{Variant, FromVariant, ToVariant}; +//! use glib::variant::{Variant, FromVariant}; //! use std::collections::HashMap; //! //! // Using the `ToVariant` trait. @@ -1602,8 +1602,7 @@ where /// /// ``` ///# use glib::prelude::*; // or `use gtk::prelude::*;` -/// use glib::{Variant, FromVariant, ToVariant}; -/// use glib::variant::DictEntry; +/// use glib::variant::{Variant, FromVariant, DictEntry}; /// /// let entries = [ /// DictEntry::new("uuid", 1000u32), diff --git a/glib/tests/regex_compiletest/03-static-value.rs b/glib/tests/regex_compiletest/03-static-value.rs index ab13a19220b8..d40b037a520d 100644 --- a/glib/tests/regex_compiletest/03-static-value.rs +++ b/glib/tests/regex_compiletest/03-static-value.rs @@ -1,6 +1,6 @@ #![allow(unused)] -use glib::ToValue; +use glib::prelude::*; fn main() { let r = glib::Regex::new( diff --git a/glib/tests/regex_compiletest/04-nonstatic-value.rs b/glib/tests/regex_compiletest/04-nonstatic-value.rs index dee9f2eaa5f7..9b31ff3476a6 100644 --- a/glib/tests/regex_compiletest/04-nonstatic-value.rs +++ b/glib/tests/regex_compiletest/04-nonstatic-value.rs @@ -1,6 +1,6 @@ #![allow(unused)] -use glib::ToValue; +use glib::prelude::*; fn main() { let r = glib::Regex::new( diff --git a/glib/tests/structured_log.rs b/glib/tests/structured_log.rs index 0ffd5bf03b9b..8fcadd0f3406 100644 --- a/glib/tests/structured_log.rs +++ b/glib/tests/structured_log.rs @@ -5,13 +5,13 @@ fn structured_log() { use std::sync::{Arc, Mutex}; - use glib::*; + use glib::{gstr, prelude::*, GString, LogField, LogLevel}; let log = Arc::new(Mutex::new(Vec::new())); { let log = log.clone(); // can only be called once per test file - log_set_writer_func(move |level, fields| { + glib::log_set_writer_func(move |level, fields| { let fields = fields .iter() .map(|f| { @@ -25,10 +25,10 @@ fn structured_log() { }) .collect::>(); log.lock().unwrap().push((level, fields)); - LogWriterOutput::Handled + glib::LogWriterOutput::Handled }); } - log_structured!( + glib::log_structured!( "test", LogLevel::Message, { @@ -38,7 +38,7 @@ fn structured_log() { } ); - log_structured!( + glib::log_structured!( None, LogLevel::Message, { @@ -49,7 +49,7 @@ fn structured_log() { GString::from("MY_META3") => b"bstring".to_owned(); } ); - log_structured_array( + glib::log_structured_array( LogLevel::Warning, &[ LogField::new( @@ -61,7 +61,7 @@ fn structured_log() { LogField::new_user_data(gstr!("SOMEDATA"), 12345), ], ); - let dict = VariantDict::new(None); + let dict = glib::VariantDict::new(None); dict.insert_value( "MESSAGE_ID", &"9e093d0fac2f4d50838a649796ab154b".to_variant(), @@ -69,7 +69,7 @@ fn structured_log() { dict.insert_value("RELEASE", &"true".to_variant()); dict.insert_value("MY_BYTES", &"123".as_bytes().to_variant()); dict.insert_value("MESSAGE", &"from variant".to_variant()); - log_variant(Some("test"), LogLevel::Debug, &dict.end()); + glib::log_variant(Some("test"), LogLevel::Debug, &dict.end()); let log = std::mem::take(&mut *log.lock().unwrap()); let log = log diff --git a/glib/tests/value.rs b/glib/tests/value.rs index 53a9eac99b9f..1bcdf8fd7f0c 100644 --- a/glib/tests/value.rs +++ b/glib/tests/value.rs @@ -1,6 +1,6 @@ use std::ops::Deref; -use glib::*; +use glib::{prelude::*, BoxedValue, Value}; // FIXME all .get::() should be replaced with .get(); the compiler is totally able to infer the type itself. // But somehow without some tests are failing on Windows because the type inference doesn't work or something. diff --git a/graphene/Cargo.toml b/graphene/Cargo.toml index 55a325026ddc..949dd1c4699e 100644 --- a/graphene/Cargo.toml +++ b/graphene/Cargo.toml @@ -20,7 +20,7 @@ name = "graphene" v1_12 = ["ffi/v1_12"] [dependencies] -ffi = { package = "graphene-sys", path = "sys", version = "0.19" } +ffi = { package = "graphene-sys", path = "sys", version = "0.20" } libc.workspace = true glib.workspace = true diff --git a/pango/Cargo.toml b/pango/Cargo.toml index 49c1a650933d..4b31d64b9118 100644 --- a/pango/Cargo.toml +++ b/pango/Cargo.toml @@ -22,7 +22,7 @@ v1_50 = ["v1_48", "ffi/v1_50"] v1_52 = ["v1_50", "ffi/v1_52"] [dependencies] -ffi = { package = "pango-sys", path = "sys", version = "0.19" } +ffi = { package = "pango-sys", path = "sys", version = "0.20" } libc.workspace = true glib.workspace = true gio.workspace = true diff --git a/pango/src/attr_iterator.rs b/pango/src/attr_iterator.rs index cf544fcc6d56..f3577e50aa06 100644 --- a/pango/src/attr_iterator.rs +++ b/pango/src/attr_iterator.rs @@ -36,7 +36,7 @@ impl<'list> Drop for AttrIterator<'list> { #[cfg(feature = "v1_44")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))] -impl<'list> glib::StaticType for AttrIterator<'list> { +impl<'list> glib::prelude::StaticType for AttrIterator<'list> { #[inline] fn static_type() -> glib::Type { unsafe { from_glib(ffi::pango_attr_iterator_get_type()) } diff --git a/pango/src/enums.rs b/pango/src/enums.rs index 39ce106cd2ac..5e085645a1f0 100644 --- a/pango/src/enums.rs +++ b/pango/src/enums.rs @@ -1,7 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. #[cfg(feature = "v1_50")] -use glib::{error::ErrorDomain, prelude::*, translate::*, value::FromValue, Quark}; +use glib::{prelude::*, translate::*, Quark}; #[cfg(feature = "v1_50")] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] @@ -90,7 +90,7 @@ impl glib::value::ValueType for LayoutDeserializeError { #[cfg(feature = "v1_50")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))] -unsafe impl<'a> FromValue<'a> for LayoutDeserializeError { +unsafe impl<'a> glib::value::FromValue<'a> for LayoutDeserializeError { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { diff --git a/pango/src/glyph_item_iter.rs b/pango/src/glyph_item_iter.rs index 3336bdcd4a02..f56281864a6f 100644 --- a/pango/src/glyph_item_iter.rs +++ b/pango/src/glyph_item_iter.rs @@ -2,7 +2,7 @@ use std::{marker::PhantomData, mem}; -use glib::{translate::*, GStr, GString}; +use glib::{prelude::*, translate::*, GStr, GString}; use crate::GlyphItem; @@ -13,7 +13,7 @@ pub struct GlyphItemIter<'item> { item: PhantomData<&'item GlyphItem>, } -impl<'item> glib::StaticType for GlyphItemIter<'item> { +impl<'item> StaticType for GlyphItemIter<'item> { #[inline] fn static_type() -> glib::Type { unsafe { from_glib(ffi::pango_glyph_item_iter_get_type()) } diff --git a/pango/src/script_iter.rs b/pango/src/script_iter.rs index f13418b7245c..3ba6840fb667 100644 --- a/pango/src/script_iter.rs +++ b/pango/src/script_iter.rs @@ -41,7 +41,7 @@ impl<'text> Drop for ScriptIter<'text> { #[cfg(feature = "v1_44")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))] -impl<'text> glib::StaticType for ScriptIter<'text> { +impl<'text> glib::prelude::StaticType for ScriptIter<'text> { #[inline] fn static_type() -> glib::Type { unsafe { from_glib(ffi::pango_script_iter_get_type()) } diff --git a/pangocairo/Cargo.toml b/pangocairo/Cargo.toml index d3720ab08276..5ab1f7dfc746 100644 --- a/pangocairo/Cargo.toml +++ b/pangocairo/Cargo.toml @@ -14,7 +14,7 @@ rust-version.workspace = true version.workspace = true [dependencies] -ffi = { package = "pangocairo-sys", path = "sys", version = "0.19" } +ffi = { package = "pangocairo-sys", path = "sys", version = "0.20" } libc.workspace = true glib.workspace = true pango.workspace = true