reach out directly to pop shell gbus for window list

This commit is contained in:
Ashley Wulber 2021-12-22 12:32:46 -05:00
parent 6be5b84b24
commit c2dd25a09d
6 changed files with 58 additions and 34 deletions

View file

@ -1,4 +1,4 @@
use crate::utils::BoxedSearchResults;
use crate::utils::BoxedWindowList;
use gio::DesktopAppInfo;
use glib::{ParamFlags, ParamSpec, Value};
use gtk4::glib;
@ -12,7 +12,7 @@ use std::cell::RefCell;
#[derive(Default)]
pub struct DockObject {
appinfo: RefCell<Option<DesktopAppInfo>>,
active: RefCell<BoxedSearchResults>,
active: RefCell<BoxedWindowList>,
saved: Cell<bool>,
}
@ -47,7 +47,7 @@ impl ObjectImpl for DockObject {
"active",
// Short description
"active",
BoxedSearchResults::static_type(),
BoxedWindowList::static_type(),
// The property can be read and written to
ParamFlags::READWRITE,
),
@ -72,7 +72,7 @@ impl ObjectImpl for DockObject {
self.appinfo.replace(appinfo);
}
"active" => {
let active = value.get().expect("Value needs to be BoxedSearchResults");
let active = value.get().expect("Value needs to be BoxedWindowList");
self.active.replace(active);
}
"saved" => {

View file

@ -1,6 +1,6 @@
mod imp;
use crate::utils::BoxedSearchResults;
use crate::utils::BoxedWindowList;
use gdk4::glib::Object;
use gio::DesktopAppInfo;
use gtk4::glib;
@ -16,7 +16,7 @@ impl DockObject {
.expect("Failed to create `DockObject`.")
}
pub fn from_search_results(results: BoxedSearchResults) -> Self {
pub fn from_search_results(results: BoxedWindowList) -> Self {
let appinfo = if let Some(first) = results.0.iter().next() {
xdg::BaseDirectories::new()
.expect("could not access XDG Base directory")