Skip to content

Commit

Permalink
Merge pull request #200 from martinling/main
Browse files Browse the repository at this point in the history
Fix STOP not being cleared after loading or saving a file.
  • Loading branch information
miek authored Oct 11, 2024
2 parents 674ecbf + c9178ff commit 107657d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ fn start_pcap(action: FileAction, file: gio::File) -> Result<(), Error> {
);
}
display_error(result);
gtk::glib::idle_add_once(|| display_error(stop_operation()));
gtk::glib::idle_add_once(|| display_error(rearm()));
});
gtk::glib::timeout_add_once(
UPDATE_INTERVAL,
Expand Down Expand Up @@ -1102,6 +1102,14 @@ pub fn stop_operation() -> Result<(), Error> {
stop_handle.stop()?;
}
};
Ok(())
})
}

pub fn rearm() -> Result<(), Error> {
with_ui(|ui| {
STOP.store(false, Ordering::Relaxed);
ui.stop_state = StopState::Disabled;
ui.stop_button.set_sensitive(false);
ui.scan_button.set_sensitive(true);
ui.save_button.set_sensitive(true);
Expand Down Expand Up @@ -1158,7 +1166,7 @@ pub fn start_capture() -> Result<(), Error> {
};
std::thread::spawn(move || {
display_error(read_packets());
gtk::glib::idle_add_once(|| display_error(stop_operation()));
gtk::glib::idle_add_once(|| display_error(rearm()));
});
gtk::glib::timeout_add_once(
UPDATE_INTERVAL,
Expand Down

0 comments on commit 107657d

Please sign in to comment.