From 486beff8a550e0bc757e79ea37c450cab3a810eb Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Fri, 8 Nov 2024 01:38:27 +0000 Subject: [PATCH] refactor: put in basic placeholders for menu icon diffs --- src/modules/tray/diff.rs | 7 +++++-- src/modules/tray/interface.rs | 10 +++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/modules/tray/diff.rs b/src/modules/tray/diff.rs index dd756af..8afa3da 100644 --- a/src/modules/tray/diff.rs +++ b/src/modules/tray/diff.rs @@ -18,7 +18,9 @@ pub struct MenuItemDiff { /// True if the item is visible in the menu. pub visible: Option, /// Icon name of the item, following the freedesktop.org icon spec. - // pub icon_name: Option>, + pub icon_name: Option>, + /// PNG icon data. + pub icon_data: Option>>, /// Describe the current state of a "togglable" item. Can be one of: /// - Some(true): on /// - Some(false): off @@ -52,7 +54,8 @@ impl MenuItemDiff { label: diff!(&label), enabled: diff!(enabled), visible: diff!(visible), - // icon_name: diff!(&icon_name), + icon_name: diff!(&icon_name), + icon_data: diff!(&icon_data), toggle_state: diff!(toggle_state), submenu: get_diffs(&old.submenu, &new.submenu), } diff --git a/src/modules/tray/interface.rs b/src/modules/tray/interface.rs index 84dd755..95162bc 100644 --- a/src/modules/tray/interface.rs +++ b/src/modules/tray/interface.rs @@ -343,9 +343,13 @@ impl TrayMenuItem { } // TODO: Image support - // if let Some(icon_name) = diff.icon_name { - // - // } + if let Some(_icon_name) = diff.icon_name { + warn!("received unimplemented menu icon update"); + } + + if let Some(_icon_data) = diff.icon_data { + warn!("received unimplemented menu icon update"); + } if let Some(enabled) = diff.enabled { match &self.widget {