MCPcopy Index your code
hub / github.com/encounter/objdiff / pre_update

Method pre_update

objdiff-gui/src/views/config.rs:55–108  ·  view source on GitHub ↗
(&mut self, jobs: &mut JobQueue, state: &AppStateRef)

Source from the content-addressed store, hash-verified

53
54impl ConfigViewState {
55 pub fn pre_update(&mut self, jobs: &mut JobQueue, state: &AppStateRef) {
56 jobs.results.retain_mut(|result| {
57 if let JobResult::CheckUpdate(result) = result {
58 self.check_update = take(result);
59 false
60 } else {
61 true
62 }
63 });
64 self.build_running = jobs.is_running(Job::ObjDiff);
65 self.check_update_running = jobs.is_running(Job::CheckUpdate);
66 self.update_running = jobs.is_running(Job::Update);
67
68 // Check async file dialog results
69 match self.file_dialog_state.poll() {
70 FileDialogResult::None => {}
71 FileDialogResult::ProjectDir(path) => {
72 let mut guard = state.write().unwrap();
73 guard.set_project_dir(path.to_path_buf());
74 }
75 FileDialogResult::TargetDir(path) => {
76 let mut guard = state.write().unwrap();
77 guard.set_target_obj_dir(path.to_path_buf());
78 }
79 FileDialogResult::BaseDir(path) => {
80 let mut guard = state.write().unwrap();
81 guard.set_base_obj_dir(path.to_path_buf());
82 }
83 FileDialogResult::Object(path) => {
84 let mut guard = state.write().unwrap();
85 if let (Some(base_dir), Some(target_dir)) =
86 (&guard.config.base_obj_dir, &guard.config.target_obj_dir)
87 {
88 if let Ok(obj_path) = path.strip_prefix(base_dir) {
89 let target_path = target_dir.join(obj_path);
90 guard.set_selected_obj(ObjectConfig {
91 name: obj_path.to_string(),
92 target_path: Some(target_path),
93 base_path: Some(path),
94 ..Default::default()
95 });
96 } else if let Ok(obj_path) = path.strip_prefix(target_dir) {
97 let base_path = base_dir.join(obj_path);
98 guard.set_selected_obj(ObjectConfig {
99 name: obj_path.to_string(),
100 target_path: Some(path),
101 base_path: Some(base_path),
102 ..Default::default()
103 });
104 }
105 }
106 }
107 }
108 }
109
110 pub fn post_update(&mut self, ctx: &egui::Context, jobs: &mut JobQueue, state: &AppStateRef) {
111 if self.queue_build {

Callers

nothing calls this directly

Calls 7

is_runningMethod · 0.80
pollMethod · 0.80
set_project_dirMethod · 0.80
set_target_obj_dirMethod · 0.80
set_base_obj_dirMethod · 0.80
set_selected_objMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected