handle favoriting from the dock popover menu
This commit is contained in:
parent
69b7ab5906
commit
849333df3d
4 changed files with 71 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use std::path::Path;
|
||||
|
||||
use gdk4::glib::Object;
|
||||
use gdk4::prelude::FileExt;
|
||||
use gdk4::subclass::prelude::ObjectSubclassExt;
|
||||
use gio::DesktopAppInfo;
|
||||
use gtk4::glib;
|
||||
|
|
@ -36,6 +37,22 @@ impl DockObject {
|
|||
None
|
||||
}
|
||||
|
||||
pub fn get_name(&self) -> Option<String> {
|
||||
let imp = imp::DockObject::from_instance(&self);
|
||||
if let Some(app_info) = imp.appinfo.borrow().as_ref() {
|
||||
app_info
|
||||
.filename()
|
||||
.map(|name| name.to_string_lossy().into())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_saved(&self, is_saved: bool) {
|
||||
let imp = imp::DockObject::from_instance(&self);
|
||||
imp.saved.replace(is_saved);
|
||||
}
|
||||
|
||||
pub fn from_search_results(results: BoxedWindowList) -> Self {
|
||||
let appinfo = if let Some(first) = results.0.iter().next() {
|
||||
xdg::BaseDirectories::new()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue