Fix features to improve portability
This commit is contained in:
parent
86e614a5ff
commit
d2c1756c86
7 changed files with 80 additions and 14 deletions
|
|
@ -76,7 +76,7 @@ xkb-data = "0.2.1"
|
|||
zbus = { version = "4.4.0", default-features = false, features = [
|
||||
"tokio",
|
||||
], optional = true }
|
||||
zbus_polkit = { version = "4.0.0" }
|
||||
zbus_polkit = { version = "4.0.0", optional = true }
|
||||
fontdb = "0.16.2"
|
||||
fixed_decimal = "0.5.6"
|
||||
mime = "0.3.17"
|
||||
|
|
@ -117,6 +117,7 @@ linux = [
|
|||
"page-bluetooth",
|
||||
"page-date",
|
||||
"page-default-apps",
|
||||
"page-display",
|
||||
"page-input",
|
||||
"page-networking",
|
||||
"page-power",
|
||||
|
|
@ -130,15 +131,25 @@ linux = [
|
|||
]
|
||||
|
||||
# Pages
|
||||
page-accessibility = ["dep:cosmic-protocols", "dep:sctk"]
|
||||
page-about = ["dep:cosmic-settings-system", "dep:hostname1-zbus", "dep:zbus"]
|
||||
page-accessibility = [
|
||||
"dep:cosmic-comp-config",
|
||||
"dep:cosmic-protocols",
|
||||
"dep:cosmic-settings-config",
|
||||
"dep:sctk",
|
||||
]
|
||||
page-about = [
|
||||
"dep:cosmic-settings-system",
|
||||
"dep:hostname1-zbus",
|
||||
"dep:zbus",
|
||||
]
|
||||
page-bluetooth = [
|
||||
"dep:bluez-zbus",
|
||||
"dep:zbus",
|
||||
"dep:cosmic-settings-subscriptions",
|
||||
]
|
||||
page-date = ["dep:timedate-zbus", "dep:zbus"]
|
||||
page-default-apps = ["dep:mime-apps"]
|
||||
page-default-apps = ["dep:cosmic-settings-config", "dep:mime-apps"]
|
||||
page-display = ["dep:udev"]
|
||||
page-input = [
|
||||
"gettext",
|
||||
"dep:cosmic-comp-config",
|
||||
|
|
@ -152,9 +163,19 @@ page-networking = [
|
|||
"dep:zbus",
|
||||
]
|
||||
page-power = ["dep:upower_dbus", "dep:zbus"]
|
||||
page-region = ["dep:lichen-system", "dep:locale1"]
|
||||
page-region = [
|
||||
"gettext",
|
||||
"dep:lichen-system",
|
||||
"dep:locale1",
|
||||
"dep:zbus",
|
||||
]
|
||||
page-sound = ["dep:cosmic-settings-subscriptions"]
|
||||
page-users = ["dep:accounts-zbus"]
|
||||
page-users = [
|
||||
"xdg-portal",
|
||||
"dep:accounts-zbus",
|
||||
"dep:zbus",
|
||||
"dep:zbus_polkit",
|
||||
]
|
||||
page-window-management = ["dep:cosmic-settings-config"]
|
||||
page-workspaces = ["dep:cosmic-comp-config"]
|
||||
|
||||
|
|
@ -164,6 +185,10 @@ ashpd = ["dep:ashpd"]
|
|||
dbus-config = ["libcosmic/dbus-config", "cosmic-config/dbus"]
|
||||
single-instance = ["libcosmic/single-instance"]
|
||||
test = []
|
||||
wayland = ["libcosmic/wayland", "dep:cosmic-panel-config", "dep:cosmic-randr"]
|
||||
wayland = [
|
||||
"libcosmic/wayland",
|
||||
"dep:cosmic-panel-config",
|
||||
"dep:cosmic-randr"
|
||||
]
|
||||
wgpu = ["libcosmic/wgpu"]
|
||||
xdg-portal = ["ashpd", "libcosmic/xdg-portal"]
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ use crate::pages::accessibility;
|
|||
#[cfg(feature = "page-bluetooth")]
|
||||
use crate::pages::bluetooth;
|
||||
use crate::pages::desktop::{self, appearance};
|
||||
#[cfg(feature = "page-display")]
|
||||
use crate::pages::display;
|
||||
#[cfg(feature = "page-input")]
|
||||
use crate::pages::input;
|
||||
#[cfg(feature = "page-networking")]
|
||||
|
|
@ -15,7 +17,7 @@ use crate::pages::networking;
|
|||
use crate::pages::power;
|
||||
#[cfg(feature = "page-sound")]
|
||||
use crate::pages::sound;
|
||||
use crate::pages::{self, display, system, time};
|
||||
use crate::pages::{self, system, time};
|
||||
use crate::subscription::desktop_files;
|
||||
use crate::widget::{page_title, search_header};
|
||||
use crate::PageCommands;
|
||||
|
|
@ -91,6 +93,7 @@ impl SettingsApp {
|
|||
#[cfg(feature = "page-default-apps")]
|
||||
PageCommands::DefaultApps => self.pages.page_id::<system::default_apps::Page>(),
|
||||
PageCommands::Desktop => self.pages.page_id::<desktop::Page>(),
|
||||
#[cfg(feature = "page-display")]
|
||||
PageCommands::Displays => self.pages.page_id::<display::Page>(),
|
||||
#[cfg(feature = "wayland")]
|
||||
PageCommands::Dock => self.pages.page_id::<desktop::dock::Page>(),
|
||||
|
|
@ -204,6 +207,7 @@ impl cosmic::Application for SettingsApp {
|
|||
#[cfg(feature = "page-accessibility")]
|
||||
app.insert_page::<accessibility::Page>();
|
||||
let desktop_id = app.insert_page::<desktop::Page>().id();
|
||||
#[cfg(feature = "page-display")]
|
||||
app.insert_page::<display::Page>();
|
||||
#[cfg(feature = "page-sound")]
|
||||
app.insert_page::<sound::Page>();
|
||||
|
|
@ -421,6 +425,7 @@ impl cosmic::Application for SettingsApp {
|
|||
page::update!(self.pages, message, desktop::workspaces::Page);
|
||||
}
|
||||
|
||||
#[cfg(feature = "page-display")]
|
||||
crate::pages::Message::Displays(message) => {
|
||||
if let Some(page) = self.pages.page_mut::<display::Page>() {
|
||||
return page.update(message).map(Into::into);
|
||||
|
|
@ -806,14 +811,16 @@ impl cosmic::Application for SettingsApp {
|
|||
_keys: &[&'static str],
|
||||
new_theme: &cosmic::cosmic_theme::Theme,
|
||||
) -> Task<Self::Message> {
|
||||
#[cfg(feature = "page-accessibility")]
|
||||
if let Some(page) = self.pages.page_mut::<accessibility::Page>() {
|
||||
page.update(accessibility::Message::SystemTheme(Box::new(
|
||||
new_theme.clone(),
|
||||
)))
|
||||
.map(Into::into)
|
||||
} else {
|
||||
Task::none()
|
||||
return page
|
||||
.update(accessibility::Message::SystemTheme(Box::new(
|
||||
new_theme.clone(),
|
||||
)))
|
||||
.map(Into::into);
|
||||
}
|
||||
|
||||
Task::none()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ pub enum PageCommands {
|
|||
/// Desktop settings page
|
||||
Desktop,
|
||||
/// Displays settings page
|
||||
#[cfg(feature = "page-display")]
|
||||
Displays,
|
||||
/// Dock settings page
|
||||
#[cfg(feature = "wayland")]
|
||||
|
|
@ -86,6 +87,7 @@ pub enum PageCommands {
|
|||
#[cfg(feature = "page-power")]
|
||||
Power,
|
||||
/// Region & Language settings page
|
||||
#[cfg(feature = "page-region")]
|
||||
RegionLanguage,
|
||||
/// Sound settings page
|
||||
#[cfg(feature = "page-sound")]
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use cosmic::cosmic_theme::{
|
|||
CornerRadii, Density, Spacing, Theme, ThemeBuilder, ThemeMode, DARK_THEME_BUILDER_ID,
|
||||
LIGHT_THEME_BUILDER_ID,
|
||||
};
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
use cosmic::dialog::file_chooser::{self, FileFilter};
|
||||
use cosmic::iced_core::{Alignment, Color, Length};
|
||||
use cosmic::iced_widget::scrollable::{Direction, Scrollbar};
|
||||
|
|
@ -322,18 +323,22 @@ impl
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
#[derive(Clone)]
|
||||
pub struct SaveResponse(pub Arc<file_chooser::save::Response>);
|
||||
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
impl std::fmt::Debug for SaveResponse {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str("SaveResponse")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
#[derive(Clone)]
|
||||
pub struct OpenResponse(pub Arc<file_chooser::open::FileResponse>);
|
||||
|
||||
#[cfg(feature = "xdg-portal")]
|
||||
impl std::fmt::Debug for OpenResponse {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str("OpenResponse")
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ pub mod accessibility;
|
|||
#[cfg(feature = "page-bluetooth")]
|
||||
pub mod bluetooth;
|
||||
pub mod desktop;
|
||||
#[cfg(feature = "page-display")]
|
||||
pub mod display;
|
||||
#[cfg(feature = "page-input")]
|
||||
pub mod input;
|
||||
|
|
@ -41,6 +42,7 @@ pub enum Message {
|
|||
DesktopWallpaper(desktop::wallpaper::Message),
|
||||
#[cfg(feature = "page-workspaces")]
|
||||
DesktopWorkspaces(desktop::workspaces::Message),
|
||||
#[cfg(feature = "page-display")]
|
||||
Displays(display::Message),
|
||||
#[cfg(feature = "wayland")]
|
||||
Dock(desktop::dock::Message),
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use cosmic_settings_page as page;
|
|||
|
||||
#[cfg(feature = "page-date")]
|
||||
pub mod date;
|
||||
#[cfg(feature = "page-region")]
|
||||
pub mod region;
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
|||
24
justfile
24
justfile
|
|
@ -159,6 +159,30 @@ heaptrack *args:
|
|||
zstd -dc < heaptrack.cosmic-settings.*.raw.zst + /usr/lib/heaptrack/libexec/heaptrack_env | zstd -c > heaptrack_env.cosmic-settings.zst
|
||||
heaptrack_gui heaptrack.cosmic-settings.zst
|
||||
|
||||
check-features:
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
cargo check --no-default-features
|
||||
cargo check
|
||||
for feature in \
|
||||
"page-accessibility" \
|
||||
"page-about" \
|
||||
"page-bluetooth" \
|
||||
"page-date" \
|
||||
"page-default-apps" \
|
||||
"page-display" \
|
||||
"page-input" \
|
||||
"page-networking" \
|
||||
"page-power" \
|
||||
"page-region" \
|
||||
"page-sound" \
|
||||
"page-users" \
|
||||
"page-window-management" \
|
||||
"page-workspaces"
|
||||
do
|
||||
cargo check --no-default-features --features "${feature}"
|
||||
done
|
||||
|
||||
# Dependencies
|
||||
cmd-depends := "
|
||||
cargo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue