Skip to content

Commit 1d3b10d

Browse files
Adapt to glib prelude cleanup
1 parent f72d766 commit 1d3b10d

21 files changed

+67
-78
lines changed

Cargo.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gdk4/src/drag_surface_size.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
use std::ptr::NonNull;
4-
3+
use crate::prelude::*;
54
use glib::translate::*;
65

76
#[repr(transparent)]
87
#[doc(alias = "GdkDragSurfaceSize")]
9-
pub struct DragSurfaceSize(NonNull<ffi::GdkDragSurfaceSize>);
8+
pub struct DragSurfaceSize(std::ptr::NonNull<ffi::GdkDragSurfaceSize>);
109

11-
impl glib::StaticType for DragSurfaceSize {
10+
impl StaticType for DragSurfaceSize {
1211
fn static_type() -> glib::Type {
1312
unsafe { from_glib(ffi::gdk_drag_surface_size_get_type()) }
1413
}

gdk4/src/drop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
use std::{future, pin::Pin, ptr};
44

5-
use glib::{object::IsA, translate::*, GString};
5+
use glib::{translate::*, GString};
66

7-
use crate::Drop;
7+
use crate::{prelude::*, Drop};
88

99
impl Drop {
1010
#[doc(alias = "gdk_drop_read_async")]

gdk4/src/event.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
use std::{fmt, mem};
3+
use glib::translate::*;
44

5-
use glib::{translate::*, StaticType};
6-
7-
use crate::{Event, EventType};
5+
use crate::{prelude::*, Event, EventType};
86

97
impl Event {
108
#[inline]
@@ -47,7 +45,7 @@ impl Event {
4745
pub fn angle(&self, event: impl AsRef<Event>) -> Option<f64> {
4846
skip_assert_initialized!();
4947
unsafe {
50-
let mut angle = mem::MaybeUninit::uninit();
48+
let mut angle = std::mem::MaybeUninit::uninit();
5149
let ret = from_glib(ffi::gdk_events_get_angle(
5250
self.to_glib_none().0,
5351
event.as_ref().to_glib_none().0,
@@ -67,8 +65,8 @@ impl Event {
6765
pub fn center(&self, event: impl AsRef<Event>) -> Option<(f64, f64)> {
6866
skip_assert_initialized!();
6967
unsafe {
70-
let mut x = mem::MaybeUninit::uninit();
71-
let mut y = mem::MaybeUninit::uninit();
68+
let mut x = std::mem::MaybeUninit::uninit();
69+
let mut y = std::mem::MaybeUninit::uninit();
7270
let ret = from_glib(ffi::gdk_events_get_center(
7371
self.to_glib_none().0,
7472
event.as_ref().to_glib_none().0,
@@ -90,7 +88,7 @@ impl Event {
9088
pub fn distance(&self, event: impl AsRef<Event>) -> Option<f64> {
9189
skip_assert_initialized!();
9290
unsafe {
93-
let mut distance = mem::MaybeUninit::uninit();
91+
let mut distance = std::mem::MaybeUninit::uninit();
9492
let ret = from_glib(ffi::gdk_events_get_distance(
9593
self.to_glib_none().0,
9694
event.as_ref().to_glib_none().0,
@@ -106,8 +104,8 @@ impl Event {
106104
}
107105
}
108106

109-
impl fmt::Debug for Event {
110-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
107+
impl std::fmt::Debug for Event {
108+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
111109
f.debug_struct("Event")
112110
.field("event_type", &self.event_type())
113111
.field("history", &self.history())

gdk4/src/keys.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
use glib::{translate::*, value::*, GString, IntoGStr, Type, Value};
3+
use crate::prelude::*;
4+
use glib::{translate::*, value::FromValue, GString, Type, Value};
45

56
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
67
// rustdoc-stripper-ignore-next
@@ -4708,7 +4709,7 @@ impl From<Key> for Value {
47084709
}
47094710

47104711
// TODO: Drop once https://github.com/gtk-rs/gtk-rs-core/issues/612
4711-
impl glib::StaticType for Key {
4712+
impl StaticType for Key {
47124713
#[inline]
47134714
fn static_type() -> Type {
47144715
Type::U32

gdk4/src/toplevel_size.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
use std::fmt;
4-
3+
use crate::prelude::*;
54
use glib::translate::*;
65

7-
use std::ptr::NonNull;
8-
96
#[repr(transparent)]
107
#[doc(alias = "GdkToplevelSize")]
11-
pub struct ToplevelSize(NonNull<ffi::GdkToplevelSize>);
8+
pub struct ToplevelSize(std::ptr::NonNull<ffi::GdkToplevelSize>);
129

13-
impl glib::StaticType for ToplevelSize {
10+
impl StaticType for ToplevelSize {
1411
fn static_type() -> glib::Type {
1512
unsafe { from_glib(ffi::gdk_toplevel_size_get_type()) }
1613
}
@@ -55,8 +52,8 @@ impl ToplevelSize {
5552
}
5653
}
5754

58-
impl fmt::Debug for ToplevelSize {
59-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
55+
impl std::fmt::Debug for ToplevelSize {
56+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6057
f.debug_struct("ToplevelSize")
6158
.field("bounds", &self.bounds())
6259
.finish()

gsk4/src/render_node.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
use glib::{translate::*, StaticType};
3+
use glib::translate::*;
44

5-
use crate::{ParseLocation, RenderNode, RenderNodeType};
5+
use crate::{prelude::*, ParseLocation, RenderNode, RenderNodeType};
66

77
impl RenderNode {
88
#[inline]
@@ -202,7 +202,7 @@ macro_rules! define_render_node {
202202

203203
#[inline]
204204
fn value_type(&self) -> glib::Type {
205-
use glib::StaticType;
205+
use glib::prelude::StaticType;
206206
Self::static_type()
207207
}
208208
}

gtk4-macros/src/composite_template_derive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ fn gen_template_child_type_checks(fields: &[AttributedField]) -> TokenStream {
164164
let ident = &field.ident;
165165
let type_err = format!("Template child with id `{}` has incompatible type. XML has {{:?}}, struct has {{:?}}", field.id());
166166
quote! {
167-
let ty = <<#ty as ::std::ops::Deref>::Target as #crate_ident::glib::StaticType>::static_type();
168-
let child_ty = #crate_ident::glib::object::ObjectExt::type_(::std::ops::Deref::deref(&imp.#ident));
167+
let ty = <<#ty as ::std::ops::Deref>::Target as #crate_ident::glib::prelude::StaticType>::static_type();
168+
let child_ty = #crate_ident::glib::prelude::ObjectExt::type_(::std::ops::Deref::deref(&imp.#ident));
169169
if !child_ty.is_a(ty) {
170170
panic!(#type_err, child_ty, ty);
171171
}

gtk4/src/cell_area.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
use glib::{translate::*, value::FromValue, IntoGStr, Value};
3+
use glib::{translate::*, value::FromValue, Value};
44

55
use crate::{prelude::*, CellArea, CellRenderer};
66

gtk4/src/closure_expression.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
use glib::{translate::*, value::ValueType, StaticType, Value};
3+
use glib::{translate::*, Value};
44

5-
use crate::{ClosureExpression, Expression};
5+
use crate::{prelude::*, ClosureExpression, Expression};
66

77
define_expression!(ClosureExpression, ffi::GtkClosureExpression);
88

0 commit comments

Comments
 (0)