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

Commit 36c75dd

Browse files
committed
Replace Foo::from_instance(foo) with foo.imp()
1 parent d9208b8 commit 36c75dd

File tree

4 files changed

+6
-6
lines changed
  • examples
    • basic_subclass
    • composite_template/example_application_window
    • list_box_model/model

4 files changed

+6
-6
lines changed

examples/basic_subclass/simple_application/imp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl ApplicationImpl for SimpleApplication {
2929
/// aksed to present itself.
3030
fn activate(&self, app: &Self::Type) {
3131
let app = app.downcast_ref::<super::SimpleApplication>().unwrap();
32-
let priv_ = SimpleApplication::from_instance(app);
32+
let priv_ = app.imp();
3333
let window = priv_
3434
.window
3535
.get()
@@ -49,7 +49,7 @@ impl ApplicationImpl for SimpleApplication {
4949
self.parent_startup(app);
5050

5151
let app = app.downcast_ref::<super::SimpleApplication>().unwrap();
52-
let priv_ = SimpleApplication::from_instance(app);
52+
let priv_ = app.imp();
5353
let window = SimpleWindow::new(app);
5454
priv_
5555
.window

examples/basic_subclass/simple_window/imp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl ObjectImpl for SimpleWindow {
4141
// Connect our method `on_increment_clicked` to be called
4242
// when the increment button is clicked.
4343
increment.connect_clicked(clone!(@weak obj => move |_| {
44-
let priv_ = SimpleWindow::from_instance(&obj);
44+
let priv_ = obj.imp();
4545
priv_.on_increment_clicked();
4646
}));
4747

examples/composite_template/example_application_window/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl ExampleApplicationWindow {
1818
fn init_label(&self) {
1919
// To access fields such as template children, you must get
2020
// the private struct.
21-
let self_ = imp::ExampleApplicationWindow::from_instance(self);
21+
let self_ = self.imp();
2222
self_
2323
.subtitle
2424
.set_text("This is an example window made using composite templates");

examples/list_box_model/model/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl Model {
1919
}
2020

2121
pub fn append(&self, obj: &RowData) {
22-
let self_ = imp::Model::from_instance(self);
22+
let self_ = self.imp();
2323
let index = {
2424
// Borrow the data only once and ensure the borrow guard is dropped
2525
// before we emit the items_changed signal because the view
@@ -33,7 +33,7 @@ impl Model {
3333
}
3434

3535
pub fn remove(&self, index: u32) {
36-
let self_ = imp::Model::from_instance(self);
36+
let self_ = self.imp();
3737
self_.0.borrow_mut().remove(index as usize);
3838
// Emits a signal that 1 item was removed, 0 added at the position index
3939
self.items_changed(index, 1, 0);

0 commit comments

Comments
 (0)