Bind spaces to default profiles
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::SpaceId;
|
||||
use crate::{ProfileId, SpaceId};
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum ArchivePolicy {
|
||||
@@ -12,17 +12,24 @@ pub struct Space {
|
||||
name: String,
|
||||
icon: String,
|
||||
accent_hex: u32,
|
||||
default_profile_id: ProfileId,
|
||||
archive_policy: ArchivePolicy,
|
||||
}
|
||||
|
||||
impl Space {
|
||||
#[must_use]
|
||||
pub fn new(name: impl Into<String>, icon: impl Into<String>, accent_hex: u32) -> Self {
|
||||
pub fn new(
|
||||
name: impl Into<String>,
|
||||
icon: impl Into<String>,
|
||||
accent_hex: u32,
|
||||
default_profile_id: ProfileId,
|
||||
) -> Self {
|
||||
Self {
|
||||
id: SpaceId::new(),
|
||||
name: name.into(),
|
||||
icon: icon.into(),
|
||||
accent_hex,
|
||||
default_profile_id,
|
||||
archive_policy: ArchivePolicy::Manual,
|
||||
}
|
||||
}
|
||||
@@ -47,6 +54,15 @@ impl Space {
|
||||
self.accent_hex
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn default_profile_id(&self) -> &ProfileId {
|
||||
&self.default_profile_id
|
||||
}
|
||||
|
||||
pub fn set_default_profile_id(&mut self, profile_id: ProfileId) {
|
||||
self.default_profile_id = profile_id;
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn archive_policy(&self) -> &ArchivePolicy {
|
||||
&self.archive_policy
|
||||
|
||||
Reference in New Issue
Block a user