Browse Source

Some import adjustments

Getty Ritter 3 years ago
parent
commit
e0ebe67aef
1 changed files with 7 additions and 9 deletions
  1. 7 9
      src/main.rs

+ 7 - 9
src/main.rs

@@ -1,9 +1,6 @@
 use anyhow::{anyhow, bail, Result};
 use gio::prelude::{ApplicationExt, ApplicationExtManual};
-use gtk::{
-    Application, ApplicationWindow, BoxExt, Button, ButtonExt, ContainerExt, GtkWindowExt,
-    WidgetExt,
-};
+use gtk::{BoxExt, ButtonExt, ContainerExt, GtkWindowExt, WidgetExt};
 use std::cell::RefCell;
 use std::rc::Rc;
 
@@ -59,12 +56,13 @@ impl App {
     }
 }
 
-fn mk_app(app: &gtk::Application) {
-    let window = ApplicationWindow::new(app);
-
+fn mk_app(gtk_app: &gtk::Application) {
     let app = App::new();
+    let window = gtk::ApplicationWindow::new(gtk_app);
 
     window.set_title("I Am Legend");
+    window.set_default_size(300, 100);
+    window.set_resizable(false);
     let container = gtk::Box::new(gtk::Orientation::Vertical, 4);
     container.pack_start(&mk_icon_choice('A', app.clone()), false, true, 0);
     container.pack_start(&mk_icon_choice('B', app.clone()), false, true, 0);
@@ -73,7 +71,7 @@ fn mk_app(app: &gtk::Application) {
 
     let flow = gtk::Box::new(gtk::Orientation::Horizontal, 2);
     flow.pack_start(&container, false, true, 0);
-    let button = Button::with_label("Click me!");
+    let button = gtk::Button::with_label("Click me!");
     flow.pack_start(&button, false, true, 0);
 
     let canvas = gtk::DrawingArea::new();
@@ -107,7 +105,7 @@ fn mk_icon_choice(choice: char, cell: App) -> gtk::Button {
 
 fn main() {
     let application =
-        Application::new(Some("com.github.gtk-rs.examples.basic"), Default::default())
+        gtk::Application::new(Some("com.github.gtk-rs.examples.basic"), Default::default())
             .expect("failed to initialize GTK application");
 
     application.connect_activate(|app| {