Skip to content

Commit

Permalink
feat: add Region & Language page
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Nov 7, 2024
1 parent 1376067 commit 978f272
Show file tree
Hide file tree
Showing 8 changed files with 1,028 additions and 19 deletions.
104 changes: 98 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 25 additions & 10 deletions cosmic-settings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ license = "GPL-3.0-only"
[dependencies]
anyhow = "1.0"
as-result = "0.2.1"
ashpd = { version = "0.9", default-features = false, features = ["tokio"], optional = true }
ashpd = { version = "0.9", default-features = false, features = [
"tokio",
], optional = true }
async-channel = "2.3.1"
chrono = "0.4.38"
clap = { version = "4.5.17", features = ["derive"] }
Expand Down Expand Up @@ -39,6 +41,7 @@ indexmap = "2.5.0"
itertools = "0.13.0"
itoa = "1.0.11"
libcosmic.workspace = true
locale1 = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
notify = "6.1.1"
once_cell = "1.19.0"
regex = "1.10.6"
Expand All @@ -63,6 +66,7 @@ xkb-data = "0.2.1"
zbus = { version = "4.4.0", features = ["tokio"], optional = true }
ustr = "1.0.0"
fontdb = "0.16.2"
fixed_decimal = "0.5.6"

[dependencies.cosmic-settings-subscriptions]
git = "https://github.com/pop-os/cosmic-settings-subscriptions"
Expand All @@ -78,14 +82,14 @@ features = ["experimental", "compiled_data", "icu_datetime_experimental"]
version = "0.15.0"
features = ["fluent-system", "desktop-requester"]

# Contains region-handling logic for Linux
[dependencies.lichen-system]
git = "https://github.com/serpent-os/lichen"
package = "system"
optional = true

[features]
default = [
"a11y",
"dbus-config",
"linux",
"single-instance",
"wgpu",
]
default = ["a11y", "dbus-config", "linux", "single-instance", "wgpu"]

# Default features for Linux
linux = [
Expand All @@ -95,6 +99,7 @@ linux = [
"page-input",
"page-networking",
"page-power",
"page-region",
"page-sound",
"page-window-management",
"page-workspaces",
Expand All @@ -106,9 +111,19 @@ linux = [
page-about = ["dep:cosmic-settings-system", "dep:hostname1-zbus", "dep:zbus"]
page-bluetooth = ["dep:bluez-zbus", "dep:zbus"]
page-date = ["dep:timedate-zbus", "dep:zbus"]
page-input = ["dep:cosmic-comp-config", "dep:cosmic-settings-config", "dep:udev"]
page-networking = ["ashpd", "dep:cosmic-dbus-networkmanager", "dep:cosmic-settings-subscriptions", "dep:zbus"]
page-input = [
"dep:cosmic-comp-config",
"dep:cosmic-settings-config",
"dep:udev",
]
page-networking = [
"ashpd",
"dep:cosmic-dbus-networkmanager",
"dep:cosmic-settings-subscriptions",
"dep:zbus",
]
page-power = ["dep:upower_dbus", "dep:zbus"]
page-region = ["dep:lichen-system", "dep:locale1"]
page-sound = ["dep:cosmic-settings-subscriptions"]
page-window-management = ["dep:cosmic-settings-config"]
page-workspaces = ["dep:cosmic-comp-config"]
Expand Down
8 changes: 8 additions & 0 deletions cosmic-settings/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ impl SettingsApp {
PageCommands::Panel => self.pages.page_id::<desktop::panel::Page>(),
#[cfg(feature = "page-power")]
PageCommands::Power => self.pages.page_id::<power::Page>(),
#[cfg(feature = "page-region")]
PageCommands::RegionLanguage => self.pages.page_id::<time::region::Page>(),
#[cfg(feature = "page-sound")]
PageCommands::Sound => self.pages.page_id::<sound::Page>(),
Expand Down Expand Up @@ -480,6 +481,13 @@ impl cosmic::Application for SettingsApp {
}
}

#[cfg(feature = "page-region")]
crate::pages::Message::Region(message) => {
if let Some(page) = self.pages.page_mut::<time::region::Page>() {
return page.update(message).map(Into::into);
}
}

#[cfg(feature = "page-sound")]
crate::pages::Message::Sound(message) => {
if let Some(page) = self.pages.page_mut::<sound::Page>() {
Expand Down
2 changes: 2 additions & 0 deletions cosmic-settings/src/pages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ pub enum Message {
PanelApplet(desktop::panel::applets_inner::Message),
#[cfg(feature = "page-power")]
Power(power::Message),
#[cfg(feature = "page-region")]
Region(time::region::Message),
#[cfg(feature = "page-sound")]
Sound(sound::Message),
#[cfg(feature = "page-input")]
Expand Down
7 changes: 6 additions & 1 deletion cosmic-settings/src/pages/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ impl page::AutoBind<crate::pages::Message> for Page {
{
page = page.sub_page::<date::Page>();
}
page = page.sub_page::<region::Page>();

#[cfg(feature = "page-region")]
{
page = page.sub_page::<region::Page>();
}

page
}
}
Loading

0 comments on commit 978f272

Please sign in to comment.