user_manager: Start bringing up user manager

This commit is contained in:
Vicki Pfau 2024-04-24 17:04:53 -07:00
parent 65d8ff958e
commit bf521a7bbb
4 changed files with 59 additions and 1 deletions

View file

@ -254,4 +254,25 @@
</interface>
<!--
com.steampowered.SteamOSManager1.UserManager
@short_description: Interface to control various aspects of SteamOS running as a user.
Version available: 8
-->
<interface name="com.steampowered.SteamOSManager1.UserManager">
<!--
Version:
The version of this interface implemented by this object.
The manager may not support the latest version of the API.
Each method/property has an associated version number that
denotes in which interface version it first became available.
-->
<property name="Version" type="u" access="read"/>
</interface>
</node>

View file

@ -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

View file

@ -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<Connection> {
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)
}

30
src/user_manager.rs Normal file
View file

@ -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<Self> {
Ok(SteamOSManagerUser { connection })
}
}
#[interface(name = "com.steampowered.SteamOSManager1.UserManager")]
impl SteamOSManagerUser {
#[zbus(property(emits_changed_signal = "const"))]
async fn version(&self) -> u32 {
API_VERSION
}
}