refactor dnd and fix dnd bugs

This commit is contained in:
Ashley Wulber 2021-12-27 17:59:49 -05:00
parent 9bde60bbe9
commit fb6bbb79a7
6 changed files with 429 additions and 176 deletions

View file

@ -16,6 +16,18 @@ impl DockObject {
.expect("Failed to create `DockObject`.")
}
pub fn from_app_info_path(path: &str) -> Option<Self> {
if let Some(appinfo) = gio::DesktopAppInfo::new(path) {
if appinfo.should_show() {
return Some(
Object::new(&[("appinfo", &Some(appinfo)), ("saved", &true)])
.expect("Failed to create `DockObject`."),
);
}
}
None
}
pub fn from_search_results(results: BoxedWindowList) -> Self {
let appinfo = if let Some(first) = results.0.iter().next() {
xdg::BaseDirectories::new()