free_launch/
item_update.rs

1use crate::{desktop_item::DesktopItem, invocation::Invocation, launch_entry::LaunchId};
2
3pub enum ItemUpdate {
4    Invocation(Invocation),
5    DesktopItem(DesktopItem),
6}
7
8impl ItemUpdate {
9    pub(crate) fn id(&self) -> String {
10        match self {
11            ItemUpdate::Invocation(invocation) => invocation.id().to_owned(),
12            ItemUpdate::DesktopItem(desktop_item) => desktop_item.id(),
13        }
14    }
15
16    pub(crate) fn name(&self) -> String {
17        match self {
18            ItemUpdate::Invocation(invocation) => invocation.name().to_owned(),
19            ItemUpdate::DesktopItem(desktop_item) => desktop_item.name().to_owned(),
20        }
21    }
22
23    pub(crate) fn path(&self) -> String {
24        match self {
25            ItemUpdate::Invocation(invocation) => invocation.item_path.clone(),
26            ItemUpdate::DesktopItem(desktop_item) => {
27                desktop_item.desktop_file_path.to_string_lossy().to_string()
28            }
29        }
30    }
31}