Skip to content

Commit 7e8df3a

Browse files
author
Stephan Dilly
committed
simplify pending state by using the new one
1 parent 03cf23a commit 7e8df3a

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

src/components/commit_details/mod.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,14 @@ impl CommitDetailsComponent {
5050
}
5151
}
5252

53-
fn get_files_title(&self, loading: bool) -> String {
53+
fn get_files_title(&self) -> String {
5454
let files_count = self.file_tree.file_count();
5555

56-
if loading {
57-
strings::commit::DETAILS_FILES_LOADING_TITLE.to_string()
58-
} else {
59-
format!(
60-
"{} {}",
61-
strings::commit::DETAILS_FILES_TITLE,
62-
files_count
63-
)
64-
}
56+
format!(
57+
"{} {}",
58+
strings::commit::DETAILS_FILES_TITLE,
59+
files_count
60+
)
6561
}
6662

6763
///
@@ -78,19 +74,18 @@ impl CommitDetailsComponent {
7874
{
7975
if fetched_id == id {
8076
self.file_tree.update(res.as_slice())?;
81-
self.file_tree
82-
.set_title(self.get_files_title(false));
77+
self.file_tree.set_title(self.get_files_title());
8378

8479
return Ok(());
8580
}
8681
}
82+
8783
self.file_tree.clear()?;
8884
self.git_commit_files.fetch(id)?;
89-
self.file_tree.set_title(self.get_files_title(true));
90-
} else {
91-
self.file_tree.set_title(self.get_files_title(false));
9285
}
9386

87+
self.file_tree.set_title(self.get_files_title());
88+
9489
Ok(())
9590
}
9691

src/components/filetree.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl FileTreeComponent {
104104
///
105105
pub fn clear(&mut self) -> Result<()> {
106106
self.current_hash = 0;
107+
self.pending = true;
107108
self.tree.update(&[])
108109
}
109110

src/strings.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ pub mod commit {
5050
pub static DETAILS_INFO_TITLE: &str = "Info";
5151
pub static DETAILS_MESSAGE_TITLE: &str = "Message";
5252
pub static DETAILS_FILES_TITLE: &str = "Files:";
53-
pub static DETAILS_FILES_LOADING_TITLE: &str = "Files: loading";
5453
}
5554

5655
pub mod order {

0 commit comments

Comments
 (0)