Rename MailListing to PlainListing

embed
Manos Pitsidianakis 2018-08-25 12:59:16 +03:00
parent 5f24515145
commit c415a5aae3
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
5 changed files with 17 additions and 17 deletions

View File

@ -418,7 +418,7 @@ impl Component for CompactListing {
self.dirty = true; self.dirty = true;
} }
UIEventType::Action(ref action) => match action { UIEventType::Action(ref action) => match action {
Action::MailListing(MailListingAction::ToggleThreaded) => { Action::PlainListing(PlainListingAction::ToggleThreaded) => {
context.accounts[self.cursor_pos.0] context.accounts[self.cursor_pos.0]
.runtime_settings .runtime_settings
.conf_mut() .conf_mut()

View File

@ -29,7 +29,7 @@ const MAX_COLS: usize = 500;
/// A list of all mail (`Envelope`s) in a `Mailbox`. On `\n` it opens the `Envelope` content in a /// A list of all mail (`Envelope`s) in a `Mailbox`. On `\n` it opens the `Envelope` content in a
/// `MailView`. /// `MailView`.
#[derive(Debug)] #[derive(Debug)]
pub struct MailListing { pub struct PlainListing {
/// (x, y, z): x is accounts, y is folders, z is index inside a folder. /// (x, y, z): x is accounts, y is folders, z is index inside a folder.
cursor_pos: (usize, usize, usize), cursor_pos: (usize, usize, usize),
new_cursor_pos: (usize, usize, usize), new_cursor_pos: (usize, usize, usize),
@ -46,20 +46,20 @@ pub struct MailListing {
view: Option<MailView>, view: Option<MailView>,
} }
impl Default for MailListing { impl Default for PlainListing {
fn default() -> Self { fn default() -> Self {
Self::new() Self::new()
} }
} }
impl fmt::Display for MailListing { impl fmt::Display for PlainListing {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "mail") write!(f, "mail")
} }
} }
impl MailListing { impl PlainListing {
/// Helper function to format entry strings for MailListing */ /// Helper function to format entry strings for PlainListing */
/* TODO: Make this configurable */ /* TODO: Make this configurable */
fn make_entry_string(e: &Envelope, idx: usize) -> String { fn make_entry_string(e: &Envelope, idx: usize) -> String {
format!( format!(
@ -72,7 +72,7 @@ impl MailListing {
pub fn new() -> Self { pub fn new() -> Self {
let content = CellBuffer::new(0, 0, Cell::with_char(' ')); let content = CellBuffer::new(0, 0, Cell::with_char(' '));
MailListing { PlainListing {
cursor_pos: (0, 1, 0), cursor_pos: (0, 1, 0),
new_cursor_pos: (0, 0, 0), new_cursor_pos: (0, 0, 0),
length: 0, length: 0,
@ -193,7 +193,7 @@ impl MailListing {
Color::Default Color::Default
}; };
let (x, _) = write_string_to_grid( let (x, _) = write_string_to_grid(
&MailListing::make_thread_entry( &PlainListing::make_thread_entry(
envelope, envelope,
idx, idx,
indentation, indentation,
@ -275,7 +275,7 @@ impl MailListing {
Color::Default Color::Default
}; };
let (x, y) = write_string_to_grid( let (x, y) = write_string_to_grid(
&MailListing::make_entry_string(envelope, idx), &PlainListing::make_entry_string(envelope, idx),
&mut self.content, &mut self.content,
fg_color, fg_color,
bg_color, bg_color,
@ -436,7 +436,7 @@ impl MailListing {
"{}{}{} ", "{}{}{} ",
idx, idx,
" ".repeat(idx_width + 2 - (idx.to_string().chars().count())), " ".repeat(idx_width + 2 - (idx.to_string().chars().count())),
MailListing::format_date(&envelope) PlainListing::format_date(&envelope)
); );
for i in 0..indent { for i in 0..indent {
if indentations.len() > i && indentations[i] { if indentations.len() > i && indentations[i] {
@ -485,7 +485,7 @@ impl MailListing {
} }
} }
impl Component for MailListing { impl Component for PlainListing {
fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) { fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
if !self.unfocused { if !self.unfocused {
if !self.is_dirty() { if !self.is_dirty() {
@ -760,7 +760,7 @@ impl Component for MailListing {
self.dirty = true; self.dirty = true;
} }
UIEventType::Action(ref action) => match action { UIEventType::Action(ref action) => match action {
Action::MailListing(MailListingAction::ToggleThreaded) => { Action::PlainListing(PlainListingAction::ToggleThreaded) => {
context.accounts[self.cursor_pos.0] context.accounts[self.cursor_pos.0]
.runtime_settings .runtime_settings
.conf_mut() .conf_mut()

View File

@ -26,13 +26,13 @@
pub use melib::mailbox::{SortField, SortOrder}; pub use melib::mailbox::{SortField, SortOrder};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum MailListingAction { pub enum PlainListingAction {
ToggleThreaded, ToggleThreaded,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum Action { pub enum Action {
MailListing(MailListingAction), PlainListing(PlainListingAction),
ViewMailbox(usize), ViewMailbox(usize),
Sort(SortField, SortOrder), Sort(SortField, SortOrder),
SubSort(SortField, SortOrder), SubSort(SortField, SortOrder),

View File

@ -71,7 +71,7 @@ named!(
named!( named!(
threaded<Action>, threaded<Action>,
map!(ws!(tag!("threaded")), |_| { map!(ws!(tag!("threaded")), |_| {
Action::MailListing(MailListingAction::ToggleThreaded) Action::PlainListing(PlainListingAction::ToggleThreaded)
}) })
); );
named!( named!(

View File

@ -536,8 +536,8 @@ impl<W: Write> State<W> {
self.entities[i].rcv_event( self.entities[i].rcv_event(
&UIEvent { &UIEvent {
id: 0, id: 0,
event_type: UIEventType::Action(Action::MailListing( event_type: UIEventType::Action(Action::PlainListing(
MailListingAction::ToggleThreaded, PlainListingAction::ToggleThreaded,
)), )),
}, },
&mut self.context, &mut self.context,