Skip to content

Commit

Permalink
fix(gtk): Default progress bars to "Waiting" after click
Browse files Browse the repository at this point in the history
Closes #21
  • Loading branch information
mmstick committed Aug 13, 2019
1 parent 3ff90e9 commit 7c71e09
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gtk/src/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ impl DeviceWidget {

/// Activates when the widget's container's button is clicked.
pub fn connect_upgrade_clicked<F: Fn() + 'static>(&self, func: F) {
self.button.connect_clicked(move |_| func());
let progress = self.progress.downgrade();
self.button.connect_clicked(move |_| {
if let Some(progress) = progress.upgrade() {
progress.set_text("Waiting".into());
progress.set_fraction(0.0);
}

func();
});
}
}

0 comments on commit 7c71e09

Please sign in to comment.