diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-01-18 02:00:39 +0200 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-01-20 16:03:06 +0200 |
commit | d9269335a1b5660440743222f89fabd1f29f4e3a (patch) | |
tree | e7ab446a4784e98703f97a5cfd7e7e36138c5af6 /ui/src/components | |
parent | 47a69f8eb9c62cfc6b3e58002a2a978a6a16acdc (diff) |
melib/threads: rename thread hashes
- Rename ThreadHash to ThreadNodeHash
- Rename ThreadGroupHash to ThreadHash
Diffstat (limited to 'ui/src/components')
-rw-r--r-- | ui/src/components/mail.rs | 2 | ||||
-rw-r--r-- | ui/src/components/mail/listing.rs | 8 | ||||
-rw-r--r-- | ui/src/components/mail/listing/compact.rs | 30 | ||||
-rw-r--r-- | ui/src/components/mail/listing/conversations.rs | 30 | ||||
-rw-r--r-- | ui/src/components/mail/listing/plain.rs | 10 | ||||
-rw-r--r-- | ui/src/components/mail/listing/thread.rs | 10 | ||||
-rw-r--r-- | ui/src/components/mail/view/thread.rs | 12 |
7 files changed, 51 insertions, 51 deletions
diff --git a/ui/src/components/mail.rs b/ui/src/components/mail.rs index deb73163..9091b93d 100644 --- a/ui/src/components/mail.rs +++ b/ui/src/components/mail.rs @@ -24,7 +24,7 @@ use super::*; use melib::backends::Folder; use melib::backends::FolderHash; -use melib::thread::ThreadHash; +use melib::thread::ThreadNodeHash; pub mod listing; pub use crate::listing::*; diff --git a/ui/src/components/mail/listing.rs b/ui/src/components/mail/listing.rs index e8663621..f9aa7da6 100644 --- a/ui/src/components/mail/listing.rs +++ b/ui/src/components/mail/listing.rs @@ -53,7 +53,7 @@ pub trait MailListingTrait: ListingTrait { fn perform_action( &mut self, context: &mut Context, - thread_hash: ThreadGroupHash, + thread_hash: ThreadHash, a: &ListingAction, ) { let account = &mut context.accounts[self.coordinates().0]; @@ -120,9 +120,9 @@ pub trait MailListingTrait: ListingTrait { } } - fn row_updates(&mut self) -> &mut SmallVec<[ThreadGroupHash; 8]>; - fn get_focused_items(&self, _context: &Context) -> SmallVec<[ThreadGroupHash; 8]>; - fn redraw_list(&mut self, context: &Context, items: Box<dyn Iterator<Item = ThreadGroupHash>>) { + fn row_updates(&mut self) -> &mut SmallVec<[ThreadHash; 8]>; + fn get_focused_items(&self, _context: &Context) -> SmallVec<[ThreadHash; 8]>; + fn redraw_list(&mut self, context: &Context, items: Box<dyn Iterator<Item = ThreadHash>>) { unimplemented!() } } diff --git a/ui/src/components/mail/listing/compact.rs b/ui/src/components/mail/listing/compact.rs index 90a607e8..d15f7c7f 100644 --- a/ui/src/components/mail/listing/compact.rs +++ b/ui/src/components/mail/listing/compact.rs @@ -54,33 +54,33 @@ pub struct CompactListing { length: usize, sort: (SortField, SortOrder), subsort: (SortField, SortOrder), - all_threads: fnv::FnvHashSet<ThreadGroupHash>, - order: FnvHashMap<ThreadGroupHash, usize>, + all_threads: fnv::FnvHashSet<ThreadHash>, + order: FnvHashMap<ThreadHash, usize>, /// Cache current view. data_columns: DataColumns, filter_term: String, - filtered_selection: Vec<ThreadGroupHash>, - filtered_order: FnvHashMap<ThreadGroupHash, usize>, - selection: FnvHashMap<ThreadGroupHash, bool>, + filtered_selection: Vec<ThreadHash>, + filtered_order: FnvHashMap<ThreadHash, usize>, + selection: FnvHashMap<ThreadHash, bool>, /// If we must redraw on next redraw event dirty: bool, force_draw: bool, /// If `self.view` exists or not. unfocused: bool, view: ThreadView, - row_updates: SmallVec<[ThreadGroupHash; 8]>, + row_updates: SmallVec<[ThreadHash; 8]>, movement: Option<PageMovement>, id: ComponentId, } impl MailListingTrait for CompactListing { - fn row_updates(&mut self) -> &mut SmallVec<[ThreadGroupHash; 8]> { + fn row_updates(&mut self) -> &mut SmallVec<[ThreadHash; 8]> { &mut self.row_updates } - fn get_focused_items(&self, context: &Context) -> SmallVec<[ThreadGroupHash; 8]> { + fn get_focused_items(&self, context: &Context) -> SmallVec<[ThreadHash; 8]> { let is_selection_empty = self.selection.values().cloned().any(std::convert::identity); let i = [self.get_thread_under_cursor(self.cursor_pos.2, context)]; let cursor_iter; @@ -469,7 +469,7 @@ impl ListingTrait for CompactListing { self.redraw_list( context, Box::new(self.filtered_selection.clone().into_iter()) - as Box<dyn Iterator<Item = ThreadGroupHash>>, + as Box<dyn Iterator<Item = ThreadHash>>, ); } Err(e) => { @@ -547,7 +547,7 @@ impl CompactListing { e: &Envelope, context: &Context, threads: &Threads, - hash: ThreadGroupHash, + hash: ThreadHash, ) -> EntryStrings { let thread = &threads.groups[&hash]; let folder_hash = &context.accounts[self.cursor_pos.0][self.cursor_pos.1] @@ -675,7 +675,7 @@ impl CompactListing { self.redraw_list( context, - Box::new(roots.into_iter()) as Box<dyn Iterator<Item = ThreadGroupHash>>, + Box::new(roots.into_iter()) as Box<dyn Iterator<Item = ThreadHash>>, ); if old_cursor_pos == self.new_cursor_pos { @@ -687,7 +687,7 @@ impl CompactListing { } } - fn redraw_list(&mut self, context: &Context, items: Box<dyn Iterator<Item = ThreadGroupHash>>) { + fn redraw_list(&mut self, context: &Context, items: Box<dyn Iterator<Item = ThreadHash>>) { let account = &context.accounts[self.cursor_pos.0]; let mailbox = &account[self.cursor_pos.1].unwrap(); @@ -961,7 +961,7 @@ impl CompactListing { } } - fn get_thread_under_cursor(&self, cursor: usize, context: &Context) -> ThreadGroupHash { + fn get_thread_under_cursor(&self, cursor: usize, context: &Context) -> ThreadHash { //let account = &context.accounts[self.cursor_pos.0]; //let folder_hash = account[self.cursor_pos.1].unwrap().folder.hash(); if self.filter_term.is_empty() { @@ -979,7 +979,7 @@ impl CompactListing { } } - fn update_line(&mut self, context: &Context, thread_hash: ThreadGroupHash) { + fn update_line(&mut self, context: &Context, thread_hash: ThreadHash) { let account = &context.accounts[self.cursor_pos.0]; let folder_hash = account[self.cursor_pos.1].unwrap().folder.hash(); let threads = &account.collection.threads[&folder_hash]; @@ -1316,7 +1316,7 @@ impl Component for CompactListing { if !threads.thread_nodes.contains_key(&new_env_thread_hash) { return false; } - let thread: ThreadGroupHash = + let thread: ThreadHash = threads.find_group(threads.thread_nodes()[&new_env_thread_hash].group); if self.order.contains_key(&thread) { self.row_updates.push(thread); diff --git a/ui/src/components/mail/listing/conversations.rs b/ui/src/components/mail/listing/conversations.rs index b9096762..4012657f 100644 --- a/ui/src/components/mail/listing/conversations.rs +++ b/ui/src/components/mail/listing/conversations.rs @@ -85,33 +85,33 @@ pub struct ConversationsListing { length: usize, sort: (SortField, SortOrder), subsort: (SortField, SortOrder), - all_threads: fnv::FnvHashSet<ThreadGroupHash>, - order: FnvHashMap<ThreadGroupHash, usize>, + all_threads: fnv::FnvHashSet<ThreadHash>, + order: FnvHashMap<ThreadHash, usize>, /// Cache current view. content: CellBuffer, filter_term: String, - filtered_selection: Vec<ThreadGroupHash>, - filtered_order: FnvHashMap<ThreadGroupHash, usize>, - selection: FnvHashMap<ThreadGroupHash, bool>, + filtered_selection: Vec<ThreadHash>, + filtered_order: FnvHashMap<ThreadHash, usize>, + selection: FnvHashMap<ThreadHash, bool>, /// If we must redraw on next redraw event dirty: bool, force_draw: bool, /// If `self.view` exists or not. unfocused: bool, view: ThreadView, - row_updates: SmallVec<[ThreadGroupHash; 8]>, + row_updates: SmallVec<[ThreadHash; 8]>, movement: Option<PageMovement>, id: ComponentId, } impl MailListingTrait for ConversationsListing { - fn row_updates(&mut self) -> &mut SmallVec<[ThreadGroupHash; 8]> { + fn row_updates(&mut self) -> &mut SmallVec<[ThreadHash; 8]> { &mut self.row_updates } - fn get_focused_items(&self, context: &Context) -> SmallVec<[ThreadGroupHash; 8]> { + fn get_focused_items(&self, context: &Context) -> SmallVec<[ThreadHash; 8]> { let is_selection_empty = self.selection.values().cloned().any(std::convert::identity); let i = [self.get_thread_under_cursor(self.cursor_pos.2, context)]; let cursor_iter; @@ -441,7 +441,7 @@ impl ListingTrait for ConversationsListing { self.redraw_list( context, Box::new(self.filtered_selection.clone().into_iter()) - as Box<dyn Iterator<Item = ThreadGroupHash>>, + as Box<dyn Iterator<Item = ThreadHash>>, ); } Err(e) => { @@ -520,7 +520,7 @@ impl ConversationsListing { context: &Context, from: &Vec<Address>, threads: &Threads, - hash: ThreadGroupHash, + hash: ThreadHash, ) -> EntryStrings { let thread = &threads.groups[&hash]; let folder_hash = &context.accounts[self.cursor_pos.0][self.cursor_pos.1] @@ -648,7 +648,7 @@ impl ConversationsListing { self.redraw_list( context, - Box::new(roots.into_iter()) as Box<dyn Iterator<Item = ThreadGroupHash>>, + Box::new(roots.into_iter()) as Box<dyn Iterator<Item = ThreadHash>>, ); if old_cursor_pos == self.new_cursor_pos { @@ -660,7 +660,7 @@ impl ConversationsListing { } } - fn redraw_list(&mut self, context: &Context, items: Box<dyn Iterator<Item = ThreadGroupHash>>) { + fn redraw_list(&mut self, context: &Context, items: Box<dyn Iterator<Item = ThreadHash>>) { let account = &context.accounts[self.cursor_pos.0]; let mailbox = &account[self.cursor_pos.1].unwrap(); @@ -895,7 +895,7 @@ impl ConversationsListing { } } - fn get_thread_under_cursor(&self, cursor: usize, context: &Context) -> ThreadGroupHash { + fn get_thread_under_cursor(&self, cursor: usize, context: &Context) -> ThreadHash { //let account = &context.accounts[self.cursor_pos.0]; //let folder_hash = account[self.cursor_pos.1].unwrap().folder.hash(); //let threads = &account.collection.threads[&folder_hash]; @@ -915,7 +915,7 @@ impl ConversationsListing { } } - fn update_line(&mut self, context: &Context, thread_hash: ThreadGroupHash) { + fn update_line(&mut self, context: &Context, thread_hash: ThreadHash) { let account = &context.accounts[self.cursor_pos.0]; let folder_hash = account[self.cursor_pos.1].unwrap().folder.hash(); let threads = &account.collection.threads[&folder_hash]; @@ -1209,7 +1209,7 @@ impl Component for ConversationsListing { if !threads.thread_nodes.contains_key(&new_env_thread_hash) { return false; } - let thread: ThreadGroupHash = + let thread: ThreadHash = threads.find_group(threads.thread_nodes()[&new_env_thread_hash].group); if self.order.contains_key(&thread) { self.row_updates.push(thread); diff --git a/ui/src/components/mail/listing/plain.rs b/ui/src/components/mail/listing/plain.rs index 9a77cc9d..1a9095d3 100644 --- a/ui/src/components/mail/listing/plain.rs +++ b/ui/src/components/mail/listing/plain.rs @@ -62,7 +62,7 @@ pub struct PlainListing { filtered_selection: Vec<EnvelopeHash>, filtered_order: FnvHashMap<EnvelopeHash, usize>, selection: FnvHashMap<EnvelopeHash, bool>, - thread_hashes: FnvHashMap<EnvelopeHash, ThreadHash>, + thread_hashes: FnvHashMap<EnvelopeHash, ThreadNodeHash>, local_collection: Vec<EnvelopeHash>, /// If we must redraw on next redraw event dirty: bool, @@ -71,18 +71,18 @@ pub struct PlainListing { unfocused: bool, view: MailView, row_updates: SmallVec<[EnvelopeHash; 8]>, - _row_updates: SmallVec<[ThreadGroupHash; 8]>, + _row_updates: SmallVec<[ThreadHash; 8]>, movement: Option<PageMovement>, id: ComponentId, } impl MailListingTrait for PlainListing { - fn row_updates(&mut self) -> &mut SmallVec<[ThreadGroupHash; 8]> { + fn row_updates(&mut self) -> &mut SmallVec<[ThreadHash; 8]> { &mut self._row_updates } - fn get_focused_items(&self, context: &Context) -> SmallVec<[ThreadGroupHash; 8]> { + fn get_focused_items(&self, context: &Context) -> SmallVec<[ThreadHash; 8]> { return SmallVec::new(); /* let is_selection_empty = self.selection.values().cloned().any(std::convert::identity); @@ -892,7 +892,7 @@ impl PlainListing { } } - fn get_thread_under_cursor(&self, cursor: usize, context: &Context) -> ThreadHash { + fn get_thread_under_cursor(&self, cursor: usize, context: &Context) -> ThreadNodeHash { let account = &context.accounts[self.cursor_pos.0]; let env_hash = self.get_env_under_cursor(cursor, context); account.collection.get_env(env_hash).thread() diff --git a/ui/src/components/mail/listing/thread.rs b/ui/src/components/mail/listing/thread.rs index bb841fef..1679988d 100644 --- a/ui/src/components/mail/listing/thread.rs +++ b/ui/src/components/mail/listing/thread.rs @@ -37,7 +37,7 @@ pub struct ThreadListing { /// Cache current view. content: CellBuffer, - row_updates: SmallVec<[ThreadGroupHash; 8]>, + row_updates: SmallVec<[ThreadHash; 8]>, locations: Vec<EnvelopeHash>, /// If we must redraw on next redraw event dirty: bool, @@ -50,11 +50,11 @@ pub struct ThreadListing { } impl MailListingTrait for ThreadListing { - fn row_updates(&mut self) -> &mut SmallVec<[ThreadGroupHash; 8]> { + fn row_updates(&mut self) -> &mut SmallVec<[ThreadHash; 8]> { &mut self.row_updates } - fn get_focused_items(&self, _context: &Context) -> SmallVec<[ThreadGroupHash; 8]> { + fn get_focused_items(&self, _context: &Context) -> SmallVec<[ThreadHash; 8]> { SmallVec::new() } } @@ -319,7 +319,7 @@ impl ThreadListing { let mut thread_idx = 0; // needed for alternate thread colors /* Draw threaded view. */ threads.sort_by(self.sort, self.subsort, &account.collection.envelopes); - let thread_nodes: &FnvHashMap<ThreadHash, ThreadNode> = &threads.thread_nodes(); + let thread_nodes: &FnvHashMap<ThreadNodeHash, ThreadNode> = &threads.thread_nodes(); let mut iter = threads.threads_iter().peekable(); /* This is just a desugared for loop so that we can use .peek() */ let mut idx = 0; @@ -429,7 +429,7 @@ impl ThreadListing { envelope: &Envelope, idx: usize, indent: usize, - node_idx: ThreadHash, + node_idx: ThreadNodeHash, threads: &Threads, indentations: &[bool], has_sibling: bool, diff --git a/ui/src/components/mail/view/thread.rs b/ui/src/components/mail/view/thread.rs index 467b236d..1635a5f8 100644 --- a/ui/src/components/mail/view/thread.rs +++ b/ui/src/components/mail/view/thread.rs @@ -34,7 +34,7 @@ const INDENTATION_COLORS: &'static [u8] = &[ #[derive(Debug, Clone)] struct ThreadEntry { - index: (usize, ThreadHash, usize), + index: (usize, ThreadNodeHash, usize), /// (indentation, thread_node index, line number in listing) indentation: usize, msg_hash: EnvelopeHash, @@ -52,7 +52,7 @@ pub struct ThreadView { new_expanded_pos: usize, reversed: bool, coordinates: (usize, usize, usize), - thread_group: ThreadGroupHash, + thread_group: ThreadHash, mailview: MailView, show_mailview: bool, show_thread: bool, @@ -76,8 +76,8 @@ impl ThreadView { */ pub fn new( coordinates: (usize, usize, usize), - thread_group: ThreadGroupHash, - expanded_hash: Option<ThreadHash>, + thread_group: ThreadHash, + expanded_hash: Option<ThreadNodeHash>, context: &Context, ) -> Self { let mut view = ThreadView { @@ -160,7 +160,7 @@ impl ThreadView { } self.set_dirty(true); } - fn initiate(&mut self, expanded_hash: Option<ThreadHash>, context: &Context) { + fn initiate(&mut self, expanded_hash: Option<ThreadNodeHash>, context: &Context) { /* stack to push thread messages in order in order to pop and print them later */ let account = &context.accounts[self.coordinates.0]; let mailbox = &account[self.coordinates.1].unwrap(); @@ -384,7 +384,7 @@ impl ThreadView { fn make_entry( &mut self, - i: (usize, ThreadHash, usize), + i: (usize, ThreadNodeHash, usize), msg_hash: EnvelopeHash, seen: bool, ) -> ThreadEntry { |