Fix compiler warnings
parent
629997397f
commit
fc25c7b165
|
@ -718,7 +718,6 @@ impl MailBackend for MaildirType {
|
||||||
Err(e) => debug!("watch error: {:?}", e),
|
Err(e) => debug!("watch error: {:?}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -968,7 +968,6 @@ impl MailBackend for MboxType {
|
||||||
Err(e) => debug!("watch error: {:?}", e),
|
Err(e) => debug!("watch error: {:?}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -589,7 +589,7 @@ impl FetchState {
|
||||||
f.unseen.lock().unwrap().set_not_yet_seen(total);
|
f.unseen.lock().unwrap().set_not_yet_seen(total);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
let (high, low, total) = high_low_total.unwrap();
|
let (high, low, _) = high_low_total.unwrap();
|
||||||
if high <= low {
|
if high <= low {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,23 +20,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct StatusPanel {
|
pub struct StatusPanel {
|
||||||
cursor: (usize, usize),
|
cursor: (usize, usize),
|
||||||
account_cursor: usize,
|
account_cursor: usize,
|
||||||
status: Option<AccountStatus>,
|
status: Option<AccountStatus>,
|
||||||
date_cache: HashMap<UnixTimestamp, String>,
|
|
||||||
content: CellBuffer,
|
content: CellBuffer,
|
||||||
dirty: bool,
|
dirty: bool,
|
||||||
theme_default: ThemeAttribute,
|
theme_default: ThemeAttribute,
|
||||||
id: ComponentId,
|
id: ComponentId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for StatusPanel {
|
impl core::fmt::Display for StatusPanel {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||||
write!(f, "status")
|
write!(f, "status")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,90 +46,6 @@ impl Component for StatusPanel {
|
||||||
}
|
}
|
||||||
self.draw_accounts(context);
|
self.draw_accounts(context);
|
||||||
let (width, height) = self.content.size();
|
let (width, height) = self.content.size();
|
||||||
{
|
|
||||||
let (_, _) = write_string_to_grid(
|
|
||||||
"Worker threads",
|
|
||||||
&mut self.content,
|
|
||||||
self.theme_default.fg,
|
|
||||||
self.theme_default.bg,
|
|
||||||
Attr::BOLD,
|
|
||||||
((1, 1), (width - 1, height - 1)),
|
|
||||||
Some(1),
|
|
||||||
);
|
|
||||||
/*
|
|
||||||
let mut y = y + 1;
|
|
||||||
let work_controller = context.work_controller().threads.lock().unwrap();
|
|
||||||
let mut workers: Vec<&Worker> = work_controller.values().collect::<Vec<&Worker>>();
|
|
||||||
let mut max_name = 0;
|
|
||||||
workers.sort_by_key(|w| {
|
|
||||||
max_name = std::cmp::max(max_name, w.name.len());
|
|
||||||
w.name.as_str()
|
|
||||||
});
|
|
||||||
for worker in workers {
|
|
||||||
let (x, y_off) = write_string_to_grid(
|
|
||||||
&format!(
|
|
||||||
"- {:<max_name$} {} [{}]",
|
|
||||||
worker.name.as_str(),
|
|
||||||
worker.status.as_str(),
|
|
||||||
self.timestamp_fmt(worker.heartbeat),
|
|
||||||
max_name = max_name
|
|
||||||
),
|
|
||||||
&mut self.content,
|
|
||||||
self.theme_default.fg,
|
|
||||||
self.theme_default.bg,
|
|
||||||
self.theme_default.attrs,
|
|
||||||
((1, y), (width - 1, height - 1)),
|
|
||||||
Some(1),
|
|
||||||
);
|
|
||||||
for x in x..(width - 1) {
|
|
||||||
self.content[(x, y)].set_ch(' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
y = y_off + 1;
|
|
||||||
}
|
|
||||||
write_string_to_grid(
|
|
||||||
"Static threads",
|
|
||||||
&mut self.content,
|
|
||||||
self.theme_default.fg,
|
|
||||||
self.theme_default.bg,
|
|
||||||
Attr::BOLD,
|
|
||||||
((1, y + 1), (width - 1, height - 1)),
|
|
||||||
Some(1),
|
|
||||||
);
|
|
||||||
y += 2;
|
|
||||||
|
|
||||||
let work_controller = context.work_controller().static_threads.lock().unwrap();
|
|
||||||
let mut workers: Vec<&Worker> = work_controller.values().collect::<Vec<&Worker>>();
|
|
||||||
max_name = 0;
|
|
||||||
workers.retain(|w| w.name != "WorkController-thread");
|
|
||||||
workers.sort_by_key(|w| {
|
|
||||||
max_name = std::cmp::max(max_name, w.name.len());
|
|
||||||
w.name.as_str()
|
|
||||||
});
|
|
||||||
for worker in workers {
|
|
||||||
let (x, y_off) = write_string_to_grid(
|
|
||||||
&format!(
|
|
||||||
"- {:<max_name$} {} [{}]",
|
|
||||||
worker.name.as_str(),
|
|
||||||
worker.status.as_str(),
|
|
||||||
self.timestamp_fmt(worker.heartbeat),
|
|
||||||
max_name = max_name
|
|
||||||
),
|
|
||||||
&mut self.content,
|
|
||||||
self.theme_default.fg,
|
|
||||||
self.theme_default.bg,
|
|
||||||
self.theme_default.attrs,
|
|
||||||
((1, y), (width - 1, height - 1)),
|
|
||||||
Some(1),
|
|
||||||
);
|
|
||||||
for x in x..(width - 1) {
|
|
||||||
self.content[(x, y)].set_ch(' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
y = y_off + 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
let (cols, rows) = (width!(area), height!(area));
|
let (cols, rows) = (width!(area), height!(area));
|
||||||
self.cursor = (
|
self.cursor = (
|
||||||
std::cmp::min(width.saturating_sub(cols), self.cursor.0),
|
std::cmp::min(width.saturating_sub(cols), self.cursor.0),
|
||||||
|
@ -247,7 +160,6 @@ impl StatusPanel {
|
||||||
account_cursor: 0,
|
account_cursor: 0,
|
||||||
content,
|
content,
|
||||||
status: None,
|
status: None,
|
||||||
date_cache: Default::default(),
|
|
||||||
dirty: true,
|
dirty: true,
|
||||||
theme_default,
|
theme_default,
|
||||||
id: ComponentId::new_v4(),
|
id: ComponentId::new_v4(),
|
||||||
|
@ -397,15 +309,6 @@ impl StatusPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn timestamp_fmt(&mut self, t: UnixTimestamp) -> &str {
|
|
||||||
if !self.date_cache.contains_key(&t) {
|
|
||||||
self.date_cache.insert(
|
|
||||||
t,
|
|
||||||
melib::datetime::timestamp_to_string(t, Some("%Y-%m-%d %T")),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
&self.date_cache[&t]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Component for AccountStatus {
|
impl Component for AccountStatus {
|
||||||
|
|
|
@ -586,27 +586,6 @@ impl Account {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_worker(mailbox: &Mailbox, backend: &Arc<RwLock<Box<dyn MailBackend>>>) -> Result<()> {
|
|
||||||
let mailbox_hash = mailbox.hash();
|
|
||||||
let mailbox_handle = backend.write().unwrap().fetch(mailbox_hash)?;
|
|
||||||
let priority = match mailbox.special_usage() {
|
|
||||||
SpecialUsageMailbox::Inbox => 0,
|
|
||||||
SpecialUsageMailbox::Sent => 1,
|
|
||||||
SpecialUsageMailbox::Drafts | SpecialUsageMailbox::Trash => 2,
|
|
||||||
_ => {
|
|
||||||
3 * mailbox
|
|
||||||
.path()
|
|
||||||
.split(if mailbox.path().contains('/') {
|
|
||||||
'/'
|
|
||||||
} else {
|
|
||||||
'.'
|
|
||||||
})
|
|
||||||
.count() as u64
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
pub fn reload(&mut self, event: RefreshEvent, mailbox_hash: MailboxHash) -> Option<UIEvent> {
|
pub fn reload(&mut self, event: RefreshEvent, mailbox_hash: MailboxHash) -> Option<UIEvent> {
|
||||||
if !self.mailbox_entries[&mailbox_hash].status.is_available() {
|
if !self.mailbox_entries[&mailbox_hash].status.is_available() {
|
||||||
self.event_queue.push_back((mailbox_hash, event));
|
self.event_queue.push_back((mailbox_hash, event));
|
||||||
|
|
|
@ -1154,7 +1154,7 @@ impl State {
|
||||||
}
|
}
|
||||||
Some(ForkType::Finished) => {
|
Some(ForkType::Finished) => {
|
||||||
/* Fork has already finished */
|
/* Fork has already finished */
|
||||||
std::mem::replace(&mut self.child, None);
|
self.child = None;
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
Loading…
Reference in New Issue