refactor launcher removing templates
This commit is contained in:
parent
839a4a55d7
commit
7c0cf048ee
10 changed files with 188 additions and 84 deletions
|
|
@ -1,3 +1,21 @@
|
|||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Clone, Debug, Default, glib::GBoxed)]
|
||||
#[gboxed(type_name = "BoxedSearchResult")]
|
||||
pub struct BoxedSearchResult(pub Option<pop_launcher::SearchResult>);
|
||||
|
||||
pub fn icon_source(icon: &Rc<RefCell<gtk4::Image>>, source: &Option<pop_launcher::IconSource>) {
|
||||
match source {
|
||||
Some(pop_launcher::IconSource::Name(name)) => {
|
||||
icon.borrow().set_from_icon_name(Some(name));
|
||||
}
|
||||
Some(pop_launcher::IconSource::Mime(content_type)) => {
|
||||
icon.borrow()
|
||||
.set_from_gicon(&gio::content_type_get_icon(content_type));
|
||||
}
|
||||
_ => {
|
||||
icon.borrow().set_from_icon_name(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue