small cleanups
This commit is contained in:
parent
3a23f6cabf
commit
0a429a2080
12
src/main.rs
12
src/main.rs
|
@ -62,7 +62,7 @@ impl Debug for RuntimeMsg {
|
||||||
#[derive(Clone, Msg)]
|
#[derive(Clone, Msg)]
|
||||||
pub enum Msg {
|
pub enum Msg {
|
||||||
Quit,
|
Quit,
|
||||||
Clicked,
|
Request,
|
||||||
UpdateText(String),
|
UpdateText(String),
|
||||||
Working(bool),
|
Working(bool),
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ impl Widget for Win {
|
||||||
fn update(&mut self, event: Msg) {
|
fn update(&mut self, event: Msg) {
|
||||||
match event {
|
match event {
|
||||||
Msg::Quit => gtk::main_quit(),
|
Msg::Quit => gtk::main_quit(),
|
||||||
Msg::Clicked => {
|
Msg::Request => {
|
||||||
let msg = RuntimeMsg {
|
let msg = RuntimeMsg {
|
||||||
url: self.widgets.input.text().to_string(),
|
url: self.widgets.input.text().to_string(),
|
||||||
sender: self.model.sender.clone(),
|
sender: self.model.sender.clone(),
|
||||||
|
@ -108,14 +108,16 @@ impl Widget for Win {
|
||||||
orientation: Orientation::Vertical,
|
orientation: Orientation::Vertical,
|
||||||
|
|
||||||
#[name = "input"]
|
#[name = "input"]
|
||||||
gtk::Entry {},
|
gtk::Entry {
|
||||||
|
activate => Msg::Request,
|
||||||
|
},
|
||||||
|
|
||||||
gtk::Box {
|
gtk::Box {
|
||||||
orientation: Orientation::Horizontal,
|
orientation: Orientation::Horizontal,
|
||||||
gtk::Button {
|
gtk::Button {
|
||||||
label: "Test",
|
label: "Request!",
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
clicked => Msg::Clicked,
|
clicked => Msg::Request,
|
||||||
},
|
},
|
||||||
gtk::Spinner {
|
gtk::Spinner {
|
||||||
active: self.model.working,
|
active: self.model.working,
|
||||||
|
|
Loading…
Reference in a new issue