Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #308 from alatiera/alatiera/fix-subclass-typename
Browse files Browse the repository at this point in the history
basic_subclass: fix name of our GObject subclasss type
  • Loading branch information
GuillaumeGomez authored Apr 26, 2020
2 parents 2686f4b + 6dcd9c9 commit aa53d61
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/bin/basic_subclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct SimpleWindowPrivate {
}

impl ObjectSubclass for SimpleWindowPrivate {
const NAME: &'static str = "SimpleWindowPrivate";
const NAME: &'static str = "SimpleWindow";
type ParentType = gtk::ApplicationWindow;
type Instance = subclass::simple::InstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
Expand Down Expand Up @@ -139,7 +139,7 @@ pub struct SimpleApplicationPrivate {
}

impl ObjectSubclass for SimpleApplicationPrivate {
const NAME: &'static str = "SimpleApplicationPrivate";
const NAME: &'static str = "SimpleApplication";
type ParentType = gtk::Application;
type Instance = subclass::simple::InstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
Expand All @@ -165,10 +165,8 @@ impl ApplicationImpl for SimpleApplicationPrivate {
// `gio::Application::activate` is what gets called when the
// application is launched by the desktop environment and
// aksed to present itself.
fn activate(&self, app: &gio::Application) {
let app = app.downcast_ref::<gtk::Application>().unwrap();
let priv_ = SimpleApplicationPrivate::from_instance(app);
let window = priv_
fn activate(&self, _app: &gio::Application) {
let window = self
.window
.get()
.expect("Should always be initiliazed in gio_application_startup");
Expand All @@ -187,10 +185,8 @@ impl ApplicationImpl for SimpleApplicationPrivate {
self.parent_startup(app);

let app = app.downcast_ref::<gtk::Application>().unwrap();
let priv_ = SimpleApplicationPrivate::from_instance(app);
let window = SimpleWindow::new(&app);
priv_
.window
self.window
.set(window)
.expect("Failed to initialize application window");
}
Expand Down

0 comments on commit aa53d61

Please sign in to comment.