Skip to content

Commit

Permalink
Switch from im-rc to imbl which is maintained.
Browse files Browse the repository at this point in the history
  • Loading branch information
saivert committed May 10, 2024
1 parent f88f28a commit 5b68b00
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 32 deletions.
43 changes: 16 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gettext-rs = { version = "0.7", features = ["gettext-system"] }
gtk = { version = "0.7.1", package = "gtk4", features = ["v4_10"]}
glib = { version = "0.18", features = ["log"] }
log = "0.4.11"
im-rc = "15.1.0"
imbl = "3.0.0"
once_cell = "1.15.0"
wireplumber = { git = "https://github.com/arcnmx/wireplumber.rs.git", rev = "341b0c4e8d177f5f21c109cf88cca4f2dc1f853a", features = ["v0_4_12"] }
#wireplumber = { git = "https://github.com/saivert/wireplumber.rs.git", branch = "use_pipewire_from_git", features = ["v0_4_12"] }
Expand Down
2 changes: 1 addition & 1 deletion src/backend/pwnodemodel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::backend::PwNodeObject;
use gtk::{gio, glib, prelude::*, subclass::prelude::*};
use std::cell::RefCell;
use im_rc::Vector;
use imbl::Vector;

mod imp {
use super::*;
Expand Down
8 changes: 5 additions & 3 deletions src/backend/pwroutefiltermodel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{ParamAvailability, PwRouteObject, RouteDirection};
use glib::{closure_local, subclass::prelude::*, Properties};
use gtk::{gio, prelude::*, subclass::prelude::*};
use std::cell::{Cell, RefCell};
use std::collections::BTreeSet;
use imbl::OrdSet;

mod imp {
use super::*;
Expand All @@ -13,7 +13,7 @@ mod imp {
#[properties(wrapper_type = super::PwRouteFilterModel)]
pub struct PwRouteFilterModel {
/// Contains the items that matches the filter predicate.
pub(super) hashset: RefCell<BTreeSet<u32>>,
pub(super) hashset: RefCell<OrdSet<u32>>,

#[property(get, set, construct_only, builder(RouteDirection::Unknown))]
pub(super) direction: Cell<RouteDirection>,
Expand Down Expand Up @@ -53,14 +53,16 @@ mod imp {

impl PwRouteFilterModel {
pub fn set_model(&self, new_model: Option<&gio::ListModel>) {


if let Some(new_model) = new_model {
assert!(self.item_type().is_a(new_model.item_type()));

let widget = self.obj();
let handler = closure_local!(@watch widget => move |listmodel: &gio::ListModel, position: u32, _removed: u32, _added: u32| {
let removed = widget.imp().hashset.borrow().len() as u32;

let mut hashset = BTreeSet::new();
let mut hashset = OrdSet::new();

for (a, routeobject) in listmodel.iter::<PwRouteObject>()
.skip(position as usize)
Expand Down

0 comments on commit 5b68b00

Please sign in to comment.