mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-06 03:25:23 +00:00
fix(channels): use default_channel from config
This commit is contained in:
parent
7bbf538898
commit
8e987e1cda
@ -4,6 +4,7 @@ use std::{
|
||||
ops::Deref,
|
||||
};
|
||||
|
||||
use crate::config::default_channel;
|
||||
use crate::{cable::CableSpec, channels::preview::PreviewCommand};
|
||||
|
||||
/// A prototype for cable channels.
|
||||
@ -110,10 +111,9 @@ impl Deref for Cable {
|
||||
|
||||
impl Cable {
|
||||
pub fn default_channel(&self) -> ChannelPrototype {
|
||||
self.get(DEFAULT_PROTOTYPE_NAME)
|
||||
.cloned()
|
||||
.unwrap_or_else(|| {
|
||||
panic!("Default channel '{DEFAULT_PROTOTYPE_NAME}' not found")
|
||||
let default_channel = &default_channel();
|
||||
self.get(default_channel).cloned().unwrap_or_else(|| {
|
||||
panic!("Default channel '{default_channel}' not found")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ pub use themes::Theme;
|
||||
use tracing::{debug, warn};
|
||||
pub use ui::UiConfig;
|
||||
|
||||
use crate::channels::prototypes::DEFAULT_PROTOTYPE_NAME;
|
||||
|
||||
mod keybindings;
|
||||
pub mod shell_integration;
|
||||
mod themes;
|
||||
@ -41,8 +39,9 @@ pub struct AppConfig {
|
||||
pub default_channel: String,
|
||||
}
|
||||
|
||||
fn default_channel() -> String {
|
||||
DEFAULT_PROTOTYPE_NAME.to_string()
|
||||
pub fn default_channel() -> String {
|
||||
let config = Config::load_user_config(&get_config_dir()).unwrap();
|
||||
config.application.default_channel.to_string()
|
||||
}
|
||||
|
||||
impl Hash for AppConfig {
|
||||
|
Loading…
x
Reference in New Issue
Block a user