mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-15 11:36:11 +08:00
Update to build with latest glib
glib replaced its glib::object_subclass!() macro with
a #[glib::object_subclass] attribute, to simplify a bunch of things.
See fdc8459b39
This commit is contained in:
@@ -11,33 +11,23 @@ mod imp {
|
||||
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct GraphView {
|
||||
pub(super) nodes: RefCell<HashMap<u32, Node>>,
|
||||
pub(super) links: RefCell<HashMap<u32, crate::PipewireLink>>,
|
||||
pub(super) dragged: Rc<RefCell<Option<gtk::Widget>>>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for GraphView {
|
||||
const NAME: &'static str = "GraphView";
|
||||
type Type = super::GraphView;
|
||||
type ParentType = gtk::Widget;
|
||||
type Instance = glib::subclass::simple::InstanceStruct<Self>;
|
||||
type Class = glib::subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib::object_subclass!();
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
// The layout manager determines how child widgets are laid out.
|
||||
klass.set_layout_manager_type::<gtk::FixedLayout>();
|
||||
}
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
nodes: RefCell::new(HashMap::new()),
|
||||
links: RefCell::new(HashMap::new()),
|
||||
dragged: Rc::new(RefCell::new(None)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for GraphView {
|
||||
|
||||
@@ -18,14 +18,11 @@ mod imp {
|
||||
pub(super) num_ports_out: Cell<u32>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for Node {
|
||||
const NAME: &'static str = "Node";
|
||||
type Type = super::Node;
|
||||
type ParentType = gtk::Widget;
|
||||
type Instance = glib::subclass::simple::InstanceStruct<Self>;
|
||||
type Class = glib::subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib::object_subclass!();
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.set_layout_manager_type::<gtk::BinLayout>();
|
||||
|
||||
Reference in New Issue
Block a user