ui/listing: use MailListingTrait instead of ListingTrait
parent
8e27b86453
commit
e5da10093d
|
@ -136,7 +136,7 @@ pub enum ListingComponent {
|
||||||
use crate::ListingComponent::*;
|
use crate::ListingComponent::*;
|
||||||
|
|
||||||
impl core::ops::Deref for ListingComponent {
|
impl core::ops::Deref for ListingComponent {
|
||||||
type Target = dyn ListingTrait;
|
type Target = dyn MailListingTrait;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
match &self {
|
match &self {
|
||||||
|
@ -149,7 +149,7 @@ impl core::ops::Deref for ListingComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl core::ops::DerefMut for ListingComponent {
|
impl core::ops::DerefMut for ListingComponent {
|
||||||
fn deref_mut(&mut self) -> &mut (dyn ListingTrait + 'static) {
|
fn deref_mut(&mut self) -> &mut (dyn MailListingTrait + 'static) {
|
||||||
match self {
|
match self {
|
||||||
Compact(l) => l,
|
Compact(l) => l,
|
||||||
Plain(l) => l,
|
Plain(l) => l,
|
||||||
|
|
|
@ -70,11 +70,20 @@ pub struct PlainListing {
|
||||||
unfocused: bool,
|
unfocused: bool,
|
||||||
view: MailView,
|
view: MailView,
|
||||||
row_updates: StackVec<EnvelopeHash>,
|
row_updates: StackVec<EnvelopeHash>,
|
||||||
|
_row_updates: StackVec<ThreadHash>,
|
||||||
|
|
||||||
movement: Option<PageMovement>,
|
movement: Option<PageMovement>,
|
||||||
id: ComponentId,
|
id: ComponentId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl MailListingTrait for PlainListing {
|
||||||
|
fn row_updates(&mut self) -> &mut StackVec<ThreadHash> {
|
||||||
|
&mut self._row_updates
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_line(&mut self, _context: &Context, _thread_hash: ThreadHash) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl ListingTrait for PlainListing {
|
impl ListingTrait for PlainListing {
|
||||||
fn coordinates(&self) -> (usize, usize) {
|
fn coordinates(&self) -> (usize, usize) {
|
||||||
(self.new_cursor_pos.0, self.new_cursor_pos.1)
|
(self.new_cursor_pos.0, self.new_cursor_pos.1)
|
||||||
|
@ -467,6 +476,7 @@ impl PlainListing {
|
||||||
filtered_order: FnvHashMap::default(),
|
filtered_order: FnvHashMap::default(),
|
||||||
selection: FnvHashMap::default(),
|
selection: FnvHashMap::default(),
|
||||||
row_updates: StackVec::new(),
|
row_updates: StackVec::new(),
|
||||||
|
_row_updates: StackVec::new(),
|
||||||
data_columns: DataColumns::default(),
|
data_columns: DataColumns::default(),
|
||||||
dirty: true,
|
dirty: true,
|
||||||
force_draw: true,
|
force_draw: true,
|
||||||
|
|
|
@ -37,6 +37,7 @@ pub struct ThreadListing {
|
||||||
/// Cache current view.
|
/// Cache current view.
|
||||||
content: CellBuffer,
|
content: CellBuffer,
|
||||||
|
|
||||||
|
row_updates: StackVec<ThreadHash>,
|
||||||
locations: Vec<EnvelopeHash>,
|
locations: Vec<EnvelopeHash>,
|
||||||
/// If we must redraw on next redraw event
|
/// If we must redraw on next redraw event
|
||||||
dirty: bool,
|
dirty: bool,
|
||||||
|
@ -48,6 +49,14 @@ pub struct ThreadListing {
|
||||||
id: ComponentId,
|
id: ComponentId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl MailListingTrait for ThreadListing {
|
||||||
|
fn row_updates(&mut self) -> &mut StackVec<ThreadHash> {
|
||||||
|
&mut self.row_updates
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_line(&mut self, _context: &Context, _thread_hash: ThreadHash) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl ListingTrait for ThreadListing {
|
impl ListingTrait for ThreadListing {
|
||||||
fn coordinates(&self) -> (usize, usize) {
|
fn coordinates(&self) -> (usize, usize) {
|
||||||
(self.new_cursor_pos.0, self.new_cursor_pos.1)
|
(self.new_cursor_pos.0, self.new_cursor_pos.1)
|
||||||
|
@ -56,6 +65,7 @@ impl ListingTrait for ThreadListing {
|
||||||
self.new_cursor_pos = (coordinates.0, coordinates.1, 0);
|
self.new_cursor_pos = (coordinates.0, coordinates.1, 0);
|
||||||
self.unfocused = false;
|
self.unfocused = false;
|
||||||
self.locations.clear();
|
self.locations.clear();
|
||||||
|
self.row_updates.clear();
|
||||||
self.initialised = false;
|
self.initialised = false;
|
||||||
}
|
}
|
||||||
fn draw_list(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
fn draw_list(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||||
|
@ -230,6 +240,7 @@ impl ThreadListing {
|
||||||
sort: (Default::default(), Default::default()),
|
sort: (Default::default(), Default::default()),
|
||||||
subsort: (Default::default(), Default::default()),
|
subsort: (Default::default(), Default::default()),
|
||||||
content,
|
content,
|
||||||
|
row_updates: StackVec::new(),
|
||||||
locations: Vec::new(),
|
locations: Vec::new(),
|
||||||
dirty: true,
|
dirty: true,
|
||||||
unfocused: false,
|
unfocused: false,
|
||||||
|
|
Loading…
Reference in New Issue