Update to current zbus git

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2021-09-29 01:09:55 +04:00
parent b6f12103e9
commit 8fd2af4583
8 changed files with 23 additions and 32 deletions

View File

@ -61,7 +61,7 @@ trait Audio {
#[derivative(Debug)]
pub struct Audio {
#[derivative(Debug = "ignore")]
pub proxy: AsyncAudioProxy<'static>,
pub proxy: AudioProxy<'static>,
out_listener: Option<Connection>,
in_listener: Option<Connection>,
}
@ -226,7 +226,7 @@ impl<H: AudioInHandler> AudioInListener<H> {
impl Audio {
pub async fn new(conn: &zbus::Connection) -> Result<Self> {
let proxy = AsyncAudioProxy::new(conn).await?;
let proxy = AudioProxy::new(conn).await?;
Ok(Self {
proxy,
in_listener: None,

View File

@ -34,16 +34,13 @@ pub trait Chardev {
#[derive(derivative::Derivative)]
#[derivative(Debug)]
pub struct Chardev {
pub proxy: AsyncChardevProxy<'static>,
pub proxy: ChardevProxy<'static>,
}
impl Chardev {
pub async fn new(conn: &zbus::Connection, id: &str) -> Result<Self> {
let obj_path = ObjectPath::try_from(format!("/org/qemu/Display1/Chardev_{}", id))?;
let proxy = AsyncChardevProxy::builder(conn)
.path(&obj_path)?
.build()
.await?;
let proxy = ChardevProxy::builder(conn).path(&obj_path)?.build().await?;
Ok(Self { proxy })
}
}

View File

@ -90,14 +90,14 @@ impl<H: ClipboardHandler> ClipboardListener<H> {
#[derivative(Debug)]
pub struct Clipboard {
#[derivative(Debug = "ignore")]
pub proxy: AsyncClipboardProxy<'static>,
pub proxy: ClipboardProxy<'static>,
conn: zbus::Connection,
}
impl Clipboard {
pub async fn new(conn: &zbus::Connection) -> Result<Self> {
let obj_path = ObjectPath::try_from("/org/qemu/Display1/Clipboard").unwrap();
let proxy = AsyncClipboardProxy::builder(conn)
let proxy = ClipboardProxy::builder(conn)
.path(&obj_path)?
.build()
.await?;

View File

@ -9,7 +9,7 @@ use zbus::{
Connection,
};
use crate::{AsyncKeyboardProxy, AsyncMouseProxy, ConsoleListener, ConsoleListenerHandler, Result};
use crate::{ConsoleListener, ConsoleListenerHandler, KeyboardProxy, MouseProxy, Result};
#[dbus_proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Console")]
pub trait Console {
@ -48,29 +48,23 @@ pub trait Console {
#[derivative(Debug)]
pub struct Console {
#[derivative(Debug = "ignore")]
pub proxy: AsyncConsoleProxy<'static>,
pub proxy: ConsoleProxy<'static>,
#[derivative(Debug = "ignore")]
pub keyboard: AsyncKeyboardProxy<'static>,
pub keyboard: KeyboardProxy<'static>,
#[derivative(Debug = "ignore")]
pub mouse: AsyncMouseProxy<'static>,
pub mouse: MouseProxy<'static>,
listener: RefCell<Option<Connection>>,
}
impl Console {
pub async fn new(conn: &Connection, idx: u32) -> Result<Self> {
let obj_path = ObjectPath::try_from(format!("/org/qemu/Display1/Console_{}", idx))?;
let proxy = AsyncConsoleProxy::builder(conn)
.path(&obj_path)?
.build()
.await?;
let keyboard = AsyncKeyboardProxy::builder(conn)
.path(&obj_path)?
.build()
.await?;
let mouse = AsyncMouseProxy::builder(conn)
let proxy = ConsoleProxy::builder(conn).path(&obj_path)?.build().await?;
let keyboard = KeyboardProxy::builder(conn)
.path(&obj_path)?
.build()
.await?;
let mouse = MouseProxy::builder(conn).path(&obj_path)?.build().await?;
Ok(Self {
proxy,
keyboard,

View File

@ -11,7 +11,7 @@ use zbus::{
};
use zvariant::OwnedObjectPath;
use crate::{AsyncVMProxy, Audio, Chardev, Clipboard, Error, Result, UsbRedir};
use crate::{Audio, Chardev, Clipboard, Error, Result, UsbRedir, VMProxy};
pub struct Display {
conn: Connection,
@ -21,7 +21,7 @@ pub struct Display {
impl Display {
pub async fn by_name(conn: &Connection) -> Result<HashMap<String, OwnedUniqueName>> {
let mut hm = HashMap::new();
let list = match fdo::AsyncDBusProxy::new(conn)
let list = match fdo::DBusProxy::new(conn)
.await?
.list_queued_owners(WellKnownName::from_str_unchecked("org.qemu"))
.await
@ -31,7 +31,7 @@ impl Display {
Err(e) => return Err(e.into()),
};
for dest in list.into_iter() {
let name = AsyncVMProxy::builder(conn)
let name = VMProxy::builder(conn)
.destination(UniqueName::from(&dest))?
.build()
.await?
@ -52,7 +52,7 @@ impl Display {
} else {
"org.qemu".try_into().unwrap()
};
let objects = fdo::AsyncObjectManagerProxy::builder(conn)
let objects = fdo::ObjectManagerProxy::builder(conn)
.destination(dest)?
.path("/org/qemu/Display1")?
.build()

View File

@ -91,7 +91,7 @@ impl Handler {
Err(rusb::Error::Access) => {
let (bus, dev) = (device.bus_number(), device.address());
let sysbus = zbus::Connection::system().await?;
let fd = AsyncSystemHelperProxy::new(&sysbus)
let fd = SystemHelperProxy::new(&sysbus)
.await?
.open_bus_dev(bus, dev)
.await?;

View File

@ -12,7 +12,7 @@ use gtk::{
gdk, gio, glib,
prelude::{DisplayExt, *},
};
use qemu_display::{AsyncClipboardProxy, Clipboard, ClipboardHandler, ClipboardSelection};
use qemu_display::{Clipboard, ClipboardHandler, ClipboardProxy, ClipboardSelection};
use rdw::gtk;
#[derive(Debug)]
@ -25,7 +25,7 @@ pub struct Handler {
#[derive(Debug)]
struct InnerHandler {
proxy: AsyncClipboardProxy<'static>,
proxy: ClipboardProxy<'static>,
serials: Arc<[AtomicU32; 2]>,
}
@ -187,7 +187,7 @@ impl Drop for Handler {
}
fn watch_clipboard(
proxy: AsyncClipboardProxy<'static>,
proxy: ClipboardProxy<'static>,
selection: ClipboardSelection,
serials: Arc<[AtomicU32; 2]>,
) -> Option<SignalHandlerId> {

View File

@ -12,7 +12,7 @@ use std::{
use clap::Clap;
use image::GenericImage;
use keycodemap::*;
use qemu_display::{AsyncVMProxy, Console, ConsoleListenerHandler, MouseButton};
use qemu_display::{Console, ConsoleListenerHandler, MouseButton, VMProxy};
use vnc::{
server::{Event as VncEvent, FramebufferUpdate},
Encoding, Error as VncError, PixelFormat, Rect, Screen, Server as VncServer,
@ -478,7 +478,7 @@ async fn run() -> Result<(), Box<dyn Error>> {
}
.expect("Failed to connect to DBus");
let vm_name = AsyncVMProxy::new(&dbus).await?.name().await?;
let vm_name = VMProxy::new(&dbus).await?.name().await?;
let console = Console::new(&dbus.into(), 0)
.await