open_with 0.1.2

Provides a multiplatform invocation interface to the native open-with interface for files.
Documentation
// This code was autogenerated with `dbus-codegen-rust -d org.freedesktop.FileManager1 -p /org/freedesktop/FileManager1`, see https://github.com/diwic/dbus-rs
use dbus::arg;
use dbus::blocking;

pub trait OrgFreedesktopDBusProperties {
    fn get(
        &self,
        interface_name: &str,
        property_name: &str,
    ) -> Result<arg::Variant<Box<dyn arg::RefArg + 'static>>, dbus::Error>;
    fn get_all(&self, interface_name: &str) -> Result<arg::PropMap, dbus::Error>;
    fn set(
        &self,
        interface_name: &str,
        property_name: &str,
        value: arg::Variant<Box<dyn arg::RefArg>>,
    ) -> Result<(), dbus::Error>;
}

#[derive(Debug)]
pub struct OrgFreedesktopDBusPropertiesPropertiesChanged {
    pub interface_name: String,
    pub changed_properties: arg::PropMap,
    pub invalidated_properties: Vec<String>,
}

impl arg::AppendAll for OrgFreedesktopDBusPropertiesPropertiesChanged {
    fn append(&self, i: &mut arg::IterAppend) {
        arg::RefArg::append(&self.interface_name, i);
        arg::RefArg::append(&self.changed_properties, i);
        arg::RefArg::append(&self.invalidated_properties, i);
    }
}

impl arg::ReadAll for OrgFreedesktopDBusPropertiesPropertiesChanged {
    fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
        Ok(OrgFreedesktopDBusPropertiesPropertiesChanged {
            interface_name: i.read()?,
            changed_properties: i.read()?,
            invalidated_properties: i.read()?,
        })
    }
}

impl dbus::message::SignalArgs for OrgFreedesktopDBusPropertiesPropertiesChanged {
    const NAME: &'static str = "PropertiesChanged";
    const INTERFACE: &'static str = "org.freedesktop.DBus.Properties";
}

impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>> OrgFreedesktopDBusProperties
    for blocking::Proxy<'a, C>
{
    fn get(
        &self,
        interface_name: &str,
        property_name: &str,
    ) -> Result<arg::Variant<Box<dyn arg::RefArg + 'static>>, dbus::Error> {
        self.method_call(
            "org.freedesktop.DBus.Properties",
            "Get",
            (interface_name, property_name),
        )
        .map(|r: (arg::Variant<Box<dyn arg::RefArg + 'static>>,)| r.0)
    }

    fn get_all(&self, interface_name: &str) -> Result<arg::PropMap, dbus::Error> {
        self.method_call(
            "org.freedesktop.DBus.Properties",
            "GetAll",
            (interface_name,),
        )
        .map(|r: (arg::PropMap,)| r.0)
    }

    fn set(
        &self,
        interface_name: &str,
        property_name: &str,
        value: arg::Variant<Box<dyn arg::RefArg>>,
    ) -> Result<(), dbus::Error> {
        self.method_call(
            "org.freedesktop.DBus.Properties",
            "Set",
            (interface_name, property_name, value),
        )
    }
}

pub trait OrgFreedesktopDBusIntrospectable {
    fn introspect(&self) -> Result<String, dbus::Error>;
}

impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>>
    OrgFreedesktopDBusIntrospectable for blocking::Proxy<'a, C>
{
    fn introspect(&self) -> Result<String, dbus::Error> {
        self.method_call("org.freedesktop.DBus.Introspectable", "Introspect", ())
            .map(|r: (String,)| r.0)
    }
}

pub trait OrgFreedesktopDBusPeer {
    fn ping(&self) -> Result<(), dbus::Error>;
    fn get_machine_id(&self) -> Result<String, dbus::Error>;
}

impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>> OrgFreedesktopDBusPeer
    for blocking::Proxy<'a, C>
{
    fn ping(&self) -> Result<(), dbus::Error> {
        self.method_call("org.freedesktop.DBus.Peer", "Ping", ())
    }

    fn get_machine_id(&self) -> Result<String, dbus::Error> {
        self.method_call("org.freedesktop.DBus.Peer", "GetMachineId", ())
            .map(|r: (String,)| r.0)
    }
}

pub trait OrgFreedesktopFileManager1 {
    fn show_folders(&self, uris: Vec<&str>, startup_id: &str) -> Result<(), dbus::Error>;
    fn show_items(&self, uris: Vec<&str>, startup_id: &str) -> Result<(), dbus::Error>;
    fn show_item_properties(&self, uris: Vec<&str>, startup_id: &str) -> Result<(), dbus::Error>;
    fn open_locations(&self) -> Result<Vec<String>, dbus::Error>;
    fn open_windows_with_locations(
        &self,
    ) -> Result<::std::collections::HashMap<String, Vec<String>>, dbus::Error>;
}

impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>> OrgFreedesktopFileManager1
    for blocking::Proxy<'a, C>
{
    fn show_folders(&self, uris: Vec<&str>, startup_id: &str) -> Result<(), dbus::Error> {
        self.method_call(
            "org.freedesktop.FileManager1",
            "ShowFolders",
            (uris, startup_id),
        )
    }

    fn show_items(&self, uris: Vec<&str>, startup_id: &str) -> Result<(), dbus::Error> {
        self.method_call(
            "org.freedesktop.FileManager1",
            "ShowItems",
            (uris, startup_id),
        )
    }

    fn show_item_properties(&self, uris: Vec<&str>, startup_id: &str) -> Result<(), dbus::Error> {
        self.method_call(
            "org.freedesktop.FileManager1",
            "ShowItemProperties",
            (uris, startup_id),
        )
    }

    fn open_locations(&self) -> Result<Vec<String>, dbus::Error> {
        <Self as blocking::stdintf::org_freedesktop_dbus::Properties>::get(
            self,
            "org.freedesktop.FileManager1",
            "OpenLocations",
        )
    }

    fn open_windows_with_locations(
        &self,
    ) -> Result<::std::collections::HashMap<String, Vec<String>>, dbus::Error> {
        <Self as blocking::stdintf::org_freedesktop_dbus::Properties>::get(
            self,
            "org.freedesktop.FileManager1",
            "OpenWindowsWithLocations",
        )
    }
}