accounts.rs: move to crate root

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/299/head
Manos Pitsidianakis 9 months ago
parent dd4d0b7972
commit b673af02ac
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -52,10 +52,10 @@ use melib::{
}; };
use smallvec::SmallVec; use smallvec::SmallVec;
use super::{AccountConf, FileMailboxConf};
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
use crate::command::actions::AccountAction; use crate::command::actions::AccountAction;
use crate::{ use crate::{
conf::{AccountConf, FileMailboxConf},
jobs::{JobId, JoinHandle}, jobs::{JobId, JoinHandle},
types::UIEvent::{self, EnvelopeRemove, EnvelopeRename, EnvelopeUpdate, Notification}, types::UIEvent::{self, EnvelopeRemove, EnvelopeRename, EnvelopeUpdate, Notification},
MainLoopHandler, StatusEvent, ThreadEvent, MainLoopHandler, StatusEvent, ThreadEvent,

@ -48,9 +48,6 @@ pub mod shortcuts;
mod listing; mod listing;
pub mod terminal; pub mod terminal;
mod themes; mod themes;
pub use themes::*;
pub mod accounts;
use std::{ use std::{
collections::HashMap, collections::HashMap,
env, env,
@ -67,8 +64,9 @@ use melib::{
}; };
use pager::PagerSettings; use pager::PagerSettings;
use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
pub use themes::*;
pub use self::{accounts::Account, composing::*, pgp::*, shortcuts::*, tags::*}; pub use self::{composing::*, pgp::*, shortcuts::*, tags::*};
use self::{ use self::{
default_vals::*, listing::ListingSettings, notifications::NotificationsSettings, default_vals::*, listing::ListingSettings, notifications::NotificationsSettings,
terminal::TerminalSettings, terminal::TerminalSettings,

@ -97,7 +97,7 @@ pub mod svg;
#[macro_use] #[macro_use]
pub mod conf; pub mod conf;
pub use crate::conf::{ pub use crate::conf::{
Account, DotAddressable, IndexStyle, SearchBackend, Settings, Shortcuts, ThemeAttribute, DotAddressable, IndexStyle, SearchBackend, Settings, Shortcuts, ThemeAttribute,
}; };
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
@ -105,3 +105,6 @@ pub mod sqlite3;
pub mod jobs; pub mod jobs;
pub mod mailcap; pub mod mailcap;
pub mod accounts;
pub use self::accounts::Account;

@ -37,7 +37,7 @@ use melib::{
use nix::sys::wait::WaitStatus; use nix::sys::wait::WaitStatus;
use super::*; use super::*;
use crate::{conf::accounts::JobRequest, jobs::JoinHandle, terminal::embed::EmbedTerminal}; use crate::{accounts::JobRequest, jobs::JoinHandle, terminal::embed::EmbedTerminal};
#[cfg(feature = "gpgme")] #[cfg(feature = "gpgme")]
pub mod gpg; pub mod gpg;

@ -35,7 +35,9 @@ use smallvec::SmallVec;
use super::*; use super::*;
use crate::{ use crate::{
components::ExtendShortcutsMaps, conf::accounts::JobRequest, types::segment_tree::SegmentTree, accounts::{JobRequest, MailboxStatus},
components::ExtendShortcutsMaps,
types::segment_tree::SegmentTree,
}; };
// [ref:TODO]: emoji_text_presentation_selector should be printed along with the chars // [ref:TODO]: emoji_text_presentation_selector should be printed along with the chars
@ -2327,7 +2329,6 @@ impl Component for Listing {
}; };
let account = &context.accounts[self.cursor_pos.account]; let account = &context.accounts[self.cursor_pos.account];
use crate::conf::accounts::MailboxStatus;
match account[&mailbox_hash].status { match account[&mailbox_hash].status {
MailboxStatus::Available | MailboxStatus::Parsing(_, _) => { MailboxStatus::Available | MailboxStatus::Parsing(_, _) => {
let (unseen, total) = account[&mailbox_hash] let (unseen, total) = account[&mailbox_hash]
@ -2610,7 +2611,7 @@ impl Listing {
{ {
if mailboxes[&mailbox_hash].is_subscribed() { if mailboxes[&mailbox_hash].is_subscribed() {
match context.accounts[self.accounts[aidx].index][&mailbox_hash].status { match context.accounts[self.accounts[aidx].index][&mailbox_hash].status {
crate::conf::accounts::MailboxStatus::Failed(_) => { MailboxStatus::Failed(_) => {
lines.push(Line { lines.push(Line {
collapsed, collapsed,
depth, depth,

@ -104,7 +104,7 @@ impl Component for AccountStatus {
for (job_id, req) in a.active_jobs.iter() { for (job_id, req) in a.active_jobs.iter() {
width = self.content.size().0; width = self.content.size().0;
use crate::conf::accounts::JobRequest; use crate::accounts::JobRequest;
let (x, y) = write_string_to_grid( let (x, y) = write_string_to_grid(
&format!("{} {}", req, job_id), &format!("{} {}", req, job_id),
&mut self.content, &mut self.content,

@ -34,7 +34,7 @@ use melib::{
use smallvec::SmallVec; use smallvec::SmallVec;
use super::*; use super::*;
use crate::{conf::accounts::JobRequest, jobs::JobId}; use crate::{accounts::JobRequest, jobs::JobId};
mod utils; mod utils;
pub use utils::*; pub use utils::*;
@ -559,7 +559,7 @@ impl Component for MailView {
}; };
context.accounts[&account_hash].insert_job( context.accounts[&account_hash].insert_job(
handle.job_id, handle.job_id,
crate::conf::accounts::JobRequest::Generic { JobRequest::Generic {
name: "fetch envelope".into(), name: "fetch envelope".into(),
handle, handle,
on_finish: Some(CallbackFn(Box::new(move |context: &mut Context| { on_finish: Some(CallbackFn(Box::new(move |context: &mut Context| {

@ -24,7 +24,7 @@ use indexmap::IndexMap;
use melib::backends::AccountHash; use melib::backends::AccountHash;
use super::*; use super::*;
use crate::{conf::accounts::MailboxEntry, melib::text_processing::TextProcessing}; use crate::{accounts::MailboxEntry, melib::text_processing::TextProcessing};
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum MailboxAction { enum MailboxAction {

@ -926,7 +926,7 @@ impl State {
.spawn_blocking("sqlite3::index".into(), job); .spawn_blocking("sqlite3::index".into(), job);
self.context.accounts[account_index].active_jobs.insert( self.context.accounts[account_index].active_jobs.insert(
handle.job_id, handle.job_id,
crate::conf::accounts::JobRequest::Generic { crate::accounts::JobRequest::Generic {
name: "Message index rebuild".into(), name: "Message index rebuild".into(),
handle, handle,
on_finish: None, on_finish: None,

Loading…
Cancel
Save