Skip to content

Commit

Permalink
fix(gtk): Fix the waiting progress label
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Aug 13, 2019
1 parent 7e52066 commit 776253d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.cargo/
.vscode
.idea
vendor
vendor.tar.xz
target
ffi/examples/c/build/
ffi/target
ffi/target
3 changes: 2 additions & 1 deletion gtk/src/dialogs/fwupd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ pub(crate) fn fwupd_dialog(
// Exchange the button for a progress bar.
if let (Some(stack), Some(progress)) = (stack.upgrade(), progress.upgrade()) {
stack.set_visible_child(&progress);
progress.set_text("Queued for update".into());
progress.set_text("Waiting".into());
progress.set_fraction(0.0);
}

let _ = sender.send(FirmwareEvent::Fwupd(
Expand Down
3 changes: 2 additions & 1 deletion gtk/src/dialogs/system76.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ pub(crate) fn s76_system_dialog(data: &System76DialogData, upgradeable: bool, ha
// Exchange the button for a progress bar.
if let (Some(stack), Some(progress)) = (stack.upgrade(), progress.upgrade()) {
stack.set_visible_child(&progress);
progress.set_text("Queued for update".into());
progress.set_text("Waiting".into());
progress.set_fraction(0.0);
}

let event = FirmwareEvent::S76System(*entity, digest.clone(), latest.clone());
Expand Down
1 change: 1 addition & 0 deletions gtk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl FirmwareWidget {
let info_bar_label = cascade! {
gtk::Label::new(None);
..set_line_wrap(true);
..show();
};

let info_bar = cascade! {
Expand Down
2 changes: 2 additions & 0 deletions gtk/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ impl State {
// Exchange the button for a progress bar.
if let (Some(stack), Some(progress)) = (stack.upgrade(), progress.upgrade()) {
stack.set_visible_child(&progress);
progress.set_text("Waiting".into());
progress.set_fraction(0.0);
let _ = tx_progress.send(ActivateEvent::Activate(progress));
}

Expand Down
1 change: 1 addition & 0 deletions gtk/src/views/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl DevicesView {
gtk::Box::new(gtk::Orientation::Vertical, 12);
..set_halign(gtk::Align::Center);
..set_margin_top(24);
..set_margin_bottom(24);
..add(&system_header);
..add(&system_firmware);
..add(&device_header);
Expand Down
10 changes: 1 addition & 9 deletions gtk/src/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,6 @@ impl DeviceWidget {

/// Activates when the widget's container's button is clicked.
pub fn connect_upgrade_clicked<F: Fn() + 'static>(&self, func: F) {
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();
});
self.button.connect_clicked(move |_| func());
}
}

0 comments on commit 776253d

Please sign in to comment.