diff --git a/Cargo.lock b/Cargo.lock index 0796002e6665..c1574766459f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -128,7 +128,7 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cairo-rs" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "bitflags 2.6.0", "cairo-sys-rs", @@ -139,7 +139,7 @@ dependencies = [ [[package]] name = "cairo-sys-rs" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "glib-sys", "libc", @@ -391,7 +391,7 @@ dependencies = [ [[package]] name = "gdk-pixbuf" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "gdk-pixbuf-sys", "gio", @@ -402,7 +402,7 @@ dependencies = [ [[package]] name = "gdk-pixbuf-sys" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "gio-sys", "glib-sys", @@ -551,7 +551,7 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "gio" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "futures-channel", "futures-core", @@ -567,7 +567,7 @@ dependencies = [ [[package]] name = "gio-sys" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "glib-sys", "gobject-sys", @@ -616,7 +616,7 @@ dependencies = [ [[package]] name = "glib" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "bitflags 2.6.0", "futures-channel", @@ -636,7 +636,7 @@ dependencies = [ [[package]] name = "glib-macros" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "heck", "proc-macro-crate", @@ -648,7 +648,7 @@ dependencies = [ [[package]] name = "glib-sys" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "libc", "system-deps", @@ -688,7 +688,7 @@ dependencies = [ [[package]] name = "gobject-sys" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "glib-sys", "libc", @@ -698,7 +698,7 @@ dependencies = [ [[package]] name = "graphene-rs" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "glib", "graphene-sys", @@ -708,7 +708,7 @@ dependencies = [ [[package]] name = "graphene-sys" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "glib-sys", "libc", @@ -1171,7 +1171,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "pango" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "gio", "glib", @@ -1182,7 +1182,7 @@ dependencies = [ [[package]] name = "pango-sys" version = "0.21.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#a1a0fdc1e02409a40fe706e18fea19abad6320fa" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#f69594c2f59643d60d1cf82081804b2a536f9f31" dependencies = [ "glib-sys", "gobject-sys", @@ -1716,9 +1716,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", diff --git a/examples/virtual_methods/base_button/mod.rs b/examples/virtual_methods/base_button/mod.rs index af6e755a288b..a0139bcd5356 100644 --- a/examples/virtual_methods/base_button/mod.rs +++ b/examples/virtual_methods/base_button/mod.rs @@ -60,7 +60,7 @@ impl> BaseButtonExt for O {} /// implement. /// /// See `derived_button/imp.rs` for how to override virtual methods. -pub trait BaseButtonImpl: ButtonImpl { +pub trait BaseButtonImpl: ButtonImpl + ObjectSubclass> { /// Default implementation of a virtual method. /// /// This always calls into the implementation of the parent class so that if diff --git a/gdk4/src/subclass/content_provider.rs b/gdk4/src/subclass/content_provider.rs index 50c11a0798c9..a9a720632178 100644 --- a/gdk4/src/subclass/content_provider.rs +++ b/gdk4/src/subclass/content_provider.rs @@ -9,7 +9,7 @@ use glib::{translate::*, Value}; use crate::{ffi, prelude::*, subclass::prelude::*, Clipboard, ContentFormats, ContentProvider}; -pub trait ContentProviderImpl: ContentProviderImplExt + ObjectImpl { +pub trait ContentProviderImpl: ObjectImpl + ObjectSubclass> { fn content_changed(&self) { self.parent_content_changed() } @@ -44,12 +44,7 @@ pub trait ContentProviderImpl: ContentProviderImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ContentProviderImplExt: sealed::Sealed + ObjectSubclass { +pub trait ContentProviderImplExt: ContentProviderImpl { fn parent_content_changed(&self) { unsafe { let data = Self::type_data(); diff --git a/gdk4/src/subclass/paintable.rs b/gdk4/src/subclass/paintable.rs index c0bb7451a9b9..33735986bfdc 100644 --- a/gdk4/src/subclass/paintable.rs +++ b/gdk4/src/subclass/paintable.rs @@ -8,7 +8,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Paintable, PaintableFlags, Snapshot}; -pub trait PaintableImpl: PaintableImplExt + ObjectImpl { +pub trait PaintableImpl: ObjectImpl + ObjectSubclass> { #[doc(alias = "get_current_image")] fn current_image(&self) -> Paintable { self.parent_current_image() @@ -37,12 +37,7 @@ pub trait PaintableImpl: PaintableImplExt + ObjectImpl { fn snapshot(&self, snapshot: &Snapshot, width: f64, height: f64); } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait PaintableImplExt: sealed::Sealed + ObjectSubclass { +pub trait PaintableImplExt: PaintableImpl { fn parent_current_image(&self) -> Paintable { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/accessible.rs b/gtk4/src/subclass/accessible.rs index 48ef5175f3de..55053c2f544f 100644 --- a/gtk4/src/subclass/accessible.rs +++ b/gtk4/src/subclass/accessible.rs @@ -12,7 +12,7 @@ use crate::{ ffi, prelude::*, subclass::prelude::*, ATContext, Accessible, AccessiblePlatformState, }; -pub trait AccessibleImpl: ObjectImpl { +pub trait AccessibleImpl: ObjectImpl + ObjectSubclass> { #[doc(alias = "get_platform_state")] fn platform_state(&self, state: AccessiblePlatformState) -> bool { self.parent_platform_state(state) @@ -44,12 +44,7 @@ pub trait AccessibleImpl: ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AccessibleImplExt: sealed::Sealed + ObjectSubclass { +pub trait AccessibleImplExt: AccessibleImpl { fn parent_platform_state(&self, state: AccessiblePlatformState) -> bool { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/accessible_range.rs b/gtk4/src/subclass/accessible_range.rs index c3cf121c7bc9..0fd8106faad6 100644 --- a/gtk4/src/subclass/accessible_range.rs +++ b/gtk4/src/subclass/accessible_range.rs @@ -8,18 +8,13 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, AccessibleRange}; -pub trait AccessibleRangeImpl: WidgetImpl { +pub trait AccessibleRangeImpl: AccessibleImpl + ObjectSubclass> { fn set_current_value(&self, value: f64) -> bool { self.parent_set_current_value(value) } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AccessibleRangeImplExt: sealed::Sealed + ObjectSubclass { +pub trait AccessibleRangeImplExt: AccessibleRangeImpl { // Returns true if the operation was performed, false otherwise fn parent_set_current_value(&self, value: f64) -> bool { unsafe { diff --git a/gtk4/src/subclass/actionable.rs b/gtk4/src/subclass/actionable.rs index bb0980c99547..cfcfb65cadef 100644 --- a/gtk4/src/subclass/actionable.rs +++ b/gtk4/src/subclass/actionable.rs @@ -8,7 +8,7 @@ use glib::{translate::*, GString, Variant}; use crate::{ffi, prelude::*, subclass::prelude::*, Actionable}; -pub trait ActionableImpl: WidgetImpl { +pub trait ActionableImpl: WidgetImpl + ObjectSubclass> { #[doc(alias = "get_action_name")] fn action_name(&self) -> Option; #[doc(alias = "get_action_target_value")] @@ -17,12 +17,7 @@ pub trait ActionableImpl: WidgetImpl { fn set_action_target_value(&self, value: Option<&Variant>); } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ActionableImplExt: sealed::Sealed + ObjectSubclass { +pub trait ActionableImplExt: ActionableImpl { fn parent_action_name(&self) -> Option { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/adjustment.rs b/gtk4/src/subclass/adjustment.rs index a2cc814f12e6..c50da39e712c 100644 --- a/gtk4/src/subclass/adjustment.rs +++ b/gtk4/src/subclass/adjustment.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Adjustment}; -pub trait AdjustmentImpl: AdjustmentImplExt + ObjectImpl { +pub trait AdjustmentImpl: ObjectImpl + ObjectSubclass> { fn changed(&self) { self.parent_changed() } @@ -17,12 +17,7 @@ pub trait AdjustmentImpl: AdjustmentImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AdjustmentImplExt: sealed::Sealed + ObjectSubclass { +pub trait AdjustmentImplExt: AdjustmentImpl { fn parent_changed(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/application.rs b/gtk4/src/subclass/application.rs index 9a9fa76997fd..1e9e726ef168 100644 --- a/gtk4/src/subclass/application.rs +++ b/gtk4/src/subclass/application.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Application, Window}; -pub trait GtkApplicationImpl: GtkApplicationImplExt + ApplicationImpl { +pub trait GtkApplicationImpl: ApplicationImpl + ObjectSubclass> { fn window_added(&self, window: &Window) { self.parent_window_added(window) } @@ -17,12 +17,7 @@ pub trait GtkApplicationImpl: GtkApplicationImplExt + ApplicationImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait GtkApplicationImplExt: sealed::Sealed + ObjectSubclass { +pub trait GtkApplicationImplExt: GtkApplicationImpl { fn parent_window_added(&self, window: &Window) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/application_window.rs b/gtk4/src/subclass/application_window.rs index 525adf29b059..68460db56e40 100644 --- a/gtk4/src/subclass/application_window.rs +++ b/gtk4/src/subclass/application_window.rs @@ -4,8 +4,11 @@ //! Traits intended for subclassing //! [`ApplicationWindow`](crate::ApplicationWindow). -use crate::{subclass::prelude::*, ApplicationWindow}; +use crate::{prelude::*, subclass::prelude::*, ApplicationWindow}; -pub trait ApplicationWindowImpl: WindowImpl + 'static {} +pub trait ApplicationWindowImpl: + WindowImpl + ObjectSubclass> + 'static +{ +} unsafe impl IsSubclassable for ApplicationWindow {} diff --git a/gtk4/src/subclass/box_.rs b/gtk4/src/subclass/box_.rs index 4d540bec45d3..ed65edc1a3e2 100644 --- a/gtk4/src/subclass/box_.rs +++ b/gtk4/src/subclass/box_.rs @@ -3,8 +3,8 @@ // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`Box`](crate::Box). -use crate::{subclass::prelude::*, Box}; +use crate::{prelude::*, subclass::prelude::*, Box}; -pub trait BoxImpl: WidgetImpl {} +pub trait BoxImpl: WidgetImpl + ObjectSubclass> {} unsafe impl IsSubclassable for Box {} diff --git a/gtk4/src/subclass/buildable.rs b/gtk4/src/subclass/buildable.rs index 5e10e5142f7d..8bf24aea97fe 100644 --- a/gtk4/src/subclass/buildable.rs +++ b/gtk4/src/subclass/buildable.rs @@ -10,7 +10,7 @@ use glib::{translate::*, GString, Object, Quark, Value}; use super::PtrHolder; use crate::{ffi, prelude::*, subclass::prelude::*, Buildable, Builder}; -pub trait BuildableImpl: ObjectImpl { +pub trait BuildableImpl: ObjectImpl + ObjectSubclass> { fn set_id(&self, id: &str) { self.parent_set_id(id) } @@ -59,12 +59,7 @@ pub trait BuildableImpl: ObjectImpl { // ); } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait BuildableImplExt: sealed::Sealed + ObjectSubclass { +pub trait BuildableImplExt: BuildableImpl { fn parent_set_id(&self, id: &str) { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/builder_scope.rs b/gtk4/src/subclass/builder_scope.rs index 6d49b3a7f373..db04f451c41a 100644 --- a/gtk4/src/subclass/builder_scope.rs +++ b/gtk4/src/subclass/builder_scope.rs @@ -11,11 +11,11 @@ use crate::{ BuilderScope, }; -pub trait BuilderCScopeImpl: BuilderScopeImpl {} +pub trait BuilderCScopeImpl: BuilderScopeImpl + ObjectSubclass> {} unsafe impl IsSubclassable for BuilderCScope {} -pub trait BuilderScopeImpl: ObjectImpl { +pub trait BuilderScopeImpl: ObjectImpl + ObjectSubclass> { #[doc(alias = "get_type_from_name")] fn type_from_name(&self, builder: &Builder, type_name: &str) -> glib::Type { self.parent_type_from_name(builder, type_name) @@ -35,12 +35,7 @@ pub trait BuilderScopeImpl: ObjectImpl { ) -> Result; } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait BuilderScopeImplExt: sealed::Sealed + ObjectSubclass { +pub trait BuilderScopeImplExt: BuilderScopeImpl { fn parent_type_from_name(&self, builder: &Builder, type_name: &str) -> glib::Type { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/button.rs b/gtk4/src/subclass/button.rs index 68750d3da9c9..f62817264d97 100644 --- a/gtk4/src/subclass/button.rs +++ b/gtk4/src/subclass/button.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Button}; -pub trait ButtonImpl: ButtonImplExt + WidgetImpl { +pub trait ButtonImpl: WidgetImpl + ObjectSubclass> { fn activate(&self) { self.parent_activate() } @@ -17,12 +17,7 @@ pub trait ButtonImpl: ButtonImplExt + WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ButtonImplExt: sealed::Sealed + ObjectSubclass { +pub trait ButtonImplExt: ButtonImpl { fn parent_activate(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/cell_area.rs b/gtk4/src/subclass/cell_area.rs index 8e50c3423a1f..a3e5e3f910e8 100644 --- a/gtk4/src/subclass/cell_area.rs +++ b/gtk4/src/subclass/cell_area.rs @@ -63,7 +63,7 @@ impl CellCallbackAllocate { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellAreaImpl: CellAreaImplExt + ObjectImpl { +pub trait CellAreaImpl: ObjectImpl + ObjectSubclass> { fn cell_properties() -> &'static [ParamSpec] { &[] } @@ -219,14 +219,9 @@ pub trait CellAreaImpl: CellAreaImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellAreaImplExt: sealed::Sealed + ObjectSubclass { +pub trait CellAreaImplExt: CellAreaImpl { // Returns true if the area was successfully activated fn parent_activate, W: IsA>( &self, @@ -956,4 +951,4 @@ pub unsafe trait CellAreaClassExt: ClassStruct { } } -unsafe impl CellAreaClassExt for T where T::Type: CellAreaImpl {} +unsafe impl CellAreaClassExt for T {} diff --git a/gtk4/src/subclass/cell_area_context.rs b/gtk4/src/subclass/cell_area_context.rs index a2b8c7bc3529..1f5b60efa109 100644 --- a/gtk4/src/subclass/cell_area_context.rs +++ b/gtk4/src/subclass/cell_area_context.rs @@ -11,7 +11,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, CellAreaContext}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellAreaContextImpl: CellAreaContextImplExt + ObjectImpl { +pub trait CellAreaContextImpl: ObjectImpl + ObjectSubclass> { fn reset(&self) { self.parent_reset() } @@ -29,14 +29,9 @@ pub trait CellAreaContextImpl: CellAreaContextImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellAreaContextImplExt: sealed::Sealed + ObjectSubclass { +pub trait CellAreaContextImplExt: CellAreaContextImpl { fn parent_reset(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/cell_editable.rs b/gtk4/src/subclass/cell_editable.rs index 7ec83693d62c..937b4ce66dc7 100644 --- a/gtk4/src/subclass/cell_editable.rs +++ b/gtk4/src/subclass/cell_editable.rs @@ -10,7 +10,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, CellEditable}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellEditableImpl: ObjectImpl { +pub trait CellEditableImpl: ObjectImpl + ObjectSubclass> { fn editing_done(&self) { self.parent_editing_done() } @@ -24,14 +24,9 @@ pub trait CellEditableImpl: ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellEditableImplExt: sealed::Sealed + ObjectSubclass { +pub trait CellEditableImplExt: CellEditableImpl { fn parent_editing_done(&self) { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/cell_layout.rs b/gtk4/src/subclass/cell_layout.rs index 427d48b3d039..1fd4896f81b4 100644 --- a/gtk4/src/subclass/cell_layout.rs +++ b/gtk4/src/subclass/cell_layout.rs @@ -53,7 +53,7 @@ impl Drop for CellLayoutDataCallback { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellLayoutImpl: ObjectImpl { +pub trait CellLayoutImpl: ObjectImpl + ObjectSubclass> { fn add_attribute>(&self, cell: &R, attribute: &str, column: i32) { self.parent_add_attribute(cell, attribute, column) } @@ -96,14 +96,9 @@ pub trait CellLayoutImpl: ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellLayoutImplExt: sealed::Sealed + ObjectSubclass { +pub trait CellLayoutImplExt: CellLayoutImpl { fn parent_add_attribute>(&self, cell: &R, attribute: &str, column: i32) { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/cell_renderer.rs b/gtk4/src/subclass/cell_renderer.rs index 9a8856b78647..7f88c27906c8 100644 --- a/gtk4/src/subclass/cell_renderer.rs +++ b/gtk4/src/subclass/cell_renderer.rs @@ -15,7 +15,7 @@ use crate::{ #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellRendererImpl: CellRendererImplExt + ObjectImpl { +pub trait CellRendererImpl: ObjectImpl + ObjectSubclass> { fn activate>( &self, event: Option<&gdk::Event>, @@ -95,14 +95,9 @@ pub trait CellRendererImpl: CellRendererImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellRendererImplExt: sealed::Sealed + ObjectSubclass { +pub trait CellRendererImplExt: CellRendererImpl { fn parent_request_mode(&self) -> SizeRequestMode { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/cell_renderer_text.rs b/gtk4/src/subclass/cell_renderer_text.rs index d85e8fa03305..fdfb0d91865b 100644 --- a/gtk4/src/subclass/cell_renderer_text.rs +++ b/gtk4/src/subclass/cell_renderer_text.rs @@ -10,20 +10,17 @@ use crate::{ffi, prelude::*, subclass::prelude::*, CellRendererText}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellRendererTextImpl: CellRendererTextImplExt + CellRendererImpl { +pub trait CellRendererTextImpl: + CellRendererImpl + ObjectSubclass> +{ fn edited(&self, path: &str, new_text: &str) { self.parent_edited(path, new_text); } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait CellRendererTextImplExt: sealed::Sealed + ObjectSubclass { +pub trait CellRendererTextImplExt: CellRendererTextImpl { fn parent_edited(&self, path: &str, new_text: &str) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/check_button.rs b/gtk4/src/subclass/check_button.rs index 5b9e4d508e7d..c7ac02eaeef4 100644 --- a/gtk4/src/subclass/check_button.rs +++ b/gtk4/src/subclass/check_button.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, CheckButton}; -pub trait CheckButtonImpl: CheckButtonImplExt + WidgetImpl { +pub trait CheckButtonImpl: WidgetImpl + ObjectSubclass> { fn toggled(&self) { self.parent_toggled() } @@ -19,12 +19,7 @@ pub trait CheckButtonImpl: CheckButtonImplExt + WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait CheckButtonImplExt: sealed::Sealed + ObjectSubclass { +pub trait CheckButtonImplExt: CheckButtonImpl { fn parent_toggled(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/color_chooser.rs b/gtk4/src/subclass/color_chooser.rs index 00c836dbc114..0cd35eecfeee 100644 --- a/gtk4/src/subclass/color_chooser.rs +++ b/gtk4/src/subclass/color_chooser.rs @@ -11,7 +11,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, ColorChooser, Orientation}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait ColorChooserImpl: ObjectImpl { +pub trait ColorChooserImpl: ObjectImpl + ObjectSubclass> { fn add_palette(&self, orientation: Orientation, colors_per_line: i32, colors: &[RGBA]) { self.parent_add_palette(orientation, colors_per_line, colors); } @@ -25,14 +25,9 @@ pub trait ColorChooserImpl: ObjectImpl { fn set_rgba(&self, rgba: RGBA); } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait ColorChooserImplExt: sealed::Sealed + ObjectSubclass { +pub trait ColorChooserImplExt: ColorChooserImpl { fn parent_add_palette(&self, orientation: Orientation, colors_per_line: i32, colors: &[RGBA]) { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/combo_box.rs b/gtk4/src/subclass/combo_box.rs index a88d7399e776..e67a7150a4c5 100644 --- a/gtk4/src/subclass/combo_box.rs +++ b/gtk4/src/subclass/combo_box.rs @@ -9,7 +9,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, ComboBox}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait ComboBoxImpl: ComboBoxImplExt + WidgetImpl { +pub trait ComboBoxImpl: WidgetImpl + ObjectSubclass> { #[cfg(feature = "v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] fn activate(&self) { @@ -23,14 +23,9 @@ pub trait ComboBoxImpl: ComboBoxImplExt + WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait ComboBoxImplExt: sealed::Sealed + ObjectSubclass { +pub trait ComboBoxImplExt: ComboBoxImpl { #[cfg(feature = "v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] fn parent_activate(&self) { diff --git a/gtk4/src/subclass/dialog.rs b/gtk4/src/subclass/dialog.rs index 2fb77162f9cd..3020c30e61f9 100644 --- a/gtk4/src/subclass/dialog.rs +++ b/gtk4/src/subclass/dialog.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Dialog, ResponseType}; -pub trait DialogImpl: DialogImplExt + WindowImpl { +pub trait DialogImpl: WindowImpl + ObjectSubclass> { fn response(&self, response: ResponseType) { self.parent_response(response) } @@ -17,12 +17,7 @@ pub trait DialogImpl: DialogImplExt + WindowImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait DialogImplExt: sealed::Sealed + ObjectSubclass { +pub trait DialogImplExt: DialogImpl { fn parent_response(&self, response: ResponseType) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/drawing_area.rs b/gtk4/src/subclass/drawing_area.rs index 3d4ef8b293d5..b941aef4db34 100644 --- a/gtk4/src/subclass/drawing_area.rs +++ b/gtk4/src/subclass/drawing_area.rs @@ -7,17 +7,13 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, DrawingArea}; -pub trait DrawingAreaImpl: DrawingAreaImplExt + WidgetImpl { +pub trait DrawingAreaImpl: WidgetImpl + ObjectSubclass> { fn resize(&self, width: i32, height: i32) { self.parent_resize(width, height) } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} -pub trait DrawingAreaImplExt: sealed::Sealed + ObjectSubclass { +pub trait DrawingAreaImplExt: DrawingAreaImpl { fn parent_resize(&self, width: i32, height: i32) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/editable.rs b/gtk4/src/subclass/editable.rs index 6a418ab9291e..1e6e6675e7c0 100644 --- a/gtk4/src/subclass/editable.rs +++ b/gtk4/src/subclass/editable.rs @@ -10,7 +10,7 @@ use libc::{c_char, c_int}; use crate::{ffi, prelude::*, subclass::prelude::*, Editable}; -pub trait EditableImpl: WidgetImpl { +pub trait EditableImpl: WidgetImpl + ObjectSubclass> { fn insert_text(&self, text: &str, length: i32, position: &mut i32) { self.parent_insert_text(text, length, position); } @@ -51,12 +51,7 @@ pub trait EditableImpl: WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait EditableImplExt: sealed::Sealed + ObjectSubclass { +pub trait EditableImplExt: EditableImpl { #[doc(alias = "gtk_editable_delegate_get_property")] fn delegate_get_property( &self, diff --git a/gtk4/src/subclass/entry.rs b/gtk4/src/subclass/entry.rs index 321a087022f5..a507df9b89a9 100644 --- a/gtk4/src/subclass/entry.rs +++ b/gtk4/src/subclass/entry.rs @@ -7,18 +7,13 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Entry}; -pub trait EntryImpl: EntryImplExt + WidgetImpl { +pub trait EntryImpl: WidgetImpl + ObjectSubclass> { fn activate(&self) { self.parent_activate() } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait EntryImplExt: sealed::Sealed + ObjectSubclass { +pub trait EntryImplExt: EntryImpl { fn parent_activate(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/entry_buffer.rs b/gtk4/src/subclass/entry_buffer.rs index b252566f5366..b0d38a47a95a 100644 --- a/gtk4/src/subclass/entry_buffer.rs +++ b/gtk4/src/subclass/entry_buffer.rs @@ -9,7 +9,7 @@ use glib::{translate::*, GString}; use super::PtrHolder; use crate::{ffi, prelude::*, subclass::prelude::*, EntryBuffer}; -pub trait EntryBufferImpl: EntryBufferImplExt + ObjectImpl { +pub trait EntryBufferImpl: ObjectImpl + ObjectSubclass> { fn delete_text(&self, position: u32, n_chars: Option) -> u32 { self.parent_delete_text(position, n_chars) } @@ -36,12 +36,7 @@ pub trait EntryBufferImpl: EntryBufferImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait EntryBufferImplExt: sealed::Sealed + ObjectSubclass { +pub trait EntryBufferImplExt: EntryBufferImpl { fn parent_delete_text(&self, position: u32, n_chars: Option) -> u32 { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/filter.rs b/gtk4/src/subclass/filter.rs index fac41809e392..3b357c0960dc 100644 --- a/gtk4/src/subclass/filter.rs +++ b/gtk4/src/subclass/filter.rs @@ -7,7 +7,7 @@ use glib::{translate::*, Object}; use crate::{ffi, prelude::*, subclass::prelude::*, Filter, FilterMatch}; -pub trait FilterImpl: FilterImplExt + ObjectImpl { +pub trait FilterImpl: ObjectImpl + ObjectSubclass> { #[doc(alias = "get_strictness")] fn strictness(&self) -> FilterMatch { self.parent_strictness() @@ -17,12 +17,7 @@ pub trait FilterImpl: FilterImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait FilterImplExt: sealed::Sealed + ObjectSubclass { +pub trait FilterImplExt: FilterImpl { fn parent_strictness(&self) -> FilterMatch { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/fixed.rs b/gtk4/src/subclass/fixed.rs index 2d14ccb310e3..3fbf6dace02c 100644 --- a/gtk4/src/subclass/fixed.rs +++ b/gtk4/src/subclass/fixed.rs @@ -3,8 +3,8 @@ // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`Fixed`](crate::Fixed). -use crate::{subclass::prelude::*, Fixed}; +use crate::{prelude::*, subclass::prelude::*, Fixed}; -pub trait FixedImpl: WidgetImpl {} +pub trait FixedImpl: WidgetImpl + ObjectSubclass> {} unsafe impl IsSubclassable for Fixed {} diff --git a/gtk4/src/subclass/flow_box_child.rs b/gtk4/src/subclass/flow_box_child.rs index dde047d4acaa..77866b1f4f2a 100644 --- a/gtk4/src/subclass/flow_box_child.rs +++ b/gtk4/src/subclass/flow_box_child.rs @@ -7,18 +7,13 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, FlowBoxChild}; -pub trait FlowBoxChildImpl: FlowBoxChildImplExt + WidgetImpl { +pub trait FlowBoxChildImpl: WidgetImpl + ObjectSubclass> { fn activate(&self) { self.parent_activate() } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait FlowBoxChildImplExt: sealed::Sealed + ObjectSubclass { +pub trait FlowBoxChildImplExt: FlowBoxChildImpl { fn parent_activate(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/font_chooser.rs b/gtk4/src/subclass/font_chooser.rs index c232860f5110..a4723211a94a 100644 --- a/gtk4/src/subclass/font_chooser.rs +++ b/gtk4/src/subclass/font_chooser.rs @@ -49,7 +49,7 @@ impl Drop for FilterCallback { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait FontChooserImpl: ObjectImpl { +pub trait FontChooserImpl: ObjectImpl + ObjectSubclass> { fn font_family(&self) -> Option { self.parent_font_family() } @@ -79,14 +79,9 @@ pub trait FontChooserImpl: ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait FontChooserImplExt: sealed::Sealed + ObjectSubclass { +pub trait FontChooserImplExt: FontChooserImpl { fn parent_font_family(&self) -> Option { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/frame.rs b/gtk4/src/subclass/frame.rs index 0eed42525de5..d5c8e5352a23 100644 --- a/gtk4/src/subclass/frame.rs +++ b/gtk4/src/subclass/frame.rs @@ -9,7 +9,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, Allocation, Frame}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait FrameImpl: FrameImplExt + WidgetImpl { +pub trait FrameImpl: WidgetImpl + ObjectSubclass> { fn compute_child_allocation(&self) -> Allocation { self.parent_compute_child_allocation() } @@ -17,7 +17,7 @@ pub trait FrameImpl: FrameImplExt + WidgetImpl { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait FrameImplExt: ObjectSubclass { +pub trait FrameImplExt: FrameImpl { fn parent_compute_child_allocation(&self) -> Allocation { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/gl_area.rs b/gtk4/src/subclass/gl_area.rs index 9c7e779285fd..dd1dcd8e1b69 100644 --- a/gtk4/src/subclass/gl_area.rs +++ b/gtk4/src/subclass/gl_area.rs @@ -9,7 +9,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, GLArea}; #[allow(clippy::upper_case_acronyms)] -pub trait GLAreaImpl: GLAreaImplExt + WidgetImpl { +pub trait GLAreaImpl: WidgetImpl + ObjectSubclass> { fn create_context(&self) -> Option { self.parent_create_context() } @@ -23,13 +23,8 @@ pub trait GLAreaImpl: GLAreaImplExt + WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[allow(clippy::upper_case_acronyms)] -pub trait GLAreaImplExt: sealed::Sealed + ObjectSubclass { +pub trait GLAreaImplExt: GLAreaImpl { fn parent_create_context(&self) -> Option { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/grid.rs b/gtk4/src/subclass/grid.rs index 56c5c5dc4ea6..883582274804 100644 --- a/gtk4/src/subclass/grid.rs +++ b/gtk4/src/subclass/grid.rs @@ -3,8 +3,8 @@ // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`Grid`](crate::Grid). -use crate::{subclass::prelude::*, Grid}; +use crate::{prelude::*, subclass::prelude::*, Grid}; -pub trait GridImpl: WidgetImpl {} +pub trait GridImpl: WidgetImpl + ObjectSubclass> {} unsafe impl IsSubclassable for Grid {} diff --git a/gtk4/src/subclass/im_context.rs b/gtk4/src/subclass/im_context.rs index 979619aa850d..fea3861d7d35 100644 --- a/gtk4/src/subclass/im_context.rs +++ b/gtk4/src/subclass/im_context.rs @@ -9,7 +9,7 @@ use pango::AttrList; use crate::{ffi, prelude::*, subclass::prelude::*, IMContext, Widget}; #[allow(clippy::upper_case_acronyms)] -pub trait IMContextImpl: IMContextImplExt + ObjectImpl { +pub trait IMContextImpl: ObjectImpl + ObjectSubclass> { fn commit(&self, string: &str) { self.parent_commit(string) } @@ -74,13 +74,8 @@ pub trait IMContextImpl: IMContextImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[allow(clippy::upper_case_acronyms)] -pub trait IMContextImplExt: sealed::Sealed + ObjectSubclass { +pub trait IMContextImplExt: IMContextImpl { fn parent_commit(&self, string: &str) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/layout_child.rs b/gtk4/src/subclass/layout_child.rs index 3aed155484e9..f105a656ac3d 100644 --- a/gtk4/src/subclass/layout_child.rs +++ b/gtk4/src/subclass/layout_child.rs @@ -3,9 +3,9 @@ // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`LayoutChild`](crate::LayoutChild). -use crate::{subclass::prelude::*, LayoutChild}; +use crate::{prelude::*, subclass::prelude::*, LayoutChild}; -pub trait LayoutChildImpl: ObjectImpl {} +pub trait LayoutChildImpl: ObjectImpl + ObjectSubclass> {} unsafe impl IsSubclassable for LayoutChild { fn class_init(class: &mut glib::Class) { diff --git a/gtk4/src/subclass/layout_manager.rs b/gtk4/src/subclass/layout_manager.rs index 5d3e97b0658b..a953bfd77c5d 100644 --- a/gtk4/src/subclass/layout_manager.rs +++ b/gtk4/src/subclass/layout_manager.rs @@ -11,7 +11,7 @@ use crate::{ SizeRequestMode, Widget, }; -pub trait LayoutManagerImpl: LayoutManagerImplExt + ObjectImpl { +pub trait LayoutManagerImpl: ObjectImpl + ObjectSubclass> { fn allocate(&self, widget: &Widget, width: i32, height: i32, baseline: i32) { self.parent_allocate(widget, width, height, baseline) } @@ -48,12 +48,7 @@ pub trait LayoutManagerImpl: LayoutManagerImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait LayoutManagerImplExt: sealed::Sealed + ObjectSubclass { +pub trait LayoutManagerImplExt: LayoutManagerImpl { fn parent_allocate(&self, widget: &Widget, width: i32, height: i32, baseline: i32) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/list_box_row.rs b/gtk4/src/subclass/list_box_row.rs index 241975274b94..a07ec9cfd441 100644 --- a/gtk4/src/subclass/list_box_row.rs +++ b/gtk4/src/subclass/list_box_row.rs @@ -7,18 +7,13 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, ListBoxRow}; -pub trait ListBoxRowImpl: ListBoxRowImplExt + WidgetImpl { +pub trait ListBoxRowImpl: WidgetImpl + ObjectSubclass> { fn activate(&self) { self.parent_activate() } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ListBoxRowImplExt: sealed::Sealed + ObjectSubclass { +pub trait ListBoxRowImplExt: ListBoxRowImpl { fn parent_activate(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/media_file.rs b/gtk4/src/subclass/media_file.rs index c97c2335af35..b96d4dc05b57 100644 --- a/gtk4/src/subclass/media_file.rs +++ b/gtk4/src/subclass/media_file.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, MediaFile}; -pub trait MediaFileImpl: MediaFileImplExt + MediaStreamImpl { +pub trait MediaFileImpl: MediaStreamImpl + ObjectSubclass> { fn close(&self) { self.parent_close() } @@ -16,12 +16,7 @@ pub trait MediaFileImpl: MediaFileImplExt + MediaStreamImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait MediaFileImplExt: sealed::Sealed + ObjectSubclass { +pub trait MediaFileImplExt: MediaFileImpl { fn parent_close(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/media_stream.rs b/gtk4/src/subclass/media_stream.rs index d0786b0c6da8..9dccee4e5b93 100644 --- a/gtk4/src/subclass/media_stream.rs +++ b/gtk4/src/subclass/media_stream.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, MediaStream}; -pub trait MediaStreamImpl: MediaStreamImplExt + ObjectImpl { +pub trait MediaStreamImpl: ObjectImpl + ObjectSubclass> { fn pause(&self) { self.parent_pause() } @@ -33,12 +33,7 @@ pub trait MediaStreamImpl: MediaStreamImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait MediaStreamImplExt: sealed::Sealed + ObjectSubclass { +pub trait MediaStreamImplExt: MediaStreamImpl { fn parent_pause(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/native_dialog.rs b/gtk4/src/subclass/native_dialog.rs index 5cda1e37efca..0281ee2e84f1 100644 --- a/gtk4/src/subclass/native_dialog.rs +++ b/gtk4/src/subclass/native_dialog.rs @@ -9,7 +9,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, NativeDialog, ResponseType}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait NativeDialogImpl: NativeDialogImplExt + ObjectImpl { +pub trait NativeDialogImpl: ObjectImpl + ObjectSubclass> { fn response(&self, response: ResponseType) { self.parent_response(response) } @@ -23,14 +23,9 @@ pub trait NativeDialogImpl: NativeDialogImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait NativeDialogImplExt: sealed::Sealed + ObjectSubclass { +pub trait NativeDialogImplExt: NativeDialogImpl { fn parent_response(&self, response: ResponseType) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/orientable.rs b/gtk4/src/subclass/orientable.rs index 8cc34827af37..362ecbc5e28a 100644 --- a/gtk4/src/subclass/orientable.rs +++ b/gtk4/src/subclass/orientable.rs @@ -4,8 +4,8 @@ //! Traits intended for implementing the [`Orientable`](crate::Orientable) //! interface. -use crate::{subclass::prelude::*, Orientable}; +use crate::{prelude::*, subclass::prelude::*, Orientable}; -pub trait OrientableImpl: WidgetImpl {} +pub trait OrientableImpl: ObjectImpl + ObjectSubclass> {} unsafe impl IsImplementable for Orientable {} diff --git a/gtk4/src/subclass/popover.rs b/gtk4/src/subclass/popover.rs index 48d82a9a91b2..28ea7ce745ad 100644 --- a/gtk4/src/subclass/popover.rs +++ b/gtk4/src/subclass/popover.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Popover}; -pub trait PopoverImpl: PopoverImplExt + WidgetImpl { +pub trait PopoverImpl: WidgetImpl + ObjectSubclass> { fn activate_default(&self) { self.parent_activate_default() } @@ -17,12 +17,7 @@ pub trait PopoverImpl: PopoverImplExt + WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait PopoverImplExt: sealed::Sealed + ObjectSubclass { +pub trait PopoverImplExt: PopoverImpl { fn parent_activate_default(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/print_operation.rs b/gtk4/src/subclass/print_operation.rs index 45412fcde930..3b33e30e4c3f 100644 --- a/gtk4/src/subclass/print_operation.rs +++ b/gtk4/src/subclass/print_operation.rs @@ -10,7 +10,9 @@ use crate::{ PrintOperationPreview, PrintOperationResult, PrintSettings, Widget, Window, }; -pub trait PrintOperationImpl: PrintOperationImplExt + PrintOperationPreviewImpl { +pub trait PrintOperationImpl: + PrintOperationPreviewImpl + ObjectSubclass> +{ fn begin_print(&self, context: &PrintContext) { self.parent_begin_print(context) } @@ -61,12 +63,7 @@ pub trait PrintOperationImpl: PrintOperationImplExt + PrintOperationPreviewImpl } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait PrintOperationImplExt: sealed::Sealed + ObjectSubclass { +pub trait PrintOperationImplExt: PrintOperationImpl { fn parent_begin_print(&self, context: &PrintContext) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/print_operation_preview.rs b/gtk4/src/subclass/print_operation_preview.rs index 17896262dcfe..f1f161c598c1 100644 --- a/gtk4/src/subclass/print_operation_preview.rs +++ b/gtk4/src/subclass/print_operation_preview.rs @@ -10,7 +10,9 @@ use crate::{ ffi, prelude::*, subclass::prelude::*, PageSetup, PrintContext, PrintOperationPreview, }; -pub trait PrintOperationPreviewImpl: ObjectImpl { +pub trait PrintOperationPreviewImpl: + ObjectImpl + ObjectSubclass> +{ fn ready(&self, context: &PrintContext) { self.parent_ready(context) } @@ -24,12 +26,7 @@ pub trait PrintOperationPreviewImpl: ObjectImpl { fn end_preview(&self); } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait PrintOperationPreviewImplExt: sealed::Sealed + ObjectSubclass { +pub trait PrintOperationPreviewImplExt: PrintOperationPreviewImpl { fn parent_ready(&self, context: &PrintContext) { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/range.rs b/gtk4/src/subclass/range.rs index 1f39c3708d96..e2c3c104f556 100644 --- a/gtk4/src/subclass/range.rs +++ b/gtk4/src/subclass/range.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Border, Range, ScrollType}; -pub trait RangeImpl: RangeImplExt + WidgetImpl { +pub trait RangeImpl: WidgetImpl + ObjectSubclass> { fn adjust_bounds(&self, new_value: f64) { self.parent_adjust_bounds(new_value) } @@ -30,12 +30,7 @@ pub trait RangeImpl: RangeImplExt + WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RangeImplExt: sealed::Sealed + ObjectSubclass { +pub trait RangeImplExt: RangeImpl { fn parent_adjust_bounds(&self, new_value: f64) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/recent_manager.rs b/gtk4/src/subclass/recent_manager.rs index a4fb70d57970..e699241bccbf 100644 --- a/gtk4/src/subclass/recent_manager.rs +++ b/gtk4/src/subclass/recent_manager.rs @@ -7,17 +7,13 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, RecentManager}; -pub trait RecentManagerImpl: RecentManagerImplExt + ObjectImpl { +pub trait RecentManagerImpl: ObjectImpl + ObjectSubclass> { fn changed(&self) { self.parent_changed() } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} -pub trait RecentManagerImplExt: sealed::Sealed + ObjectSubclass { +pub trait RecentManagerImplExt: RecentManagerImpl { fn parent_changed(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/scale.rs b/gtk4/src/subclass/scale.rs index f0df0a6c4306..6c52f6abafdc 100644 --- a/gtk4/src/subclass/scale.rs +++ b/gtk4/src/subclass/scale.rs @@ -7,19 +7,14 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Scale}; -pub trait ScaleImpl: ScaleImplExt + RangeImpl { +pub trait ScaleImpl: RangeImpl + ObjectSubclass> { #[doc(alias = "get_layout_offsets")] fn layout_offsets(&self) -> (i32, i32) { self.parent_layout_offsets() } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ScaleImplExt: sealed::Sealed + ObjectSubclass { +pub trait ScaleImplExt: ScaleImpl { fn parent_layout_offsets(&self) -> (i32, i32) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/scale_button.rs b/gtk4/src/subclass/scale_button.rs index 9add7fbdd674..4606cbd90da5 100644 --- a/gtk4/src/subclass/scale_button.rs +++ b/gtk4/src/subclass/scale_button.rs @@ -7,18 +7,13 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, ScaleButton}; -pub trait ScaleButtonImpl: ScaleButtonImplExt + WidgetImpl { +pub trait ScaleButtonImpl: WidgetImpl + ObjectSubclass> { fn value_changed(&self, new_value: f64) { self.parent_value_changed(new_value) } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ScaleButtonImplExt: sealed::Sealed + ObjectSubclass { +pub trait ScaleButtonImplExt: ScaleButtonImpl { fn parent_value_changed(&self, new_value: f64) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/scrollable.rs b/gtk4/src/subclass/scrollable.rs index 71f26e283c55..c4a88cb06c45 100644 --- a/gtk4/src/subclass/scrollable.rs +++ b/gtk4/src/subclass/scrollable.rs @@ -8,19 +8,14 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Border, Scrollable}; -pub trait ScrollableImpl: WidgetImpl { +pub trait ScrollableImpl: WidgetImpl + ObjectSubclass> { #[doc(alias = "get_border")] fn border(&self) -> Option { self.parent_border() } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ScrollableImplExt: sealed::Sealed + ObjectSubclass { +pub trait ScrollableImplExt: ScrollableImpl { fn parent_border(&self) -> Option { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/section_model.rs b/gtk4/src/subclass/section_model.rs index 658554f627f1..5e4a99fc6a8e 100644 --- a/gtk4/src/subclass/section_model.rs +++ b/gtk4/src/subclass/section_model.rs @@ -8,19 +8,14 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, SectionModel}; -pub trait SectionModelImpl: ListModelImpl { +pub trait SectionModelImpl: ListModelImpl + ObjectSubclass> { #[doc(alias = "get_section")] fn section(&self, position: u32) -> (u32, u32) { self.parent_section(position) } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait SectionModelImplExt: sealed::Sealed + ObjectSubclass { +pub trait SectionModelImplExt: SectionModelImpl { fn parent_section(&self, position: u32) -> (u32, u32) { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/selection_model.rs b/gtk4/src/subclass/selection_model.rs index 1a6b7f8e924e..c858194f90d6 100644 --- a/gtk4/src/subclass/selection_model.rs +++ b/gtk4/src/subclass/selection_model.rs @@ -8,7 +8,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Bitset, SelectionModel}; -pub trait SelectionModelImpl: ListModelImpl { +pub trait SelectionModelImpl: ListModelImpl + ObjectSubclass> { #[doc(alias = "get_selection_in_range")] fn selection_in_range(&self, position: u32, n_items: u32) -> Bitset { self.parent_selection_in_range(position, n_items) @@ -47,12 +47,7 @@ pub trait SelectionModelImpl: ListModelImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait SelectionModelImplExt: sealed::Sealed + ObjectSubclass { +pub trait SelectionModelImplExt: SelectionModelImpl { fn parent_selection_in_range(&self, position: u32, n_items: u32) -> Bitset { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/shortcut_manager.rs b/gtk4/src/subclass/shortcut_manager.rs index 7e7472df788e..97f0c1f8f0fd 100644 --- a/gtk4/src/subclass/shortcut_manager.rs +++ b/gtk4/src/subclass/shortcut_manager.rs @@ -8,7 +8,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, ShortcutController, ShortcutManager}; -pub trait ShortcutManagerImpl: ObjectImpl { +pub trait ShortcutManagerImpl: ObjectImpl + ObjectSubclass> { fn add_controller(&self, controller: &ShortcutController) { self.parent_add_controller(controller); } @@ -18,12 +18,7 @@ pub trait ShortcutManagerImpl: ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ShortcutManagerImplExt: sealed::Sealed + ObjectSubclass { +pub trait ShortcutManagerImplExt: ShortcutManagerImpl { fn parent_add_controller(&self, controller: &ShortcutController) { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/sorter.rs b/gtk4/src/subclass/sorter.rs index 1537154fc724..93bf7f855fcb 100644 --- a/gtk4/src/subclass/sorter.rs +++ b/gtk4/src/subclass/sorter.rs @@ -7,7 +7,7 @@ use glib::{translate::*, Object}; use crate::{ffi, prelude::*, subclass::prelude::*, Ordering, Sorter, SorterOrder}; -pub trait SorterImpl: SorterImplExt + ObjectImpl { +pub trait SorterImpl: ObjectImpl + ObjectSubclass> { fn compare(&self, item1: &Object, item2: &Object) -> Ordering { self.parent_compare(item1, item2) } @@ -17,12 +17,7 @@ pub trait SorterImpl: SorterImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait SorterImplExt: sealed::Sealed + ObjectSubclass { +pub trait SorterImplExt: SorterImpl { fn parent_compare(&self, item1: &Object, item2: &Object) -> Ordering { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/style_context.rs b/gtk4/src/subclass/style_context.rs index b327d9285375..b1a24ce1fa67 100644 --- a/gtk4/src/subclass/style_context.rs +++ b/gtk4/src/subclass/style_context.rs @@ -9,20 +9,15 @@ use crate::{ffi, prelude::*, subclass::prelude::*, StyleContext}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait StyleContextImpl: StyleContextImplExt + ObjectImpl { +pub trait StyleContextImpl: ObjectImpl + ObjectSubclass> { fn changed(&self) { self.parent_changed() } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait StyleContextImplExt: sealed::Sealed + ObjectSubclass { +pub trait StyleContextImplExt: StyleContextImpl { fn parent_changed(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/symbolic_paintable.rs b/gtk4/src/subclass/symbolic_paintable.rs index e3d72c7fb668..110e3c7f0904 100644 --- a/gtk4/src/subclass/symbolic_paintable.rs +++ b/gtk4/src/subclass/symbolic_paintable.rs @@ -8,7 +8,9 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, SymbolicPaintable}; -pub trait SymbolicPaintableImpl: PaintableImpl { +pub trait SymbolicPaintableImpl: + PaintableImpl + ObjectSubclass> +{ fn snapshot_symbolic( &self, snapshot: &gdk::Snapshot, @@ -20,12 +22,7 @@ pub trait SymbolicPaintableImpl: PaintableImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait SymbolicPaintableImplExt: sealed::Sealed + ObjectSubclass { +pub trait SymbolicPaintableImplExt: SymbolicPaintableImpl { fn parent_snapshot_symbolic( &self, snapshot: &gdk::Snapshot, diff --git a/gtk4/src/subclass/text_buffer.rs b/gtk4/src/subclass/text_buffer.rs index 4d883506aa3e..8a7f4cf23b90 100644 --- a/gtk4/src/subclass/text_buffer.rs +++ b/gtk4/src/subclass/text_buffer.rs @@ -9,7 +9,7 @@ use crate::{ ffi, prelude::*, subclass::prelude::*, TextBuffer, TextChildAnchor, TextIter, TextMark, TextTag, }; -pub trait TextBufferImpl: TextBufferImplExt + ObjectImpl { +pub trait TextBufferImpl: ObjectImpl + ObjectSubclass> { fn apply_tag(&self, tag: &TextTag, start: &TextIter, end: &TextIter) { self.parent_apply_tag(tag, start, end) } @@ -57,12 +57,7 @@ pub trait TextBufferImpl: TextBufferImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait TextBufferImplExt: sealed::Sealed + ObjectSubclass { +pub trait TextBufferImplExt: TextBufferImpl { fn parent_apply_tag(&self, tag: &TextTag, start: &TextIter, end: &TextIter) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/text_view.rs b/gtk4/src/subclass/text_view.rs index 59d505bc87bb..b25738c9eac6 100644 --- a/gtk4/src/subclass/text_view.rs +++ b/gtk4/src/subclass/text_view.rs @@ -10,7 +10,7 @@ use crate::{ TextIter, TextView, TextViewLayer, }; -pub trait TextViewImpl: TextViewImplExt + WidgetImpl { +pub trait TextViewImpl: WidgetImpl + ObjectSubclass> { fn backspace(&self) { self.parent_backspace() } @@ -66,12 +66,7 @@ pub trait TextViewImpl: TextViewImplExt + WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait TextViewImplExt: sealed::Sealed + ObjectSubclass { +pub trait TextViewImplExt: TextViewImpl { fn parent_backspace(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/toggle_button.rs b/gtk4/src/subclass/toggle_button.rs index ad25b62d55f0..108c7e97e995 100644 --- a/gtk4/src/subclass/toggle_button.rs +++ b/gtk4/src/subclass/toggle_button.rs @@ -7,18 +7,13 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, ToggleButton}; -pub trait ToggleButtonImpl: ToggleButtonImplExt + ButtonImpl { +pub trait ToggleButtonImpl: ButtonImpl + ObjectSubclass> { fn toggled(&self) { self.parent_toggled() } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ToggleButtonImplExt: sealed::Sealed + ObjectSubclass { +pub trait ToggleButtonImplExt: ToggleButtonImpl { fn parent_toggled(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/tree_drag_dest.rs b/gtk4/src/subclass/tree_drag_dest.rs index 872c94dda14b..597d8b38a9d6 100644 --- a/gtk4/src/subclass/tree_drag_dest.rs +++ b/gtk4/src/subclass/tree_drag_dest.rs @@ -10,19 +10,14 @@ use crate::{ffi, prelude::*, subclass::prelude::*, TreeDragDest, TreePath}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait TreeDragDestImpl: ObjectImpl { +pub trait TreeDragDestImpl: ObjectImpl + ObjectSubclass> { fn drag_data_received(&self, dest: &TreePath, value: Value) -> bool; fn row_drop_possible(&self, dest: &TreePath, value: Value) -> bool; } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait TreeDragDestImplExt: sealed::Sealed + ObjectSubclass { +pub trait TreeDragDestImplExt: TreeDragDestImpl { fn parent_drag_data_received(&self, dest: &TreePath, value: Value) -> bool { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/tree_drag_source.rs b/gtk4/src/subclass/tree_drag_source.rs index 162bf6c73825..07b754fd2d5e 100644 --- a/gtk4/src/subclass/tree_drag_source.rs +++ b/gtk4/src/subclass/tree_drag_source.rs @@ -10,7 +10,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, TreeDragSource, TreePath}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait TreeDragSourceImpl: ObjectImpl { +pub trait TreeDragSourceImpl: ObjectImpl + ObjectSubclass> { fn row_draggable(&self, path: &TreePath) -> bool { self.parent_row_draggable(path) } @@ -18,14 +18,9 @@ pub trait TreeDragSourceImpl: ObjectImpl { fn drag_data_delete(&self, path: &TreePath) -> bool; } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait TreeDragSourceImplExt: sealed::Sealed + ObjectSubclass { +pub trait TreeDragSourceImplExt: TreeDragSourceImpl { // Returns true if the row can be dragged fn parent_row_draggable(&self, path: &TreePath) -> bool { unsafe { diff --git a/gtk4/src/subclass/tree_model_filter.rs b/gtk4/src/subclass/tree_model_filter.rs index 366994170fc6..a2b1d6d18190 100644 --- a/gtk4/src/subclass/tree_model_filter.rs +++ b/gtk4/src/subclass/tree_model_filter.rs @@ -9,7 +9,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, TreeIter, TreeModel, TreeMode #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait TreeModelFilterImpl: TreeModelFilterImplExt + ObjectImpl { +pub trait TreeModelFilterImpl: ObjectImpl + ObjectSubclass> { fn visible>(&self, child_model: &M, iter: &TreeIter) -> bool { self.parent_visible(child_model, iter) } @@ -25,14 +25,9 @@ pub trait TreeModelFilterImpl: TreeModelFilterImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait TreeModelFilterImplExt: sealed::Sealed + ObjectSubclass { +pub trait TreeModelFilterImplExt: TreeModelFilterImpl { // Whether the row indicated by iter is visible fn parent_visible>(&self, child_model: &M, iter: &TreeIter) -> bool { unsafe { diff --git a/gtk4/src/subclass/tree_view.rs b/gtk4/src/subclass/tree_view.rs index 1acf7f417a28..e05cfbbd1334 100644 --- a/gtk4/src/subclass/tree_view.rs +++ b/gtk4/src/subclass/tree_view.rs @@ -12,7 +12,7 @@ use crate::{ #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait TreeViewImpl: TreeViewImplExt + WidgetImpl { +pub trait TreeViewImpl: WidgetImpl + ObjectSubclass> { fn columns_changed(&self) { self.parent_columns_changed() } @@ -74,14 +74,9 @@ pub trait TreeViewImpl: TreeViewImplExt + WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] -pub trait TreeViewImplExt: sealed::Sealed + ObjectSubclass { +pub trait TreeViewImplExt: TreeViewImpl { fn parent_columns_changed(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/widget.rs b/gtk4/src/subclass/widget.rs index a771c73aeac5..b0b7cb3ee190 100644 --- a/gtk4/src/subclass/widget.rs +++ b/gtk4/src/subclass/widget.rs @@ -104,7 +104,7 @@ impl Iterator for WidgetActionIter { impl std::iter::FusedIterator for WidgetActionIter {} -pub trait WidgetImpl: WidgetImplExt + ObjectImpl { +pub trait WidgetImpl: ObjectImpl + ObjectSubclass> { fn compute_expand(&self, hexpand: &mut bool, vexpand: &mut bool) { self.parent_compute_expand(hexpand, vexpand) } @@ -207,12 +207,7 @@ pub trait WidgetImpl: WidgetImplExt + ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait WidgetImplExt: sealed::Sealed + ObjectSubclass { +pub trait WidgetImplExt: WidgetImpl { fn parent_compute_expand(&self, hexpand: &mut bool, vexpand: &mut bool) { unsafe { let data = Self::type_data(); @@ -1428,17 +1423,15 @@ pub trait CompositeTemplateInitializingExt { fn init_template(&self); } -impl CompositeTemplateInitializingExt for glib::subclass::InitializingObject -where - T: WidgetImpl + CompositeTemplate, - ::Type: IsA, +impl CompositeTemplateInitializingExt + for glib::subclass::InitializingObject { fn init_template(&self) { unsafe { let widget = self .as_ref() .unsafe_cast_ref::<::Type>(); - ffi::gtk_widget_init_template(widget.as_ref().to_glib_none().0); + ffi::gtk_widget_init_template(AsRef::::as_ref(widget).to_glib_none().0); ::check_template_children(widget); } @@ -1451,11 +1444,7 @@ pub trait CompositeTemplateDisposeExt { fn dispose_template(&self); } -impl CompositeTemplateDisposeExt for T -where - T: WidgetImpl + CompositeTemplate, - ::Type: IsA, -{ +impl CompositeTemplateDisposeExt for T { #[cfg(feature = "v4_8")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))] fn dispose_template(&self) { diff --git a/gtk4/src/subclass/window.rs b/gtk4/src/subclass/window.rs index 76b2636a2ad5..ba0cf77a3886 100644 --- a/gtk4/src/subclass/window.rs +++ b/gtk4/src/subclass/window.rs @@ -7,7 +7,7 @@ use glib::translate::*; use crate::{ffi, prelude::*, subclass::prelude::*, Window}; -pub trait WindowImpl: WindowImplExt + WidgetImpl { +pub trait WindowImpl: WidgetImpl + ObjectSubclass> { fn activate_focus(&self) { self.parent_activate_focus() } @@ -29,12 +29,7 @@ pub trait WindowImpl: WindowImplExt + WidgetImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait WindowImplExt: sealed::Sealed + ObjectSubclass { +pub trait WindowImplExt: WindowImpl { fn parent_activate_focus(&self) { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/window_group.rs b/gtk4/src/subclass/window_group.rs index 0ef941991362..97cea079e9dc 100644 --- a/gtk4/src/subclass/window_group.rs +++ b/gtk4/src/subclass/window_group.rs @@ -3,8 +3,8 @@ // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`WindowGroup`](crate::WindowGroup). -use crate::{subclass::prelude::*, WindowGroup}; +use crate::{prelude::*, subclass::prelude::*, WindowGroup}; -pub trait WindowGroupImpl: ObjectImpl {} +pub trait WindowGroupImpl: ObjectImpl + ObjectSubclass> {} unsafe impl IsSubclassable for WindowGroup {}