mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-02 03:01:04 +02:00
refactor: split bar/top-level config structs
This allows for some options which are not actually bar-level to be separated, which makes some work moving forward a little easier and keeps things cleaner.
This commit is contained in:
parent
4aab6d5061
commit
706e040e25
5 changed files with 81 additions and 56 deletions
12
src/bar.rs
12
src/bar.rs
|
@ -1,9 +1,9 @@
|
|||
use crate::config::{BarPosition, MarginConfig, ModuleConfig};
|
||||
use crate::config::{BarConfig, BarPosition, MarginConfig, ModuleConfig};
|
||||
use crate::modules::{
|
||||
create_module, set_widget_identifiers, wrap_widget, ModuleInfo, ModuleLocation,
|
||||
};
|
||||
use crate::popup::Popup;
|
||||
use crate::{Config, Ironbar};
|
||||
use crate::Ironbar;
|
||||
use color_eyre::Result;
|
||||
use glib::Propagation;
|
||||
use gtk::gdk::Monitor;
|
||||
|
@ -16,7 +16,7 @@ use tracing::{debug, info};
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
enum Inner {
|
||||
New { config: Option<Config> },
|
||||
New { config: Option<BarConfig> },
|
||||
Loaded { popup: Rc<Popup> },
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ impl Bar {
|
|||
pub fn new(
|
||||
app: &Application,
|
||||
monitor_name: String,
|
||||
config: Config,
|
||||
config: BarConfig,
|
||||
ironbar: Rc<Ironbar>,
|
||||
) -> Self {
|
||||
let window = ApplicationWindow::builder()
|
||||
|
@ -245,7 +245,7 @@ impl Bar {
|
|||
}
|
||||
|
||||
/// Loads the configured modules onto a bar.
|
||||
fn load_modules(&self, config: Config, monitor: &Monitor) -> Result<BarLoadResult> {
|
||||
fn load_modules(&self, config: BarConfig, monitor: &Monitor) -> Result<BarLoadResult> {
|
||||
let icon_theme = IconTheme::new();
|
||||
if let Some(ref theme) = config.icon_theme {
|
||||
icon_theme.set_custom_theme(Some(theme));
|
||||
|
@ -408,7 +408,7 @@ pub fn create_bar(
|
|||
app: &Application,
|
||||
monitor: &Monitor,
|
||||
monitor_name: String,
|
||||
config: Config,
|
||||
config: BarConfig,
|
||||
ironbar: Rc<Ironbar>,
|
||||
) -> Result<Bar> {
|
||||
let bar = Bar::new(app, monitor_name, config, ironbar);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue