Initial checkin
This commit is contained in:
64
src/padfoot/connection_manager.rs
Normal file
64
src/padfoot/connection_manager.rs
Normal file
@@ -0,0 +1,64 @@
|
||||
use crate::telepathy;
|
||||
use dbus::{arg, tree};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ConnectionManager {}
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug)]
|
||||
pub struct CMData;
|
||||
|
||||
impl dbus::tree::DataType for CMData {
|
||||
type Tree = ();
|
||||
type Property = ();
|
||||
type Interface = ();
|
||||
type Method = ();
|
||||
type Signal = ();
|
||||
type ObjectPath = std::sync::Arc<ConnectionManager>;
|
||||
}
|
||||
|
||||
const PROTO: &'static str = "delta";
|
||||
|
||||
pub type Dict = HashMap<String, arg::Variant<Box<dyn arg::RefArg + 'static>>>;
|
||||
|
||||
impl telepathy::ConnectionManager for ConnectionManager {
|
||||
fn get_parameters(
|
||||
&self,
|
||||
protocol: &str,
|
||||
) -> Result<
|
||||
Vec<(
|
||||
String,
|
||||
u32,
|
||||
String,
|
||||
arg::Variant<Box<dyn arg::RefArg + 'static>>,
|
||||
)>,
|
||||
tree::MethodErr,
|
||||
> {
|
||||
Err(tree::MethodErr::no_arg()) // FIXME: should be NotImplemented
|
||||
}
|
||||
|
||||
fn list_protocols(&self) -> Result<Vec<String>, tree::MethodErr> {
|
||||
Ok(vec![PROTO.to_string()])
|
||||
}
|
||||
|
||||
fn request_connection(
|
||||
&self,
|
||||
protocol: &str,
|
||||
parameters: HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
|
||||
) -> Result<(String, dbus::Path<'static>), tree::MethodErr> {
|
||||
Err(tree::MethodErr::no_arg())
|
||||
}
|
||||
|
||||
fn protocols(&self) -> Result<HashMap<String, Dict>, tree::MethodErr> {
|
||||
let mut hm = HashMap::new();
|
||||
let mut props = Dict::new();
|
||||
|
||||
hm.insert(PROTO.to_string(), props);
|
||||
|
||||
Ok(hm)
|
||||
}
|
||||
|
||||
fn interfaces(&self) -> Result<Vec<String>, tree::MethodErr> {
|
||||
Err(tree::MethodErr::no_arg())
|
||||
}
|
||||
}
|
||||
2
src/padfoot/protocol.rs
Normal file
2
src/padfoot/protocol.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
pub struct Protocol {}
|
||||
|
||||
Reference in New Issue
Block a user