Don't build a new connection if it already exists

There was also a lot of unneeded overhead in Connection::new() to get
the path to compare against, so split that out into a settings struct
This commit is contained in:
2020-05-16 18:44:02 +01:00
parent e08ec6b476
commit 169249b716
8 changed files with 166 additions and 92 deletions

View File

@@ -25,7 +25,10 @@ impl telepathy::ConnectionInterfaceContacts for Connection {
) -> Result<HashMap<u32, HashMap<String, VarArgs>>, MethodErr> {
println!(
"Connection<{}>::get_contact_attributes({:?}, {:?}, {})",
self.id, handles, interfaces, hold
self.id(),
handles,
interfaces,
hold
);
let mut out = HashMap::<u32, HashMap<String, VarArgs>>::new();
@@ -73,13 +76,15 @@ impl telepathy::ConnectionInterfaceContacts for Connection {
) -> Result<(u32, HashMap<String, VarArgs>), MethodErr> {
println!(
"Connection<{}>::get_contact_by_id({}, {:?})",
self.id, identifier, interfaces
self.id(),
identifier,
interfaces
);
Err(MethodErr::no_arg()) // FIXME: should be NotImplemented?
}
fn contact_attribute_interfaces(&self) -> Result<Vec<String>, MethodErr> {
println!("Connection<{}>::contact_attribute_interfaces()", self.id);
println!("Connection<{}>::contact_attribute_interfaces()", self.id());
Ok(vec![
"org.freedesktop.Telepathy.Connection".to_string(),