index : nmrs-tui
A fast, Vim-friendly NetworkManager TUI built in Rust.
about summary refs log tree commit diff

Diffstat (limited to 'src/app.rs')

-rw-r--r-- src/app.rs 19
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/app.rs b/src/app.rs
index a91f771..afb43d3 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1,7 +1,7 @@
use std::time::Duration;

use crate::{
    action::{Action, Actions},
    action::{Action, ActionHandler},
    config::Config,
    network_manager::NetworkManager,
    timer::Timer,
@@ -20,6 +20,7 @@
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Popups {
    Password,
    EditNetwork,
}

#[derive(Debug, Clone, Copy)]
@@ -31,12 +32,12 @@
#[derive(Clone)]
pub enum Selected {
    Network(Network),
    Device(WifiDevice),
    Device(()),
}

pub struct App {
    pub action: Action,
    pub config: Config,
    pub action: ActionHandler,
    pub _config: Config,
    pub network_manager: NetworkManager,
    pub should_quit: bool,

@@ -55,8 +56,8 @@
}

impl App {
    pub async fn new(config: Config) -> Result<Self> {
        let action = Action::new();
    pub async fn new(_config: Config) -> Result<Self> {
        let action = ActionHandler::new();
        let network_manager = NetworkManager::new().await?;

        let device_list = network_manager.get_devices().await?;
@@ -65,7 +66,7 @@

        Ok(Self {
            action,
            config,
            _config,
            network_manager,
            should_quit: false,

@@ -76,7 +77,7 @@
            toasts: Vec::new(),

            // Timers
            scan: Timer::new(Duration::from_secs(3), Actions::Refresh, true),
            scan: Timer::new(Duration::from_secs(3), Action::Refresh, true),

            known_networks: StatefulList::new(known_networks_list),
            available_networks: StatefulList::new(available_networks_list),
@@ -115,7 +116,7 @@
                    .state
                    .selected()
                    .and_then(|i| self.devices.items.get(i))
                    .map(|d| Selected::Device(d.clone())),
                    .map(|_d| Selected::Device(())),
            },
            Focus::Popup(_) => None,
        }