parent
9db93107cc
commit
79eff08add
1 changed files with 36 additions and 32 deletions
68
src/main.rs
68
src/main.rs
|
@ -278,38 +278,42 @@ impl cosmic::Application for App {
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(index, item)| {
|
.map(|(index, item)| {
|
||||||
dnd_destination(tooltip( button::standard(item.title.clone())
|
let button = button::standard(item.title.clone())
|
||||||
.leading_icon({
|
.leading_icon({
|
||||||
match item.kind {
|
match item.kind {
|
||||||
core::kinds::ServiceItemKind::Song(_) => {
|
core::kinds::ServiceItemKind::Song(_) => {
|
||||||
icon::from_name("folder-music-symbolic")
|
icon::from_name("folder-music-symbolic")
|
||||||
},
|
},
|
||||||
core::kinds::ServiceItemKind::Video(_) => {
|
core::kinds::ServiceItemKind::Video(_) => {
|
||||||
icon::from_name("folder-videos-symbolic")
|
icon::from_name("folder-videos-symbolic")
|
||||||
},
|
},
|
||||||
core::kinds::ServiceItemKind::Image(_) => {
|
core::kinds::ServiceItemKind::Image(_) => {
|
||||||
icon::from_name("folder-pictures-symbolic")
|
icon::from_name("folder-pictures-symbolic")
|
||||||
},
|
},
|
||||||
core::kinds::ServiceItemKind::Presentation(_) => {
|
core::kinds::ServiceItemKind::Presentation(_) => {
|
||||||
icon::from_name("x-office-presentation-symbolic")
|
icon::from_name("x-office-presentation-symbolic")
|
||||||
},
|
},
|
||||||
core::kinds::ServiceItemKind::Content(_) => {
|
core::kinds::ServiceItemKind::Content(_) => {
|
||||||
icon::from_name("x-office-presentation-symbolic")
|
icon::from_name("x-office-presentation-symbolic")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.class(cosmic::theme::style::Button::HeaderBar)
|
.class(cosmic::theme::style::Button::HeaderBar)
|
||||||
.padding(5)
|
.padding(5)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.on_press(cosmic::Action::App(Message::ChangeServiceItem(index))),
|
.on_press(cosmic::Action::App(Message::ChangeServiceItem(index)));
|
||||||
text::body(item.kind.to_string()), TPosition::Right), vec!["application/service-item".into()]).data_received_for::<ServiceItem>( move |item| {
|
let tooltip = tooltip(button,
|
||||||
if let Some(item) = item {
|
text::body(item.kind.to_string()),
|
||||||
cosmic::Action::App(Message::AddServiceItem(index, item))
|
TPosition::Right);
|
||||||
} else {
|
dnd_destination(tooltip, vec!["application/service-item".into()])
|
||||||
cosmic::Action::None
|
.data_received_for::<ServiceItem>( move |item| {
|
||||||
}
|
if let Some(item) = item {
|
||||||
})
|
cosmic::Action::App(Message::AddServiceItem(index, item))
|
||||||
.into()
|
} else {
|
||||||
|
cosmic::Action::None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.into()
|
||||||
});
|
});
|
||||||
|
|
||||||
let column = column![
|
let column = column![
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue