mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-23 20:52:54 +03:00
simplify pending state by using the new one
This commit is contained in:
parent
03cf23ad98
commit
7e8df3ad28
@ -50,18 +50,14 @@ impl CommitDetailsComponent {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_files_title(&self, loading: bool) -> String {
|
||||
fn get_files_title(&self) -> String {
|
||||
let files_count = self.file_tree.file_count();
|
||||
|
||||
if loading {
|
||||
strings::commit::DETAILS_FILES_LOADING_TITLE.to_string()
|
||||
} else {
|
||||
format!(
|
||||
"{} {}",
|
||||
strings::commit::DETAILS_FILES_TITLE,
|
||||
files_count
|
||||
)
|
||||
}
|
||||
format!(
|
||||
"{} {}",
|
||||
strings::commit::DETAILS_FILES_TITLE,
|
||||
files_count
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
@ -78,19 +74,18 @@ impl CommitDetailsComponent {
|
||||
{
|
||||
if fetched_id == id {
|
||||
self.file_tree.update(res.as_slice())?;
|
||||
self.file_tree
|
||||
.set_title(self.get_files_title(false));
|
||||
self.file_tree.set_title(self.get_files_title());
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
self.file_tree.clear()?;
|
||||
self.git_commit_files.fetch(id)?;
|
||||
self.file_tree.set_title(self.get_files_title(true));
|
||||
} else {
|
||||
self.file_tree.set_title(self.get_files_title(false));
|
||||
}
|
||||
|
||||
self.file_tree.set_title(self.get_files_title());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ impl FileTreeComponent {
|
||||
///
|
||||
pub fn clear(&mut self) -> Result<()> {
|
||||
self.current_hash = 0;
|
||||
self.pending = true;
|
||||
self.tree.update(&[])
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ pub mod commit {
|
||||
pub static DETAILS_INFO_TITLE: &str = "Info";
|
||||
pub static DETAILS_MESSAGE_TITLE: &str = "Message";
|
||||
pub static DETAILS_FILES_TITLE: &str = "Files:";
|
||||
pub static DETAILS_FILES_LOADING_TITLE: &str = "Files: loading";
|
||||
}
|
||||
|
||||
pub mod order {
|
||||
|
Loading…
Reference in New Issue
Block a user