chore: Use namespace with flatpak compatibility

This commit is contained in:
Fabio Lenherr / DashieTM 2023-12-12 22:35:16 +01:00
parent 770bdda317
commit 3ed909a5e4
21 changed files with 296 additions and 270 deletions

View file

@ -66,12 +66,12 @@ fn set_card_profile_of_device(device_index: u32, profile_name: String) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org.Xetibo.ReSet.Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetCardProfileOfDevice",
(device_index, profile_name),
);

View file

@ -53,12 +53,12 @@ impl Listeners {
thread::spawn(|| {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(bool,), Error> =
proxy.method_call("org.Xetibo.ReSetWireless", "StopNetworkListener", ());
proxy.method_call("org.Xetibo.ReSet.Wireless", "StopNetworkListener", ());
});
}
@ -90,7 +90,7 @@ impl arg::ReadAll for SinkAdded {
impl dbus::message::SignalArgs for SinkAdded {
const NAME: &'static str = "SinkAdded";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(Sink,)> for SinkAdded {
@ -118,7 +118,7 @@ impl arg::ReadAll for SinkChanged {
impl dbus::message::SignalArgs for SinkChanged {
const NAME: &'static str = "SinkChanged";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(Sink,)> for SinkChanged {
@ -146,7 +146,7 @@ impl arg::ReadAll for SinkRemoved {
impl dbus::message::SignalArgs for SinkRemoved {
const NAME: &'static str = "SinkRemoved";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(u32,)> for SinkRemoved {
@ -174,7 +174,7 @@ impl arg::ReadAll for InputStreamAdded {
impl dbus::message::SignalArgs for InputStreamAdded {
const NAME: &'static str = "InputStreamAdded";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(InputStream,)> for InputStreamAdded {
@ -202,7 +202,7 @@ impl arg::ReadAll for InputStreamChanged {
impl dbus::message::SignalArgs for InputStreamChanged {
const NAME: &'static str = "InputStreamChanged";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
#[derive(Debug)]
@ -224,7 +224,7 @@ impl arg::ReadAll for InputStreamRemoved {
impl dbus::message::SignalArgs for InputStreamRemoved {
const NAME: &'static str = "InputStreamRemoved";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(u32,)> for InputStreamRemoved {
@ -252,7 +252,7 @@ impl arg::ReadAll for SourceAdded {
impl dbus::message::SignalArgs for SourceAdded {
const NAME: &'static str = "SourceAdded";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(Source,)> for SourceAdded {
@ -280,7 +280,7 @@ impl arg::ReadAll for SourceChanged {
impl dbus::message::SignalArgs for SourceChanged {
const NAME: &'static str = "SourceChanged";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(Source,)> for SourceChanged {
@ -308,7 +308,7 @@ impl arg::ReadAll for SourceRemoved {
impl dbus::message::SignalArgs for SourceRemoved {
const NAME: &'static str = "SourceRemoved";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(u32,)> for SourceRemoved {
@ -336,7 +336,7 @@ impl arg::ReadAll for OutputStreamAdded {
impl dbus::message::SignalArgs for OutputStreamAdded {
const NAME: &'static str = "OutputStreamAdded";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(OutputStream,)> for OutputStreamAdded {
@ -364,7 +364,7 @@ impl arg::ReadAll for OutputStreamChanged {
impl dbus::message::SignalArgs for OutputStreamChanged {
const NAME: &'static str = "OutputStreamChanged";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
#[derive(Debug)]
@ -386,7 +386,7 @@ impl arg::ReadAll for OutputStreamRemoved {
impl dbus::message::SignalArgs for OutputStreamRemoved {
const NAME: &'static str = "OutputStreamRemoved";
const INTERFACE: &'static str = "org.Xetibo.ReSetAudio";
const INTERFACE: &'static str = "org.Xetibo.ReSet.Audio";
}
impl GetVal<(u32,)> for OutputStreamRemoved {
@ -431,19 +431,19 @@ pub fn start_audio_listener(
fn start_dbus_audio_listener(conn: Connection) -> Connection {
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call("org.Xetibo.ReSetAudio", "StartAudioListener", ());
let _: Result<(), Error> = proxy.method_call("org.Xetibo.ReSet.Audio", "StartAudioListener", ());
conn
}
fn stop_dbus_audio_listener(conn: Connection) {
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call("org.Xetibo.ReSetAudio", "StopAudioListener", ());
let _: Result<(), Error> = proxy.method_call("org.Xetibo.ReSet.Audio", "StopAudioListener", ());
}

View file

@ -123,6 +123,11 @@ pub fn populate_conntected_bluetooth_devices(bluetooth_box: Arc<BluetoothBox>) {
let list = imp.reset_model_list.write().unwrap();
let mut model_index = imp.reset_model_index.write().unwrap();
let mut map = imp.reset_bluetooth_adapters.write().unwrap();
{
if imp.reset_bluetooth_adapters.read().unwrap().is_empty() {
return;
}
}
imp.reset_current_bluetooth_adapter
.replace(adapters.last().unwrap().clone());
for (index, adapter) in adapters.into_iter().enumerate() {
@ -204,25 +209,25 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Dameon",
Duration::from_millis(1000),
);
let _: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetBluetooth", "StartBluetoothListener", ());
proxy.method_call("org.Xetibo.ReSet.Bluetooth", "StartBluetoothListener", ());
let device_added = BluetoothDeviceAdded::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Dameon")),
)
.static_clone();
let device_removed = BluetoothDeviceRemoved::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Dameon")),
)
.static_clone();
let device_changed = BluetoothDeviceChanged::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Dameon")),
)
.static_clone();
let device_added_box = bluetooth_box.clone();
@ -329,7 +334,7 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
let _ = conn.process(Duration::from_millis(1000));
if !listeners.bluetooth_listener.load(Ordering::SeqCst) {
let _: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetBluetooth", "StopBluetoothListener", ());
proxy.method_call("org.Xetibo.ReSet.Bluetooth", "StopBluetoothListener", ());
break;
}
if listener_active && time.elapsed().unwrap() > Duration::from_millis(10000) {
@ -344,7 +349,7 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
});
});
let _: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetBluetooth", "StopBluetoothScan", ());
proxy.method_call("org.Xetibo.ReSet.Bluetooth", "StopBluetoothScan", ());
}
if !listener_active && listeners.bluetooth_scan_requested.load(Ordering::SeqCst) {
listeners
@ -352,7 +357,7 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
.store(false, Ordering::SeqCst);
listener_active = true;
let _: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetBluetooth", "StartBluetoothListener", ());
proxy.method_call("org.Xetibo.ReSet.Bluetooth", "StartBluetoothListener", ());
time = SystemTime::now();
}
thread::sleep(Duration::from_millis(100));
@ -363,12 +368,12 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
fn get_connected_devices() -> Vec<BluetoothDevice> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Dameon",
Duration::from_millis(1000),
);
let res: Result<(Vec<BluetoothDevice>,), Error> = proxy.method_call(
"org.Xetibo.ReSetBluetooth",
"org.Xetibo.ReSet.Bluetooth",
"GetConnectedBluetoothDevices",
(),
);
@ -381,12 +386,12 @@ fn get_connected_devices() -> Vec<BluetoothDevice> {
fn get_bluetooth_adapters() -> Vec<BluetoothAdapter> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Dameon",
Duration::from_millis(1000),
);
let res: Result<(Vec<BluetoothAdapter>,), Error> =
proxy.method_call("org.Xetibo.ReSetBluetooth", "GetBluetoothAdapters", ());
proxy.method_call("org.Xetibo.ReSet.Bluetooth", "GetBluetoothAdapters", ());
if res.is_err() {
return Vec::new();
}
@ -396,23 +401,23 @@ fn get_bluetooth_adapters() -> Vec<BluetoothAdapter> {
fn set_bluetooth_adapter(path: Path<'static>) {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Dameon",
Duration::from_millis(1000),
);
let _: Result<(Vec<BluetoothAdapter>,), Error> =
proxy.method_call("org.Xetibo.ReSetBluetooth", "SetBluetoothAdapter", (path,));
proxy.method_call("org.Xetibo.ReSet.Bluetooth", "SetBluetoothAdapter", (path,));
}
fn set_bluetooth_adapter_visibility(path: Path<'static>, visible: bool) {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Dameon",
Duration::from_millis(1000),
);
let _: Result<(bool,), Error> = proxy.method_call(
"org.Xetibo.ReSetBluetooth",
"org.Xetibo.ReSet.Bluetooth",
"SetBluetoothAdapterDiscoverability",
(path, visible),
);
@ -421,12 +426,12 @@ fn set_bluetooth_adapter_visibility(path: Path<'static>, visible: bool) {
fn set_bluetooth_adapter_pairability(path: Path<'static>, visible: bool) {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Dameon",
Duration::from_millis(1000),
);
let _: Result<(bool,), Error> = proxy.method_call(
"org.Xetibo.ReSetBluetooth",
"org.Xetibo.ReSet.Bluetooth",
"SetBluetoothAdapterPairability",
(path, visible),
);
@ -435,12 +440,12 @@ fn set_bluetooth_adapter_pairability(path: Path<'static>, visible: bool) {
fn set_adapter_enabled(path: Path<'static>, enabled: bool) {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Dameon",
Duration::from_millis(1000),
);
let _: Result<(Vec<BluetoothAdapter>,), Error> = proxy.method_call(
"org.Xetibo.ReSetBluetooth",
"org.Xetibo.ReSet.Bluetooth",
"SetBluetoothAdapterEnabled",
(path, enabled),
);

View file

@ -87,12 +87,12 @@ fn connect_to_device(entry: Arc<BluetoothEntry>, path: Path<'static>) {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(bool,), Error> = proxy.method_call(
"org.Xetibo.ReSetBluetooth",
"org.Xetibo.ReSet.Bluetooth",
"ConnectToBluetoothDevice",
(path,),
);
@ -118,12 +118,12 @@ fn connect_to_device(entry: Arc<BluetoothEntry>, path: Path<'static>) {
// gio::spawn_blocking(move || {
// let conn = Connection::new_session().unwrap();
// let proxy = conn.with_proxy(
// "org.Xetibo.ReSetDaemon",
// "/org/Xetibo/ReSetDaemon",
// "org.Xetibo.ReSet.Daemon",
// "/org/Xetibo/ReSet/Daemon",
// Duration::from_millis(1000),
// );
// let _: Result<(bool,), Error> = proxy.method_call(
// "org.Xetibo.ReSetBluetooth",
// "org.Xetibo.ReSet.Bluetooth",
// "PairWithBluetoothDevice",
// (path,),
// );
@ -134,12 +134,12 @@ fn disconnect_from_device(entry: Arc<BluetoothEntry>, path: Path<'static>) {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(bool,), Error> = proxy.method_call(
"org.Xetibo.ReSetBluetooth",
"org.Xetibo.ReSet.Bluetooth",
"DisconnectFromBluetoothDevice",
(path,),
);
@ -164,11 +164,11 @@ fn remove_device_pairing(path: Path<'static>) {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(bool,), Error> =
proxy.method_call("org.Xetibo.ReSetBluetooth", "RemoveDevicePairing", (path,));
proxy.method_call("org.Xetibo.ReSet.Bluetooth", "RemoveDevicePairing", (path,));
});
}

View file

@ -134,12 +134,12 @@ fn set_outputstream_volume(value: f64, index: u32, channels: u16) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetOutputStreamVolume",
(index, channels, value as u32),
);
@ -155,12 +155,12 @@ fn toggle_output_stream_mute(index: u32, muted: bool) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetOutputStreamMute",
(index, muted),
);
@ -176,12 +176,12 @@ fn set_source_of_output_stream(stream: u32, source: u32) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(bool,), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetSourceOfOutputStream",
(stream, source),
);

View file

@ -312,12 +312,12 @@ pub fn populate_cards(input_box: Arc<SourceBox>) {
fn get_output_streams() -> Vec<OutputStream> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Vec<OutputStream>,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "ListOutputStreams", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "ListOutputStreams", ());
if res.is_err() {
return Vec::new();
}
@ -327,12 +327,12 @@ fn get_output_streams() -> Vec<OutputStream> {
fn get_sources() -> Vec<Source> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Vec<Source>,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "ListSources", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "ListSources", ());
if res.is_err() {
return Vec::new();
}
@ -342,12 +342,12 @@ fn get_sources() -> Vec<Source> {
fn get_cards() -> Vec<Card> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Vec<Card>,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "ListCards", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "ListCards", ());
if res.is_err() {
return Vec::new();
}
@ -357,12 +357,12 @@ fn get_cards() -> Vec<Card> {
fn get_default_source_name() -> String {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(String,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "GetDefaultSourceName", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "GetDefaultSourceName", ());
if res.is_err() {
return String::from("");
}
@ -372,12 +372,12 @@ fn get_default_source_name() -> String {
fn get_default_source() -> Source {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Source,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "GetDefaultSource", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "GetDefaultSource", ());
if res.is_err() {
return Source::default();
}
@ -386,33 +386,33 @@ fn get_default_source() -> Source {
pub fn start_input_box_listener(conn: Connection, source_box: Arc<SourceBox>) -> Connection {
let source_added = SourceAdded::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let source_removed = SourceRemoved::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let source_changed = SourceChanged::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let output_stream_added = OutputStreamAdded::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let output_stream_removed = OutputStreamRemoved::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let output_stream_changed = OutputStreamChanged::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();

View file

@ -105,12 +105,12 @@ pub fn set_source_volume(value: f64, index: u32, channels: u16) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetSourceVolume",
(index, channels, value as u32),
);
@ -126,12 +126,12 @@ pub fn toggle_source_mute(index: u32, muted: bool) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "SetSourceMute", (index, muted));
proxy.method_call("org.Xetibo.ReSet.Audio", "SetSourceMute", (index, muted));
// if res.is_err() {
// return false;
// }
@ -143,12 +143,12 @@ pub fn toggle_source_mute(index: u32, muted: bool) -> bool {
pub fn set_default_source(name: Arc<String>) -> Option<Source> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Source,), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetDefaultSource",
(name.as_str(),),
);

View file

@ -161,12 +161,12 @@ fn set_inputstream_volume(value: f64, index: u32, channels: u16) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetInputStreamVolume",
(index, channels, value as u32),
);
@ -182,12 +182,12 @@ fn toggle_input_stream_mute(index: u32, muted: bool) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetInputStreamMute",
(index, muted),
);
@ -203,12 +203,12 @@ fn set_sink_of_input_stream(stream: u32, sink: u32) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetSinkOfInputStream",
(stream, sink),
);

View file

@ -310,12 +310,12 @@ pub fn populate_cards(output_box: Arc<SinkBox>) {
fn get_input_streams() -> Vec<InputStream> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Vec<InputStream>,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "ListInputStreams", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "ListInputStreams", ());
if res.is_err() {
return Vec::new();
}
@ -325,12 +325,12 @@ fn get_input_streams() -> Vec<InputStream> {
fn get_sinks() -> Vec<Sink> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Vec<Sink>,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "ListSinks", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "ListSinks", ());
if res.is_err() {
return Vec::new();
}
@ -340,12 +340,12 @@ fn get_sinks() -> Vec<Sink> {
fn get_cards() -> Vec<Card> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Vec<Card>,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "ListCards", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "ListCards", ());
if res.is_err() {
return Vec::new();
}
@ -355,12 +355,12 @@ fn get_cards() -> Vec<Card> {
fn get_default_sink_name() -> String {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(String,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "GetDefaultSinkName", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "GetDefaultSinkName", ());
if res.is_err() {
return String::from("");
}
@ -370,12 +370,12 @@ fn get_default_sink_name() -> String {
fn get_default_sink() -> Sink {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Sink,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "GetDefaultSink", ());
proxy.method_call("org.Xetibo.ReSet.Audio", "GetDefaultSink", ());
if res.is_err() {
return Sink::default();
}
@ -384,33 +384,33 @@ fn get_default_sink() -> Sink {
pub fn start_output_box_listener(conn: Connection, sink_box: Arc<SinkBox>) -> Connection {
let sink_added = SinkAdded::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let sink_removed = SinkRemoved::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let sink_changed = SinkChanged::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let input_stream_added = InputStreamAdded::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let input_stream_removed = InputStreamRemoved::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let input_stream_changed = InputStreamChanged::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();

View file

@ -103,12 +103,12 @@ pub fn set_sink_volume(value: f64, index: u32, channels: u16) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call(
"org.Xetibo.ReSetAudio",
"org.Xetibo.ReSet.Audio",
"SetSinkVolume",
(index, channels, value as u32),
);
@ -124,12 +124,12 @@ pub fn toggle_sink_mute(index: u32, muted: bool) -> bool {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "SetSinkMute", (index, muted));
proxy.method_call("org.Xetibo.ReSet.Audio", "SetSinkMute", (index, muted));
// if res.is_err() {
// return false;
// }
@ -141,12 +141,12 @@ pub fn toggle_sink_mute(index: u32, muted: bool) -> bool {
pub fn set_default_sink(name: Arc<String>) -> Option<Sink> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Sink,), Error> =
proxy.method_call("org.Xetibo.ReSetAudio", "SetDefaultSink", (name.as_str(),));
proxy.method_call("org.Xetibo.ReSet.Audio", "SetDefaultSink", (name.as_str(),));
if res.is_err() {
return None;
}

View file

@ -66,11 +66,11 @@ fn delete_connection(path: Path<'static>) {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetWireless", "DeleteConnection", (path,));
proxy.method_call("org.Xetibo.ReSet.Wireless", "DeleteConnection", (path,));
});
}

View file

@ -19,12 +19,12 @@ type ResultType =
pub fn get_connection_settings(path: Path<'static>) -> ResetConnection {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: ResultType =
proxy.method_call("org.Xetibo.ReSetWireless", "GetConnectionSettings", (path,));
proxy.method_call("org.Xetibo.ReSet.Wireless", "GetConnectionSettings", (path,));
if res.is_err() {
ResetConnection::default();
}

View file

@ -103,6 +103,11 @@ pub fn scan_for_wifi(wifi_box: Arc<WifiBox>) {
let list = imp.reset_model_list.write().unwrap();
let mut model_index = imp.reset_model_index.write().unwrap();
let mut map = imp.reset_wifi_devices.write().unwrap();
{
if imp.reset_current_wifi_device.borrow().path == Path::from("/") {
return;
}
}
imp.reset_current_wifi_device
.replace(devices.last().unwrap().clone());
for (index, device) in devices.into_iter().enumerate() {
@ -188,23 +193,23 @@ pub fn show_stored_connections(wifi_box: Arc<WifiBox>) {
pub fn dbus_start_network_events() {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetWireless", "StartNetworkListener", ());
proxy.method_call("org.Xetibo.ReSet.Wireless", "StartNetworkListener", ());
}
pub fn get_access_points() -> Vec<AccessPoint> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Vec<AccessPoint>,), Error> =
proxy.method_call("org.Xetibo.ReSetWireless", "ListAccessPoints", ());
proxy.method_call("org.Xetibo.ReSet.Wireless", "ListAccessPoints", ());
if res.is_err() {
return Vec::new();
}
@ -215,23 +220,23 @@ pub fn get_access_points() -> Vec<AccessPoint> {
pub fn set_wifi_device(path: Path<'static>) {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(bool,), Error> =
proxy.method_call("org.Xetibo.ReSetWireless", "SetWifiDevice", (path,));
proxy.method_call("org.Xetibo.ReSet.Wireless", "SetWifiDevice", (path,));
}
pub fn get_wifi_devices() -> Vec<WifiDevice> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(Vec<WifiDevice>,), Error> =
proxy.method_call("org.Xetibo.ReSetWireless", "GetAllWifiDevices", ());
proxy.method_call("org.Xetibo.ReSet.Wireless", "GetAllWifiDevices", ());
if res.is_err() {
return Vec::new();
}
@ -242,12 +247,12 @@ pub fn get_wifi_devices() -> Vec<WifiDevice> {
pub fn get_wifi_status() -> bool {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: Result<(bool,), Error> =
proxy.method_call("org.Xetibo.ReSetWireless", "GetWifiStatus", ());
proxy.method_call("org.Xetibo.ReSet.Wireless", "GetWifiStatus", ());
if res.is_err() {
return false;
}
@ -257,11 +262,12 @@ pub fn get_wifi_status() -> bool {
pub fn get_stored_connections() -> Vec<(Path<'static>, Vec<u8>)> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let res: ResultMap = proxy.method_call("org.Xetibo.ReSetWireless", "ListStoredConnections", ());
let res: ResultMap =
proxy.method_call("org.Xetibo.ReSet.Wireless", "ListStoredConnections", ());
if res.is_err() {
return Vec::new();
}
@ -272,12 +278,12 @@ pub fn get_stored_connections() -> Vec<(Path<'static>, Vec<u8>)> {
pub fn set_wifi_enabled(enabled: bool) {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(bool,), Error> =
proxy.method_call("org.Xetibo.ReSetWireless", "SetWifiEnabled", (enabled,));
proxy.method_call("org.Xetibo.ReSet.Wireless", "SetWifiEnabled", (enabled,));
}
pub fn start_event_listener(listeners: Arc<Listeners>, wifi_box: Arc<WifiBox>) {
@ -295,23 +301,23 @@ pub fn start_event_listener(listeners: Arc<Listeners>, wifi_box: Arc<WifiBox>) {
let changed_ref = wifi_box.clone();
let wifi_changed_ref = wifi_box.clone();
let access_point_added = AccessPointAdded::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let access_point_removed = AccessPointRemoved::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let access_point_changed = AccessPointChanged::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let device_changed = WifiDeviceChanged::match_rule(
Some(&"org.Xetibo.ReSetDaemon".into()),
Some(&Path::from("/org/Xetibo/ReSetDaemon")),
Some(&"org.Xetibo.ReSet.Daemon".into()),
Some(&Path::from("/org/Xetibo/ReSet/Daemon")),
)
.static_clone();
let res = conn.add_match(access_point_added, move |ir: AccessPointAdded, _, _| {

View file

@ -123,12 +123,12 @@ pub fn click_disconnect(entry: Arc<WifiEntry>) {
let imp = entry_ref.imp();
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(10000),
);
let res: Result<(bool,), Error> = proxy.method_call(
"org.Xetibo.ReSetWireless",
"org.Xetibo.ReSet.Wireless",
"DisconnectFromCurrentAccessPoint",
(),
);
@ -154,12 +154,12 @@ pub fn click_stored_network(entry: Arc<WifiEntry>) {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(10000),
);
let res: Result<(bool,), Error> = proxy.method_call(
"org.Xetibo.ReSetWireless",
"org.Xetibo.ReSet.Wireless",
"ConnectToKnownAccessPoint",
(access_point,),
);
@ -197,12 +197,12 @@ pub fn click_new_network(entry: Arc<WifiEntry>) {
gio::spawn_blocking(move || {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(10000),
);
let res: Result<(bool,), Error> = proxy.method_call(
"org.Xetibo.ReSetWireless",
"org.Xetibo.ReSet.Wireless",
"ConnectToNewAccessPoint",
(access_point, password),
);

View file

@ -389,12 +389,12 @@ fn set_connection_settings(path: Path<'static>, prop: HashMap<String, PropMap>)
gio::spawn_blocking(move || {
let conn = dbus::blocking::Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(1000),
);
let _: Result<(bool,), Error> = proxy.method_call(
"org.Xetibo.ReSetWireless",
"org.Xetibo.ReSet.Wireless",
"SetConnectionSettings",
(path, prop),
);

View file

@ -53,12 +53,12 @@ fn shutdown(_: &Application) {
thread::spawn(|| {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(100),
);
let res: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetDaemon", "UnregisterClient", ("ReSet",));
proxy.method_call("org.Xetibo.ReSet.Daemon", "UnregisterClient", ("ReSet",));
res
});
}
@ -67,16 +67,16 @@ async fn daemon_check() {
let handle = thread::spawn(|| {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.Xetibo.ReSetDaemon",
"/org/Xetibo/ReSetDaemon",
"org.Xetibo.ReSet.Daemon",
"/org/Xetibo/ReSet/Daemon",
Duration::from_millis(100),
);
let res: Result<(), Error> =
proxy.method_call("org.Xetibo.ReSetDaemon", "RegisterClient", ("ReSet",));
proxy.method_call("org.Xetibo.ReSet.Daemon", "RegisterClient", ("ReSet",));
res
});
let res = handle.join();
if res.unwrap().is_err() {
run_daemon().await;
run_daemon(APP_ID).await;
}
}