Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit 3c602a7

Browse files
committed
Update manual code
1 parent bdc519d commit 3c602a7

24 files changed

+30
-51
lines changed

examples/css/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ fn build_ui(application: &gtk::Application) {
3737
let label = gtk::Button::with_label("hover me!");
3838
// We need to name it in order to be able to use its name as a CSS label to
3939
// apply CSS on it.
40-
gtk::WidgetExt::set_widget_name(&label, "label1");
40+
label.set_widget_name("label1");
4141

4242
let entry = gtk::Entry::new();
4343
// We need to name it in order to apply CSS on it.
44-
gtk::WidgetExt::set_widget_name(&entry, "entry1");
44+
entry.set_widget_name("entry1");
4545
entry.set_text("Some text");
4646

4747
let combo = gtk::ComboBoxText::new();

examples/gio_task/file_size/ffi.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use gtk::glib::subclass::prelude::*;
22
use gtk::glib::translate::*;
3-
use gtk::prelude::AsyncResultExt;
4-
use gtk::prelude::Cast;
5-
use gtk::prelude::FileExt;
6-
use gtk::prelude::ToValue;
3+
use gtk::prelude::*;
74
use gtk::{gio, glib};
85

96
pub type FileSize = <super::imp::FileSize as ObjectSubclass>::Instance;

examples/gio_task/file_size/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ pub mod ffi;
22
mod imp;
33

44
use gtk::glib::subclass::prelude::*;
5-
use gtk::prelude::AsyncResultExt;
6-
use gtk::prelude::Cast;
7-
use gtk::prelude::FileExt;
8-
use gtk::prelude::ToValue;
5+
use gtk::prelude::*;
96
use gtk::{gio, glib};
107

118
glib::wrapper! {

examples/overlay/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn build_ui(application: &gtk::Application) {
2121
// The overlay label.
2222
let overlay_text = gtk::Label::new(Some("0"));
2323
// We need to name it in order to apply CSS on it.
24-
gtk::WidgetExt::set_widget_name(&overlay_text, "overlay-label");
24+
overlay_text.set_widget_name("overlay-label");
2525
// We put the overlay in the top-right corner of the window.
2626
overlay_text.set_halign(gtk::Align::End);
2727
overlay_text.set_valign(gtk::Align::Start);

gio/src/cancellable.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 crate::CancellableExt;
3+
use crate::prelude::*;
44

55
#[test]
66
fn check_callback() {

gio/src/file_enumerator.rs

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

3+
use crate::prelude::*;
34
use crate::FileEnumerator;
4-
use crate::FileEnumeratorExt;
55
use crate::FileInfo;
66
use std::iter::Iterator;
77

gio/src/gio_future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use futures_core::task::{Context, Poll};
55
use std::future::Future;
66
use std::pin::{self, Pin};
77

8+
use crate::prelude::*;
89
use crate::Cancellable;
9-
use crate::CancellableExt;
1010

1111
pub struct GioFuture<F, O, T, E> {
1212
obj: O,

gio/src/inet_address.rs

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

3+
use crate::prelude::*;
34
use crate::InetAddress;
4-
use crate::InetAddressExt;
55
use crate::SocketFamily;
66
use glib::object::IsA;
77
use glib::translate::*;

gio/src/inet_socket_address.rs

Lines changed: 1 addition & 1 deletion
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 crate::prelude::*;
34
use crate::InetAddress;
45
use crate::InetSocketAddress;
5-
use crate::InetSocketAddressExt;
66

77
use std::net::SocketAddr;
88

gio/src/input_stream.rs

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

33
use crate::error::to_std_io_result;
4+
use crate::prelude::*;
45
use crate::Cancellable;
56
use crate::InputStream;
67
use crate::Seekable;
7-
use crate::SeekableExt;
88
use futures_core::task::{Context, Poll};
99
use futures_io::{AsyncBufRead, AsyncRead};
1010
use glib::object::IsA;

gio/src/io_stream.rs

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

3-
use crate::pollable_input_stream::PollableInputStreamExtManual;
4-
use crate::pollable_output_stream::PollableOutputStreamExtManual;
3+
use crate::prelude::*;
54
use crate::IOStream;
6-
use crate::IOStreamExt;
75
use crate::InputStreamAsyncRead;
86
use crate::OutputStreamAsyncWrite;
97
use crate::PollableInputStream;

gio/src/output_stream.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::prelude::*;
55
use crate::Cancellable;
66
use crate::OutputStream;
77
use crate::Seekable;
8-
use crate::SeekableExt;
98
use glib::object::IsA;
109
use glib::translate::*;
1110
use glib::Priority;

gio/src/pollable_input_stream.rs

Lines changed: 1 addition & 1 deletion
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 crate::prelude::*;
34
use crate::Cancellable;
45
use crate::PollableInputStream;
5-
use crate::PollableInputStreamExt;
66
use futures_core::task::{Context, Poll};
77
use futures_io::AsyncRead;
88
use glib::object::{Cast, IsA};

gio/src/pollable_output_stream.rs

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

33
use crate::error::to_std_io_result;
4+
use crate::prelude::*;
45
use crate::Cancellable;
5-
use crate::OutputStreamExt;
66
use crate::PollableOutputStream;
7-
use crate::PollableOutputStreamExt;
87
use futures_channel::oneshot;
98
use futures_core::task::{Context, Poll};
109
use futures_core::Future;

gio/src/settings.rs

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

3-
use crate::{Settings, SettingsBindFlags, SettingsExt};
4-
use glib::prelude::*;
3+
use crate::prelude::*;
4+
use crate::{Settings, SettingsBindFlags};
55
use glib::translate::{from_glib_borrow, from_glib_none, ToGlib, ToGlibPtr};
66
use glib::variant::FromVariant;
77
use glib::{BoolError, IsA, ToVariant};

gio/src/task.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ impl Task {
9090
#[cfg(test)]
9191
mod test {
9292
use super::*;
93+
use crate::prelude::*;
9394
use crate::test_util::run_async_local;
94-
use crate::CancellableExt;
95-
use glib::Cast;
96-
use glib::ToValue;
9795

9896
#[test]
9997
fn test_int_async_result() {

gio/src/tls_connection.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

33
#[cfg(any(feature = "v2_66", feature = "dox"))]
4-
use crate::auto::TlsChannelBindingType;
5-
use crate::auto::TlsConnection;
4+
use crate::TlsChannelBindingType;
5+
use crate::TlsConnection;
66
#[cfg(any(feature = "v2_66", feature = "dox"))]
77
use glib::translate::*;
88
use glib::IsA;

gio/src/unix_socket_address.rs

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

3+
use crate::prelude::*;
34
use crate::SocketAddress;
45
use crate::UnixSocketAddress;
5-
use crate::UnixSocketAddressExt;
66
use crate::UnixSocketAddressType;
7-
use glib::object::{Cast, IsA};
87
use glib::translate::*;
98
#[cfg(not(feature = "dox"))]
109
use std::ffi::OsStr;

gtk/src/application.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
use crate::rt;
44
use crate::Application;
5-
use gio::ApplicationExt;
5+
use gio::prelude::*;
66
use gio::ApplicationFlags;
77
use glib::signal::SignalHandlerId;
88
use glib::translate::*;
9-
use glib::ObjectExt;
109

1110
use std::cell::RefCell;
1211
use std::rc::Rc;

gtk/src/builder.rs

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

33
use crate::Builder;
4-
use glib::object::{Cast, IsA};
4+
use glib::prelude::*;
55
use glib::translate::*;
66
use glib::GString;
77
use glib::Object;
8-
use glib::ObjectExt;
98
use std::path::Path;
109

1110
impl Builder {

gtk/src/dialog.rs

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

3-
use crate::auto::DialogExt;
3+
use crate::prelude::*;
44
use crate::Dialog;
55
use crate::DialogFlags;
66
use crate::ResponseType;
77
use crate::Widget;
8-
use crate::WidgetExt;
98
use crate::Window;
10-
use glib::object::Cast;
119
use glib::translate::*;
12-
use glib::IsA;
13-
use glib::ObjectExt;
1410
use std::cell::Cell;
1511
use std::future::Future;
1612
use std::pin::Pin;

gtk/src/style_context.rs

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

33
use crate::StateFlags;
44
use crate::StyleContext;
5-
use crate::StyleContextExt;
6-
use glib::object::IsA;
5+
use glib::prelude::*;
76
use pango::FontDescription;
87

98
pub trait StyleContextExtManual: 'static {
@@ -12,7 +11,7 @@ pub trait StyleContextExtManual: 'static {
1211

1312
impl<O: IsA<StyleContext>> StyleContextExtManual for O {
1413
fn font(&self, state: StateFlags) -> FontDescription {
15-
self.property("font", state)
14+
<Self as crate::prelude::StyleContextExt>::property(self, "font", state)
1615
.get()
1716
.expect("font property is not pango::FontDescription")
1817
}

gtk/src/subclass/widget.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ use glib::translate::*;
77

88
use glib::prelude::*;
99
use glib::subclass::prelude::*;
10-
use glib::{Cast, Object};
10+
use glib::Object;
1111

12+
use crate::prelude::*;
1213
use crate::Allocation;
1314
use crate::DragResult;
1415
use crate::Inhibit;
@@ -17,7 +18,6 @@ use crate::SelectionData;
1718
use crate::SizeRequestMode;
1819
use crate::TextDirection;
1920
use crate::Widget;
20-
use crate::WidgetExt;
2121

2222
pub trait WidgetImpl: WidgetImplExt + ObjectImpl {
2323
fn adjust_baseline_allocation(&self, widget: &Self::Type, baseline: &mut i32) {

gtk/src/widget.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
22

33
use gdk::{DragAction, Event, ModifierType};
44
use glib::ffi::gboolean;
5-
use glib::object::{Cast, IsA, WeakRef};
65
use glib::signal::{connect_raw, Inhibit, SignalHandlerId};
76
use glib::translate::*;
87
use glib::Continue;
9-
use glib::ObjectExt;
108
use std::mem::transmute;
119
use std::ptr;
1210

13-
use crate::{DestDefaults, Rectangle, TargetEntry, Widget, WidgetExt};
11+
use crate::prelude::*;
12+
use crate::{DestDefaults, Rectangle, TargetEntry, Widget};
1413

1514
pub struct TickCallbackId {
1615
id: u32,
17-
widget: WeakRef<Widget>,
16+
widget: glib::WeakRef<Widget>,
1817
}
1918

2019
impl TickCallbackId {

0 commit comments

Comments
 (0)