Skip to content

Commit

Permalink
wip changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanabx committed Apr 15, 2024
1 parent 1e66712 commit 786b0c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
13 changes: 2 additions & 11 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub async fn client(
println!("{}", entry.to_string());

match proxy.register_entry(&entry.appid, &file_text).await {
Ok(true) => {
Ok(_) => {
log::info!("Daemon registered entry: {}", entry.appid);
if let Some(icon_name) = entry.icon() {
if let Some(icon_path) = icon_lookup.lookup(icon_name, None) {
Expand All @@ -79,15 +79,9 @@ pub async fn client(
.register_icon(icon_name, file_bytes.as_slice())
.await
{
Ok(true) => {
Ok(_) => {
log::info!("Daemon registered icon: {}", icon_name);
}
Ok(false) => {
log::error!(
"DBus returned false for icon: {}",
icon_name
);
}
Err(e) => {
log::error!("Error (icons): {:?}", e);
}
Expand All @@ -98,9 +92,6 @@ pub async fn client(
}
}
}
Ok(false) => {
log::error!("DBus returned false for entry: {}", entry.appid);
}
Err(e) => {
log::error!("Error (entry): {}", e);
}
Expand Down
17 changes: 14 additions & 3 deletions src/desktop_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
//! This type implements the [D-Bus standard interfaces], (`org.freedesktop.DBus.*`) for which the
//! following zbus API can be used:
//!
//! * [`zbus::fdo::IntrospectableProxy`]
//! * [`zbus::fdo::PropertiesProxy`]
//! * [`zbus::fdo::PeerProxy`]
//! * [`zbus::fdo::IntrospectableProxy`]
//!
//! Consequently `zbus-xmlgen` did not generate code for the above interfaces.
//!
Expand All @@ -26,9 +26,20 @@ use zbus::proxy;
assume_defaults = true
)]
trait DesktopEntry {
/// RegisterChangeHandler method
fn register_change_handler(&self) -> zbus::Result<()>;

/// RegisterEntry method
fn register_entry(&self, appid: &str, entry: &str) -> zbus::Result<bool>;
fn register_entry(&self, appid: &str, entry: &str) -> zbus::Result<()>;

/// RegisterIcon method
fn register_icon(&self, name: &str, data: &[u8]) -> zbus::Result<bool>;
fn register_icon(&self, name: &str, data: &[u8]) -> zbus::Result<()>;

/// EntryChanged signal
#[zbus(signal)]
fn entry_changed(&self, appid: &str) -> zbus::Result<()>;

/// IconChanged signal
#[zbus(signal)]
fn icon_changed(&self, icon_name: &str) -> zbus::Result<()>;
}

0 comments on commit 786b0c5

Please sign in to comment.