dock right click menu

This commit is contained in:
Ashley Wulber 2022-01-03 21:33:26 -05:00
parent 35eb571528
commit 3a72c74b08
9 changed files with 206 additions and 14 deletions

View file

@ -1,5 +1,9 @@
use glib::subclass::Signal;
use gtk4::glib;
use gtk4::prelude::*;
use gtk4::subclass::prelude::*;
use gtk4::PopoverMenu;
use once_cell::sync::Lazy;
use std::cell::RefCell;
use std::rc::Rc;
@ -7,6 +11,8 @@ use std::rc::Rc;
pub struct DockItem {
pub image: Rc<RefCell<gtk4::Image>>,
pub dots: Rc<RefCell<gtk4::Label>>,
pub item_box: Rc<RefCell<gtk4::Box>>,
pub popover_menu: Rc<RefCell<Option<PopoverMenu>>>,
}
#[glib::object_subclass]
@ -16,7 +22,22 @@ impl ObjectSubclass for DockItem {
type ParentType = gtk4::Button;
}
impl ObjectImpl for DockItem {}
impl ObjectImpl for DockItem {
fn signals() -> &'static [Signal] {
static SIGNALS: Lazy<Vec<Signal>> = Lazy::new(|| {
vec![Signal::builder(
// Signal name
"popover-closed",
// Types of the values which will be sent to the signal handler
&[],
// Type of the value the signal handler sends back
<()>::static_type().into(),
)
.build()]
});
SIGNALS.as_ref()
}
}
impl WidgetImpl for DockItem {}