accesskit_unix/atspi/interfaces/
application.rs

1// Copyright 2022 The AccessKit Authors. All rights reserved.
2// Licensed under the Apache License, Version 2.0 (found in
3// the LICENSE-APACHE file) or the MIT license (found in
4// the LICENSE-MIT file), at your option.
5
6use accesskit_atspi_common::PlatformRoot;
7use zbus::{fdo, interface};
8
9use super::map_root_error;
10
11pub(crate) struct ApplicationInterface(pub PlatformRoot);
12
13#[interface(name = "org.a11y.atspi.Application")]
14impl ApplicationInterface {
15    #[zbus(property)]
16    fn toolkit_name(&self) -> fdo::Result<String> {
17        self.0.toolkit_name().map_err(map_root_error)
18    }
19
20    #[zbus(property)]
21    fn version(&self) -> fdo::Result<String> {
22        self.0.toolkit_version().map_err(map_root_error)
23    }
24
25    #[zbus(property)]
26    fn atspi_version(&self) -> &str {
27        "2.1"
28    }
29
30    #[zbus(property)]
31    fn id(&self) -> fdo::Result<i32> {
32        self.0.id().map_err(map_root_error)
33    }
34
35    #[zbus(property)]
36    fn set_id(&mut self, id: i32) -> fdo::Result<()> {
37        self.0.set_id(id).map_err(map_root_error)
38    }
39}