From bf521a7bbb2b36783895d448aa3d0cb28fa4906c Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 24 Apr 2024 17:04:53 -0700 Subject: [PATCH] user_manager: Start bringing up user manager --- com.steampowered.SteamOSManager1.xml | 21 +++++++++++++++++++ src/main.rs | 3 ++- src/user.rs | 6 ++++++ src/user_manager.rs | 30 ++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/user_manager.rs diff --git a/com.steampowered.SteamOSManager1.xml b/com.steampowered.SteamOSManager1.xml index 6121e85..e79f94c 100644 --- a/com.steampowered.SteamOSManager1.xml +++ b/com.steampowered.SteamOSManager1.xml @@ -254,4 +254,25 @@ + + + + + + + + diff --git a/src/main.rs b/src/main.rs index 08f6dad..f479d17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,12 +25,13 @@ mod root; mod sls; mod systemd; mod user; +mod user_manager; mod wifi; #[cfg(test)] mod testing; -const API_VERSION: u32 = 7; +const API_VERSION: u32 = 8; trait Service where diff --git a/src/user.rs b/src/user.rs index 183691a..b805030 100644 --- a/src/user.rs +++ b/src/user.rs @@ -13,12 +13,18 @@ use zbus::connection::Connection; use zbus::ConnectionBuilder; use crate::daemon::Daemon; +use crate::user_manager::SteamOSManagerUser; async fn create_connection() -> Result { let connection = ConnectionBuilder::session()? .name("com.steampowered.SteamOSManager1")? .build() .await?; + let manager = SteamOSManagerUser::new(connection.clone()).await?; + connection + .object_server() + .at("/com/steampowered/SteamOSManager1/User", manager) + .await?; Ok(connection) } diff --git a/src/user_manager.rs b/src/user_manager.rs new file mode 100644 index 0000000..462b161 --- /dev/null +++ b/src/user_manager.rs @@ -0,0 +1,30 @@ +/* + * Copyright © 2023 Collabora Ltd. + * Copyright © 2024 Valve Software + * Copyright © 2024 Igalia S.L. + * + * SPDX-License-Identifier: MIT + */ + +use anyhow::Result; +use zbus::{interface, Connection}; + +use crate::API_VERSION; + +pub struct SteamOSManagerUser { + connection: Connection, +} + +impl SteamOSManagerUser { + pub async fn new(connection: Connection) -> Result { + Ok(SteamOSManagerUser { connection }) + } +} + +#[interface(name = "com.steampowered.SteamOSManager1.UserManager")] +impl SteamOSManagerUser { + #[zbus(property(emits_changed_signal = "const"))] + async fn version(&self) -> u32 { + API_VERSION + } +}