From b9e56ec6467271cbe7e4d00c3f4faa0cf0da0f3f Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Wed, 3 Jan 2024 08:47:22 +0100 Subject: [PATCH] Adapt to https://github.com/gtk-rs/gir/pull/1530 --- gdk4/src/toplevel_size.rs | 25 ++++++++++--------------- gtk4/src/subclass/constraint_target.rs | 15 --------------- gtk4/src/subclass/mod.rs | 6 ------ gtk4/src/subclass/native.rs | 10 ---------- gtk4/src/subclass/root.rs | 10 ---------- 5 files changed, 10 insertions(+), 56 deletions(-) delete mode 100644 gtk4/src/subclass/constraint_target.rs delete mode 100644 gtk4/src/subclass/native.rs delete mode 100644 gtk4/src/subclass/root.rs diff --git a/gdk4/src/toplevel_size.rs b/gdk4/src/toplevel_size.rs index f6669c87c272..3e7e02daf20e 100644 --- a/gdk4/src/toplevel_size.rs +++ b/gdk4/src/toplevel_size.rs @@ -4,15 +4,16 @@ use std::fmt; use glib::translate::*; -glib::wrapper! { +use std::ptr::NonNull; +#[repr(transparent)] #[doc(alias = "GdkToplevelSize")] - pub struct ToplevelSize(BoxedInline); +pub struct ToplevelSize(NonNull); - match fn { - type_ => || ffi::gdk_toplevel_size_get_type(), +impl glib::StaticType for ToplevelSize { + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::gdk_toplevel_size_get_type()) } } - } impl ToplevelSize { @@ -24,7 +25,7 @@ impl ToplevelSize { let mut bounds_height = std::mem::MaybeUninit::uninit(); ffi::gdk_toplevel_size_get_bounds( - self.to_glib_none().0 as *mut _, + self.0.as_ptr(), bounds_width.as_mut_ptr(), bounds_height.as_mut_ptr(), ); @@ -35,27 +36,21 @@ impl ToplevelSize { #[doc(alias = "gdk_toplevel_size_set_min_size")] pub fn set_min_size(&mut self, min_width: i32, min_height: i32) { unsafe { - ffi::gdk_toplevel_size_set_min_size(self.to_glib_none_mut().0, min_width, min_height); + ffi::gdk_toplevel_size_set_min_size(self.0.as_mut(), min_width, min_height); } } #[doc(alias = "gdk_toplevel_size_set_shadow_width")] pub fn set_shadow_width(&mut self, left: i32, right: i32, top: i32, bottom: i32) { unsafe { - ffi::gdk_toplevel_size_set_shadow_width( - self.to_glib_none_mut().0, - left, - right, - top, - bottom, - ); + ffi::gdk_toplevel_size_set_shadow_width(self.0.as_mut(), left, right, top, bottom); } } #[doc(alias = "gdk_toplevel_size_set_size")] pub fn set_size(&mut self, width: i32, height: i32) { unsafe { - ffi::gdk_toplevel_size_set_size(self.to_glib_none_mut().0, width, height); + ffi::gdk_toplevel_size_set_size(self.0.as_mut(), width, height); } } } diff --git a/gtk4/src/subclass/constraint_target.rs b/gtk4/src/subclass/constraint_target.rs deleted file mode 100644 index 87dd746c3b54..000000000000 --- a/gtk4/src/subclass/constraint_target.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Take a look at the license at the top of the repository in the LICENSE file. - -// rustdoc-stripper-ignore-next -//! Traits intended for implementing the -//! [`ConstraintTarget`](crate::ConstraintTarget) interface. - -use crate::{subclass::prelude::*, ConstraintTarget}; - -pub trait ConstraintTargetImpl: ObjectImpl {} - -unsafe impl IsImplementable for ConstraintTarget { - fn interface_init(_iface: &mut glib::Interface) { - assert_initialized_main_thread!(); - } -} diff --git a/gtk4/src/subclass/mod.rs b/gtk4/src/subclass/mod.rs index 03a491a792f1..2acf05ff3294 100644 --- a/gtk4/src/subclass/mod.rs +++ b/gtk4/src/subclass/mod.rs @@ -37,7 +37,6 @@ pub mod cell_renderer_text; pub mod check_button; pub mod color_chooser; pub mod combo_box; -pub mod constraint_target; pub mod dialog; pub mod drawing_area; pub mod editable; @@ -56,7 +55,6 @@ pub mod layout_manager; pub mod list_box_row; pub mod media_file; pub mod media_stream; -pub mod native; pub mod native_dialog; pub mod orientable; pub mod popover; @@ -64,7 +62,6 @@ pub mod print_operation; pub mod print_operation_preview; pub mod range; pub mod recent_manager; -pub mod root; pub mod scale; pub mod scale_button; pub mod scrollable; @@ -126,7 +123,6 @@ pub mod prelude { check_button::{CheckButtonImpl, CheckButtonImplExt}, color_chooser::{ColorChooserImpl, ColorChooserImplExt}, combo_box::{ComboBoxImpl, ComboBoxImplExt}, - constraint_target::ConstraintTargetImpl, dialog::{DialogImpl, DialogImplExt}, drawing_area::{DrawingAreaImpl, DrawingAreaImplExt}, editable::{EditableImpl, EditableImplExt}, @@ -145,7 +141,6 @@ pub mod prelude { list_box_row::{ListBoxRowImpl, ListBoxRowImplExt}, media_file::{MediaFileImpl, MediaFileImplExt}, media_stream::{MediaStreamImpl, MediaStreamImplExt}, - native::NativeImpl, native_dialog::{NativeDialogImpl, NativeDialogImplExt}, orientable::OrientableImpl, popover::{PopoverImpl, PopoverImplExt}, @@ -153,7 +148,6 @@ pub mod prelude { print_operation_preview::PrintOperationPreviewImpl, range::{RangeImpl, RangeImplExt}, recent_manager::{RecentManagerImpl, RecentManagerImplExt}, - root::RootImpl, scale::{ScaleImpl, ScaleImplExt}, scale_button::{ScaleButtonImpl, ScaleButtonImplExt}, scrollable::{ScrollableImpl, ScrollableImplExt}, diff --git a/gtk4/src/subclass/native.rs b/gtk4/src/subclass/native.rs deleted file mode 100644 index 719a8274d7eb..000000000000 --- a/gtk4/src/subclass/native.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Take a look at the license at the top of the repository in the LICENSE file. - -// rustdoc-stripper-ignore-next -//! Traits intended for implementing the [`Native`](crate::Native) interface. - -use crate::{subclass::prelude::*, Native}; - -pub trait NativeImpl: WidgetImpl {} - -unsafe impl IsImplementable for Native {} diff --git a/gtk4/src/subclass/root.rs b/gtk4/src/subclass/root.rs deleted file mode 100644 index 7a963a7052d5..000000000000 --- a/gtk4/src/subclass/root.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Take a look at the license at the top of the repository in the LICENSE file. - -// rustdoc-stripper-ignore-next -//! Traits intended for implementing the [`Root`](crate::Root) interface. - -use crate::{subclass::prelude::*, Root}; - -pub trait RootImpl: NativeImpl {} - -unsafe impl IsImplementable for Root {}