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 | |
6 | use accesskit_atspi_common::PlatformRoot; |
7 | use zbus::fdo; |
8 | |
9 | use super::map_root_error; |
10 | |
11 | pub(crate) struct ApplicationInterface(pub PlatformRoot); |
12 | |
13 | #[dbus_interface (name = "org.a11y.atspi.Application" )] |
14 | impl ApplicationInterface { |
15 | #[dbus_interface (property)] |
16 | fn toolkit_name(&self) -> fdo::Result<String> { |
17 | self.0.toolkit_name().map_err(map_root_error) |
18 | } |
19 | |
20 | #[dbus_interface (property)] |
21 | fn version(&self) -> fdo::Result<String> { |
22 | self.0.toolkit_version().map_err(map_root_error) |
23 | } |
24 | |
25 | #[dbus_interface (property)] |
26 | fn atspi_version(&self) -> &str { |
27 | "2.1" |
28 | } |
29 | |
30 | #[dbus_interface (property)] |
31 | fn id(&self) -> fdo::Result<i32> { |
32 | self.0.id().map_err(map_root_error) |
33 | } |
34 | |
35 | #[dbus_interface (property)] |
36 | fn set_id(&mut self, id: i32) -> fdo::Result<()> { |
37 | self.0.set_id(id).map_err(map_root_error) |
38 | } |
39 | } |
40 | |