Initial checkin
This commit is contained in:
61
src/telepathy/channel_handler.rs
Normal file
61
src/telepathy/channel_handler.rs
Normal file
@@ -0,0 +1,61 @@
|
||||
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Channel_Handler.xml -i org.freedesktop.Telepathy -o src/telepathy/channel_handler.rs`, see https://github.com/diwic/dbus-rs
|
||||
use dbus;
|
||||
use dbus::arg;
|
||||
use dbus::tree;
|
||||
|
||||
pub trait ChannelHandler {
|
||||
fn handle_channel(
|
||||
&self,
|
||||
bus_name: &str,
|
||||
connection: dbus::Path,
|
||||
channel_type: &str,
|
||||
channel: dbus::Path,
|
||||
handle_type: u32,
|
||||
handle: u32,
|
||||
) -> Result<(), tree::MethodErr>;
|
||||
}
|
||||
|
||||
pub fn channel_handler_server<F, T, D>(
|
||||
factory: &tree::Factory<tree::MTFn<D>, D>,
|
||||
data: D::Interface,
|
||||
f: F,
|
||||
) -> tree::Interface<tree::MTFn<D>, D>
|
||||
where
|
||||
D: tree::DataType,
|
||||
D::Method: Default,
|
||||
T: ChannelHandler,
|
||||
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
|
||||
{
|
||||
let i = factory.interface("org.freedesktop.Telepathy.ChannelHandler", data);
|
||||
let f = ::std::sync::Arc::new(f);
|
||||
let fclone = f.clone();
|
||||
let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| {
|
||||
let mut i = minfo.msg.iter_init();
|
||||
let bus_name: &str = i.read()?;
|
||||
let connection: dbus::Path = i.read()?;
|
||||
let channel_type: &str = i.read()?;
|
||||
let channel: dbus::Path = i.read()?;
|
||||
let handle_type: u32 = i.read()?;
|
||||
let handle: u32 = i.read()?;
|
||||
let d = fclone(minfo);
|
||||
d.handle_channel(
|
||||
bus_name,
|
||||
connection,
|
||||
channel_type,
|
||||
channel,
|
||||
handle_type,
|
||||
handle,
|
||||
)?;
|
||||
let rm = minfo.msg.method_return();
|
||||
Ok(vec![rm])
|
||||
};
|
||||
let m = factory.method("HandleChannel", Default::default(), h);
|
||||
let m = m.in_arg(("Bus_Name", "s"));
|
||||
let m = m.in_arg(("Connection", "o"));
|
||||
let m = m.in_arg(("Channel_Type", "s"));
|
||||
let m = m.in_arg(("Channel", "o"));
|
||||
let m = m.in_arg(("Handle_Type", "u"));
|
||||
let m = m.in_arg(("Handle", "u"));
|
||||
let i = i.add_m(m);
|
||||
i
|
||||
}
|
Reference in New Issue
Block a user